archetypehelp

This commit is contained in:
Sakimori 2022-09-18 12:10:11 -04:00
parent 4685f4aea8
commit 85cbc0ef8a

View file

@ -260,26 +260,17 @@ async def archetype(interaction, team: str, player: str, archetype: app_commands
class ArchetypeHelpCommand(Command): class ArchetypeHelpCommand(Command):
name = "archetypehelp" name = "archetypehelp"
template = "m;archetypehelp\nm;archetypehelp [archetype name]" template = "archetypehelp [archetype name]"
description = "Prints a list of all archetypes, or describes a given archetype." description = "Describes a given archetype."
async def execute(self, msg, command, flags): @client.tree.command()
archetype_list = archetypes.all_archetypes() @app_commands.choices(archetype=archetypes.archetype_choices())
try: async def archetypehelp(interaction, archetype: app_commands.Choice[str]):
archetype_name = command.split(" ",1)[1].strip() arch = archetypes.search_archetypes(archetype.value)
except IndexError: if arch is None:
#this means it's just the command, hoo-ray raise CommandError("We don't know what that archetype is. If you're trying to break new ground, here isn't the time *or* the place.")
string_list = ""
for arch in archetype_list:
string_list += arch.display_name + "\n"
await msg.channel.send(string_list)
return
arch = archetypes.search_archetypes(archetype_name) await interaction.response.send_message(f"""{arch.display_name}
if arch is None:
raise CommandError("We don't know what that archetype is. If you're trying to break new ground, here isn't the time *or* the place.")
await msg.channel.send(f"""{arch.display_name}
Short name: {arch.name} Short name: {arch.name}
{arch.description}""") {arch.description}""")