Compare commits
4
Commits
84c910b19c
...
76fbba739f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
76fbba739f | ||
|
|
7204e882f1 | ||
|
|
a8d775ca09 | ||
|
|
983b9b6f34 |
+60
-6
@@ -37,8 +37,8 @@ class GetCog(commands.Cog, name="Get command."):
|
|||||||
|
|
||||||
Args:
|
Args:
|
||||||
interaction (nextcord.Interaction): Interaction that invoked the command.
|
interaction (nextcord.Interaction): Interaction that invoked the command.
|
||||||
group_id (str): String representation of Group id to register channel to. Is SlashOption.
|
group_id (str): String representation of Group id get information from. Is SlashOption.
|
||||||
category_id (str): String representation of Category id to register channel to. Is SlashOption.
|
category_id (str): String representation of Category id to get information from. Is SlashOption.
|
||||||
"""
|
"""
|
||||||
stmt = (
|
stmt = (
|
||||||
select(Category).where(col(CategoryGroup.id) == int(group_id)).where(col(Category.id) == int(category_id))
|
select(Category).where(col(CategoryGroup.id) == int(group_id)).where(col(Category.id) == int(category_id))
|
||||||
@@ -69,8 +69,8 @@ class GetCog(commands.Cog, name="Get command."):
|
|||||||
|
|
||||||
Args:
|
Args:
|
||||||
interaction (nextcord.Interaction): Interaction that invoked the command.
|
interaction (nextcord.Interaction): Interaction that invoked the command.
|
||||||
group_id (str): String representation of Group id to register channel to. Is SlashOption.
|
group_id (str): String representation of Group id get information from. Is SlashOption.
|
||||||
category_id (str): String representation of Category id to register channel to. Is SlashOption.
|
category_id (str): String representation of Category id to get information from. Is SlashOption.
|
||||||
"""
|
"""
|
||||||
stmt = (
|
stmt = (
|
||||||
select(Category).where(col(CategoryGroup.id) == int(group_id)).where(col(Category.id) == int(category_id))
|
select(Category).where(col(CategoryGroup.id) == int(group_id)).where(col(Category.id) == int(category_id))
|
||||||
@@ -99,8 +99,8 @@ class GetCog(commands.Cog, name="Get command."):
|
|||||||
|
|
||||||
Args:
|
Args:
|
||||||
interaction (nextcord.Interaction): Interaction that invoked the command.
|
interaction (nextcord.Interaction): Interaction that invoked the command.
|
||||||
group_id (str): String representation of Group id to register channel to. Is SlashOption.
|
group_id (str): String representation of Group id get information from. Is SlashOption.
|
||||||
category_id (str): String representation of Category id to register channel to. Is SlashOption.
|
category_id (str): String representation of Category id to get information from. Is SlashOption.
|
||||||
"""
|
"""
|
||||||
stmt = (
|
stmt = (
|
||||||
select(Category).where(col(CategoryGroup.id) == int(group_id)).where(col(Category.id) == int(category_id))
|
select(Category).where(col(CategoryGroup.id) == int(group_id)).where(col(Category.id) == int(category_id))
|
||||||
@@ -118,6 +118,58 @@ 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
|
||||||
|
)
|
||||||
|
|
||||||
|
@group.subcommand(description="Get the username length of a group.")
|
||||||
|
async def username_length(
|
||||||
|
self,
|
||||||
|
interaction: nextcord.Interaction,
|
||||||
|
group_id: str = nextcord.SlashOption(
|
||||||
|
name="group", description="Group to get username length of.", required=True
|
||||||
|
),
|
||||||
|
) -> None:
|
||||||
|
"""
|
||||||
|
Command to view a group's username 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 username length of {group.username_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")
|
||||||
@@ -136,7 +188,9 @@ class GetCog(commands.Cog, name="Get command."):
|
|||||||
|
|
||||||
@is_ascending.on_autocomplete("group_id")
|
@is_ascending.on_autocomplete("group_id")
|
||||||
@is_validated.on_autocomplete("group_id")
|
@is_validated.on_autocomplete("group_id")
|
||||||
|
@pad_length.on_autocomplete("group_id")
|
||||||
@size.on_autocomplete("group_id")
|
@size.on_autocomplete("group_id")
|
||||||
|
@username_length.on_autocomplete("group_id")
|
||||||
async def group_autocomplete(self, interaction: nextcord.Interaction, group_id: str) -> None:
|
async def group_autocomplete(self, interaction: nextcord.Interaction, group_id: str) -> None:
|
||||||
"""
|
"""
|
||||||
Sends results from autofill_groups back to group_output_channel for autocompletion of group_id.
|
Sends results from autofill_groups back to group_output_channel for autocompletion of group_id.
|
||||||
|
|||||||
Reference in New Issue
Block a user