Variable name changes for clarification and fixing runtime issues.

This commit is contained in:
alwayscompiling
2022-12-01 20:21:36 -05:00
parent 2154d713cb
commit d0f328dd2d
4 changed files with 43 additions and 41 deletions
+15 -17
View File
@@ -96,7 +96,7 @@ class DataManagementCog(commands.Cog, name="Table Management"):
user_name: str = nextcord.SlashOption(description="User to delete.", required=True),
):
"""
Removes a user from a category. Uses autofill functions to fill out group_id, category_name, and user_name.
Removes a user from a category. Uses autofill functions to fill out group_id, category_id, and user_name.
Args:
interaction (nextcord.Interaction): Interaction that invoked the command.
@@ -144,36 +144,34 @@ class DataManagementCog(commands.Cog, name="Table Management"):
await send_highscore_message(interaction.guild.get_channel(group.ChannelId), group)
await interaction.response.send_message(f'User "{user_name}" removed from all categories.', ephemeral=True)
@from_category.on_autocomplete("table_name")
@from_group.on_autocomplete("table_name")
async def autocomplete_table(self, interaction: nextcord.Interaction, table_name: str):
@from_category.on_autocomplete("group_id")
@from_group.on_autocomplete("group_id")
async def autocomplete_table(self, interaction: nextcord.Interaction, group_id: str):
"""
Autocomplete function for table names.
Args:
interaction (nextcord.Interaction): Interaction that invoked the command.
table_name (str): String to be autocompleted with Table name.
group_id (str): String to be autocompleted with Table name.
"""
await interaction.response.send_autocomplete(autofill_groups(interaction.guild_id, table_name))
await interaction.response.send_autocomplete(autofill_groups(interaction.guild_id, group_id))
@from_category.on_autocomplete("category_name")
async def autocomplete_category(self, interaction: nextcord.Interaction, category_name: str, table_name: str):
@from_category.on_autocomplete("category_id")
async def autocomplete_category(self, interaction: nextcord.Interaction, category_id: str, group_id: str):
"""
Autocomplete function for category names.
Args:
interaction (nextcord.Interaction): Interaction that invoked the command.
category_name (str): String to be autocompleted with Category name.
table_name (str): Table to find Category from.
category_id (str): String to be autocompleted with Category name.
group_id (str): Table to find Category from.
"""
await interaction.response.send_autocomplete(
autofill_categories(interaction.guild_id, table_name, category_name)
)
await interaction.response.send_autocomplete(autofill_categories(interaction.guild_id, group_id, category_id))
@from_category.on_autocomplete("user_name")
@from_group.on_autocomplete("user_name")
async def autocomplete_user(
self, interaction: nextcord.Interaction, user_name: str, table_name: str, category_name: Optional[str]
self, interaction: nextcord.Interaction, user_name: str, group_id: str, category_id: Optional[int] = 0
):
"""
Autocomplete functions for user names.
@@ -181,11 +179,11 @@ class DataManagementCog(commands.Cog, name="Table Management"):
Args:
interaction (nextcord.Interaction): Interaction that invoked the command.
user_name (str): String to be autocompleted with User name.
table_name (str): Table to find category from.
category_name (Optional[str]): Category to find User from, can be None.
group_id (int): Group to find category from.
category_id (Optional[int]): Category to find User from, can be 0.
"""
await interaction.response.send_autocomplete(
autofill_users_in_group_category(interaction.guild_id, table_name, category_name, user_name)
autofill_users_in_group_category(interaction.guild_id, group_id, category_id, user_name)
)
@nextcord.slash_command(description="Request a username update. Admins must approve.")