bug fixes in from_group and autocomplete user.
This commit is contained in:
@@ -140,7 +140,7 @@ class DataManagementCog(commands.Cog, name="Table Management"):
|
||||
|
||||
stmt = select(CategoryGroup).where(CategoryGroup.GroupId == int(group_id))
|
||||
group = session.scalar(stmt)
|
||||
category_ids = select(Category.Id).where(Category.GroupId == int(group_id)).subquery()
|
||||
category_ids = select(Category.CategoryId).where(Category.GroupId == int(group_id)).subquery()
|
||||
stmt = select(Score).where(Score.CategoryId.in_(category_ids)).where(Score.UserName == user_name)
|
||||
|
||||
for score in session.scalars(stmt):
|
||||
@@ -148,7 +148,9 @@ class DataManagementCog(commands.Cog, name="Table Management"):
|
||||
session.commit()
|
||||
|
||||
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)
|
||||
await interaction.response.send_message(
|
||||
f'User "{user_name}" removed from all categories in {group.GroupName}.', ephemeral=True
|
||||
)
|
||||
|
||||
@from_category.on_autocomplete("group_id")
|
||||
@from_group.on_autocomplete("group_id")
|
||||
@@ -179,7 +181,7 @@ class DataManagementCog(commands.Cog, name="Table Management"):
|
||||
@from_category.on_autocomplete("user_name")
|
||||
@from_group.on_autocomplete("user_name")
|
||||
async def autocomplete_user(
|
||||
self, interaction: nextcord.Interaction, user_name: str, group_id: str, category_id: Optional[int] = 0
|
||||
self, interaction: nextcord.Interaction, user_name: str, group_id: str, category_id: Optional[str] = None
|
||||
):
|
||||
"""
|
||||
Autocomplete functions for user names.
|
||||
@@ -187,11 +189,14 @@ 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.
|
||||
group_id (int): Group to find category from.
|
||||
category_id (Optional[int]): Category to find User from, can be 0.
|
||||
group_id (str): String representation of Group id to find category from.
|
||||
category_id (Optional[str]): String representation of Category id to find User from, can be None.
|
||||
"""
|
||||
|
||||
await interaction.response.send_autocomplete(
|
||||
autofill_users_in_group_category(interaction.guild_id, group_id, category_id, user_name)
|
||||
autofill_users_in_group_category(
|
||||
interaction.guild_id, int(group_id), category_id if category_id else 0, user_name
|
||||
)
|
||||
)
|
||||
|
||||
@nextcord.slash_command(description="Request a username update. Admins must approve.")
|
||||
|
||||
Reference in New Issue
Block a user