Compare commits
2 commits
ad17d33660
...
7c7d299fc4
Author | SHA1 | Date | |
---|---|---|---|
7c7d299fc4 | |||
23ffd55b7b |
3 changed files with 28 additions and 7 deletions
|
@ -185,7 +185,7 @@ def insert_card(
|
||||||
if power is not None and charm is not None and wit is not None:
|
if power is not None and charm is not None and wit is not None:
|
||||||
CURSOR.execute(
|
CURSOR.execute(
|
||||||
'''
|
'''
|
||||||
INSERT INTO card (name, rarity, file_id, power, charm, wit)
|
INSERT INTO cards (name, rarity, file_id, power, charm, wit)
|
||||||
VALUES (?, ?, ?, ?, ?, ?)
|
VALUES (?, ?, ?, ?, ?, ?)
|
||||||
''',
|
''',
|
||||||
(name, rarity, file_id, power, charm, wit)
|
(name, rarity, file_id, power, charm, wit)
|
||||||
|
@ -193,7 +193,7 @@ def insert_card(
|
||||||
else:
|
else:
|
||||||
CURSOR.execute(
|
CURSOR.execute(
|
||||||
'''
|
'''
|
||||||
INSERT INTO card (name, rarity, file_id)
|
INSERT INTO cards (name, rarity, file_id)
|
||||||
VALUES (?, ?, ?)
|
VALUES (?, ?, ?)
|
||||||
''',
|
''',
|
||||||
(name, rarity, file_id)
|
(name, rarity, file_id)
|
||||||
|
|
|
@ -123,10 +123,10 @@ dumbass.',
|
||||||
'attachment_urls': None
|
'attachment_urls': None
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(arguments) != 2:
|
if not(len(arguments) in (2,5)):
|
||||||
return {
|
return {
|
||||||
'message': f'{author} Please specify the following attributes \
|
'message': f'{author} Please specify the following attributes \
|
||||||
in order: name, rarity',
|
in order: name, rarity. Optionally add [power, charm, wit].',
|
||||||
'attachment_urls': None
|
'attachment_urls': None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,6 +137,27 @@ be a number between 1 and 5',
|
||||||
'attachment_urls': None
|
'attachment_urls': None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(arguments) == 2:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
if not all(is_float(arg) for arg in arguments[2:]):
|
||||||
|
return {
|
||||||
|
'message': f'{author} Invalid attributes: power, charm and \
|
||||||
|
wit must be numbers.',
|
||||||
|
'attachment_urls': None
|
||||||
|
}
|
||||||
|
card_id, file_id = add_card(
|
||||||
|
name=arguments[0],
|
||||||
|
rarity=int(arguments[1]),
|
||||||
|
image_url=image_url,
|
||||||
|
power=int(arguments[2]),
|
||||||
|
charm=int(arguments[3]),
|
||||||
|
wit=int(arguments[4])
|
||||||
|
)
|
||||||
|
return {
|
||||||
|
'message': f'{author} Added {arguments[0]}, ID {card_id}.',
|
||||||
|
'attachment_urls': [file_id]
|
||||||
|
}
|
||||||
card_id, file_id = add_card(
|
card_id, file_id = add_card(
|
||||||
name=arguments[0],
|
name=arguments[0],
|
||||||
rarity=int(arguments[1]),
|
rarity=int(arguments[1]),
|
||||||
|
|
|
@ -16,11 +16,11 @@ You should have received a copy of the GNU Affero General Public License
|
||||||
along with this program. If not, see https://www.gnu.org/licenses/.
|
along with this program. If not, see https://www.gnu.org/licenses/.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ALTER TABLE card
|
ALTER TABLE cards
|
||||||
ADD COLUMN power INTEGER NOT NULL DEFAULT 0;
|
ADD COLUMN power INTEGER NOT NULL DEFAULT 0;
|
||||||
|
|
||||||
ALTER TABLE card
|
ALTER TABLE cards
|
||||||
ADD COLUMN charm INTEGER NOT NULL DEFAULT 0;
|
ADD COLUMN charm INTEGER NOT NULL DEFAULT 0;
|
||||||
|
|
||||||
ALTER TABLE card
|
ALTER TABLE cards
|
||||||
ADD COLUMN wit INTEGER NOT NULL DEFAULT 0;
|
ADD COLUMN wit INTEGER NOT NULL DEFAULT 0;
|
Loading…
Add table
Reference in a new issue