Corrected autofill function return structures.

This commit is contained in:
alwayscompiling
2022-12-02 16:08:36 -05:00
parent 14602282e9
commit cc20868bde
3 changed files with 25 additions and 20 deletions
+11 -7
View File
@@ -91,8 +91,8 @@ class DataManagementCog(commands.Cog, name="Table Management"):
async def from_category(
self,
interaction: nextcord.Interaction,
group_id: int = nextcord.SlashOption(description="Group to delete user from.", required=True),
category_id: int = nextcord.SlashOption(description="Category to delete user from.", required=True),
group_id: str = nextcord.SlashOption(description="Group to delete user from.", required=True),
category_id: str = nextcord.SlashOption(description="Category to delete user from.", required=True),
user_name: str = nextcord.SlashOption(description="User to delete.", required=True),
):
"""
@@ -100,21 +100,25 @@ class DataManagementCog(commands.Cog, name="Table Management"):
Args:
interaction (nextcord.Interaction): Interaction that invoked the command.
group_id (int): Group to remove user from. Is SlashOption.
category_id (int): Category to remove user from. Is SlashOption.
group_id (str): String representation of Group id to remove user from. Is SlashOption.
category_id (str): String representation of Category id to remove user from. Is SlashOption.
user_name (str): The user to remove. Is SlashOption.
"""
stmt = select(CategoryGroup).where(CategoryGroup.GroupId == group_id)
stmt = select(CategoryGroup).where(CategoryGroup.GroupId == int(group_id))
group = session.scalar(stmt)
stmt = select(Score).where(Score.CategoryId == category_id)
stmt = select(Category.CategoryName).where(Category.CategoryId == int(category_id))
category_name = session.scalar(stmt)
stmt = select(Score).where(Score.CategoryId == int(category_id))
for score in session.scalars(stmt):
session.delete(score)
session.commit()
await send_highscore_message(interaction.guild.get_channel(group.ChannelId), group)
await interaction.response.send_message(f'User "{user_name}" removed from "{category_id}".', ephemeral=True)
await interaction.response.send_message(f'User "{user_name}" removed from "{category_name}".', ephemeral=True)
@user.subcommand(description="Deletes a user's scores from entire group.")
async def from_group(