26-rarity-vs-weight #46

Merged
waifu merged 8 commits from 26-rarity-vs-weighing into dev 2025-06-06 22:12:13 -07:00
Showing only changes of commit 0c2e3754da - Show all commits

View file

@ -84,10 +84,10 @@ dumbass.',
'attachment_urls': None 'attachment_urls': None
} }
if len(arguments) != 3: if len(arguments) != 2:
return { return {
'message': f'{full_user} Please specify the following attributes \ 'message': f'{full_user} Please specify the following attributes \
in order: name, rarity, drop weighting', in order: name, rarity',
'attachment_urls': None 'attachment_urls': None
} }
@ -97,17 +97,10 @@ in order: name, rarity, drop weighting',
be a number between 1 and 5', be a number between 1 and 5',
'attachment_urls': None 'attachment_urls': None
} }
if not (is_float(arguments[2]) and 0.0 < float(arguments[2]) <= 1.0):
return {
'message': f'{full_user} Invalid drop weight: \'{arguments[2]}\' \
must be a decimal value between 0.0 and 1.0',
'attachment_urls': None
}
character_id, file_id = add_character( character_id, file_id = add_character(
name=arguments[0], name=arguments[0],
rarity=int(arguments[1]), rarity=int(arguments[1]),
weight=float(arguments[2]),
image_url=image_url image_url=image_url
) )
return { return {
@ -121,7 +114,7 @@ def do_help(author: str) -> BotResponse:
return { return {
'message': f'{author} Here\'s what I can do:\n\ 'message': f'{author} Here\'s what I can do:\n\
- `roll` Pulls a random character.\n\ - `roll` Pulls a random character.\n\
- `create <name> <rarity> <weight>` Creates a character using a given image.\n\ - `create <name> <rarity>` Creates a character using a given image.\n\
- `help` Shows this message.', - `help` Shows this message.',
'attachment_urls': None 'attachment_urls': None
} }