run ruff check --fix
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
Commands for deleting groups/categories/scores in database and messages in discord..
|
||||
"""
|
||||
|
||||
from typing import Optional
|
||||
|
||||
import nextcord
|
||||
from nextcord.ext import commands
|
||||
@@ -48,7 +47,7 @@ class DeleteCog(commands.Cog, name="Table Management"):
|
||||
async def channel_messages(
|
||||
self,
|
||||
interaction: nextcord.Interaction,
|
||||
channel: Optional[nextcord.abc.GuildChannel] = nextcord.SlashOption(
|
||||
channel: nextcord.abc.GuildChannel | None = nextcord.SlashOption(
|
||||
description="Channel to clear of messages.",
|
||||
required=False,
|
||||
channel_types=[nextcord.ChannelType.text],
|
||||
@@ -64,7 +63,6 @@ class DeleteCog(commands.Cog, name="Table Management"):
|
||||
channel (Optional[nextcord.abc.GuildChannel]): Channel to clear of messages.
|
||||
Is a SlashOption. Limited to text channels. Defaults to None.
|
||||
"""
|
||||
|
||||
if not channel:
|
||||
channel = interaction.channel
|
||||
|
||||
@@ -107,10 +105,9 @@ class DeleteCog(commands.Cog, name="Table Management"):
|
||||
interaction (nextcord.Interaction): Interaction that invoked the command.
|
||||
user_name (str): User to remove from highscores
|
||||
"""
|
||||
|
||||
with Session(engine) as session:
|
||||
stmt = select(distinct(Score.CategoryId)).where(Score.UserName == user_name)
|
||||
category_ids: "list[int]" = list(session.scalars(stmt))
|
||||
category_ids: list[int] = list(session.scalars(stmt))
|
||||
|
||||
stmt = select(Score).where(Score.UserName == user_name)
|
||||
for score in session.scalars(stmt):
|
||||
@@ -185,7 +182,6 @@ class DeleteCog(commands.Cog, name="Table Management"):
|
||||
category_id (str): String representation of Category id to remove user from. Is SlashOption.
|
||||
user_name (str): The user to remove. Is SlashOption.
|
||||
"""
|
||||
|
||||
with Session(engine) as session:
|
||||
stmt = select(CategoryGroup).where(CategoryGroup.GroupId == int(group_id))
|
||||
group = session.scalar(stmt)
|
||||
@@ -219,7 +215,6 @@ class DeleteCog(commands.Cog, name="Table Management"):
|
||||
group_id (str): String representation of Group id to remove user from. Is SlashOption.
|
||||
user_name (str): The user to remove. Is SlashOption.
|
||||
"""
|
||||
|
||||
with Session(engine) as session:
|
||||
stmt = select(CategoryGroup).where(CategoryGroup.GroupId == int(group_id))
|
||||
group = session.scalar(stmt)
|
||||
@@ -267,7 +262,7 @@ class DeleteCog(commands.Cog, name="Table Management"):
|
||||
@from_category.on_autocomplete("user_name")
|
||||
@from_group.on_autocomplete("user_name")
|
||||
async def user_autocomplete(
|
||||
self, interaction: nextcord.Interaction, user_name: str, group_id: str, category_id: Optional[str] = None
|
||||
self, interaction: nextcord.Interaction, user_name: str, group_id: str, category_id: str | None = None
|
||||
):
|
||||
"""
|
||||
Autocomplete functions for user names.
|
||||
@@ -278,7 +273,6 @@ class DeleteCog(commands.Cog, name="Table Management"):
|
||||
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, int(group_id), category_id if category_id else 0, user_name
|
||||
|
||||
Reference in New Issue
Block a user