Enhance insert_card function to support optional power, charm, and wit parameters
This commit is contained in:
parent
7b75a7eea9
commit
cce941471f
1 changed files with 18 additions and 5 deletions
|
@ -166,10 +166,23 @@ def is_player_administrator(username: str) -> bool:
|
||||||
|
|
||||||
|
|
||||||
def insert_card(
|
def insert_card(
|
||||||
name: str, rarity: int, file_id: str) -> int:
|
name: str, rarity: int, file_id: str,
|
||||||
|
power: int =None, charm: int = None, wit: int = None) -> int:
|
||||||
'''Inserts a card'''
|
'''Inserts a card'''
|
||||||
|
if power is not None and charm is not None and wit is not None:
|
||||||
CURSOR.execute(
|
CURSOR.execute(
|
||||||
'INSERT INTO cards (name, rarity, file_id) VALUES (?, ?, ?)',
|
'''
|
||||||
|
INSERT INTO card (name, rarity, file_id, power, charm, wit)
|
||||||
|
VALUES (?, ?, ?, ?, ?, ?)
|
||||||
|
''',
|
||||||
|
(name, rarity, file_id, power, charm, wit)
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
CURSOR.execute(
|
||||||
|
'''
|
||||||
|
INSERT INTO card (name, rarity, file_id)
|
||||||
|
VALUES (?, ?, ?)
|
||||||
|
''',
|
||||||
(name, rarity, file_id)
|
(name, rarity, file_id)
|
||||||
)
|
)
|
||||||
card_id = CURSOR.lastrowid
|
card_id = CURSOR.lastrowid
|
||||||
|
|
Loading…
Add table
Reference in a new issue