Add command for getting group's pad length.
This commit is contained in:
@@ -118,6 +118,31 @@ class GetCog(commands.Cog, name="Get command."):
|
|||||||
async def group(self, interaction: nextcord.Interaction) -> None:
|
async def group(self, interaction: nextcord.Interaction) -> None:
|
||||||
"""Parent slash subcommand for getting group information. Never called."""
|
"""Parent slash subcommand for getting group information. Never called."""
|
||||||
|
|
||||||
|
@group.subcommand(description="Get the pad length of a group.")
|
||||||
|
async def pad_length(
|
||||||
|
self,
|
||||||
|
interaction: nextcord.Interaction,
|
||||||
|
group_id: str = nextcord.SlashOption(name="group", description="Group to get pad length of.", required=True),
|
||||||
|
) -> None:
|
||||||
|
"""
|
||||||
|
Command to view a group's pad length.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
interaction (nextcord.Interaction): Interaction that invoked the command.
|
||||||
|
group_id (str): String representation of Group id get information from. Is SlashOption.
|
||||||
|
"""
|
||||||
|
stmt = select(CategoryGroup).where(col(CategoryGroup.id) == int(group_id))
|
||||||
|
|
||||||
|
with Session(engine) as session:
|
||||||
|
group = session.scalar(stmt)
|
||||||
|
if group is None:
|
||||||
|
await interaction.response.send_message("Group was not found.", ephemeral=True)
|
||||||
|
return
|
||||||
|
|
||||||
|
await interaction.response.send_message(
|
||||||
|
f"{group.name} has a pad length of {group.pad_length}.", ephemeral=True
|
||||||
|
)
|
||||||
|
|
||||||
@is_ascending.on_autocomplete("category_id")
|
@is_ascending.on_autocomplete("category_id")
|
||||||
@is_validated.on_autocomplete("category_id")
|
@is_validated.on_autocomplete("category_id")
|
||||||
@size.on_autocomplete("category_id")
|
@size.on_autocomplete("category_id")
|
||||||
|
|||||||
Reference in New Issue
Block a user