diff --git a/bot/add_card.py b/bot/add_card.py index 2c91618..524b82c 100644 --- a/bot/add_card.py +++ b/bot/add_card.py @@ -51,7 +51,6 @@ def add_card(name: str, rarity: int, weight: float, image_url: str) -> tuple[int card_id = db_utils.insert_card( stripped_name, rarity, - float(weight), file_id ) diff --git a/bot/db_utils.py b/bot/db_utils.py index 94e915e..bdbd0d8 100644 --- a/bot/db_utils.py +++ b/bot/db_utils.py @@ -150,12 +150,11 @@ def is_player_administrator(username: str) -> bool: def insert_card( - name: str, rarity: int, weight: float, file_id: str) -> int: + name: str, rarity: int, file_id: str) -> int: '''Inserts a card''' CURSOR.execute( - 'INSERT INTO cards (name, rarity, weight, file_id) VALUES \ -(?, ?, ?, ?)', - (name, rarity, weight, file_id) + 'INSERT INTO cards (name, rarity, file_id) VALUES (?, ?, ?)', + (name, rarity, file_id) ) card_id = CURSOR.lastrowid return card_id if card_id else 0 diff --git a/bot/response.py b/bot/response.py index ce7d937..e661bbf 100644 --- a/bot/response.py +++ b/bot/response.py @@ -107,10 +107,10 @@ dumbass.', 'attachment_urls': None } - if len(arguments) != 3: + if len(arguments) != 2: return { 'message': f'{author} Please specify the following attributes \ -in order: name, rarity, weight', +in order: name, rarity', 'attachment_urls': None } @@ -120,17 +120,10 @@ in order: name, rarity, weight', be a number between 1 and 5', 'attachment_urls': None } - if not (is_float(arguments[2]) and 0.0 < float(arguments[2]) <= 1.0): - return { - 'message': f'{author} Invalid drop weight: \'{arguments[2]}\' \ -must be a decimal value between 0.0 and 1.0', - 'attachment_urls': None - } card_id, file_id = add_card( name=arguments[0], rarity=int(arguments[1]), - weight=float(arguments[2]), image_url=image_url ) return {