From bd287b096ab6de4e3947e611b9517cd6767abdaa Mon Sep 17 00:00:00 2001 From: Moon Date: Fri, 13 Jun 2025 18:47:54 +0900 Subject: [PATCH 1/2] rm reference to weight column. --- bot/add_card.py | 1 - bot/db_utils.py | 7 +++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/bot/add_card.py b/bot/add_card.py index fcaab43..16834a9 100644 --- a/bot/add_card.py +++ b/bot/add_card.py @@ -58,7 +58,6 @@ def add_card( card_id = insert_card( stripped_name, rarity, - RARITY_TO_WEIGHT[rarity], file_id ) return card_id, 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 From 77d4fa13bb44ca9b5322eaf8b12bb71cfb9a6cd8 Mon Sep 17 00:00:00 2001 From: Moon Date: Fri, 13 Jun 2025 19:31:23 +0900 Subject: [PATCH 2/2] rm validation of removed weight --- bot/response.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/bot/response.py b/bot/response.py index b49de1e..e661bbf 100644 --- a/bot/response.py +++ b/bot/response.py @@ -120,12 +120,6 @@ in order: name, rarity', 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],