Clarify optional SlashOptions

This commit is contained in:
alwayscompiling
2022-12-02 15:28:53 -05:00
parent 2e3f298036
commit 14602282e9
2 changed files with 12 additions and 16 deletions
+3 -3
View File
@@ -48,7 +48,7 @@ class MessageManagementCog(commands.Cog, name="Message Management"):
Args: Args:
interaction (nextcord.Interaction): Interaction that invoked the command interaction (nextcord.Interaction): Interaction that invoked the command
channel (Optional[nextcord.abc.GuildChannel], optional): Channel to clear of messages. channel (Optional[nextcord.abc.GuildChannel]): Channel to clear of messages.
Is a SlashOption. Limited to text channels. Defaults to None. Is a SlashOption. Limited to text channels. Defaults to None.
""" """
@@ -115,14 +115,14 @@ class MessageManagementCog(commands.Cog, name="Message Management"):
async def refresh_group( async def refresh_group(
self, self,
interaction: nextcord.Interaction, interaction: nextcord.Interaction,
group_id: Optional[int] = nextcord.SlashOption(description="Name of table.", required=True), group_id: int = nextcord.SlashOption(description="Name of table.", required=True),
) -> None: ) -> None:
""" """
Refreshes a table given by user. Refreshes a table given by user.
Args: Args:
interaction (nextcord.Interaction): Interaction that invoked the command. interaction (nextcord.Interaction): Interaction that invoked the command.
group_id (Optional[int]): Group id to refresh. Not optional. Is SlashOption. group_id (int): Group id to refresh. Is SlashOption.
""" """
stmt = ( stmt = (
+9 -13
View File
@@ -33,9 +33,7 @@ class SettingsManagementCog(commands.Cog, name="Settings Management"):
async def group_output_channel( async def group_output_channel(
self, self,
interaction: nextcord.Interaction, interaction: nextcord.Interaction,
group_id: Optional[int] = nextcord.SlashOption( group_id: int = nextcord.SlashOption(description="Category Group to assign to channel.", required=True),
description="Category Group to assign to channel.", required=True
),
channel: Optional[nextcord.abc.GuildChannel] = nextcord.SlashOption( channel: Optional[nextcord.abc.GuildChannel] = nextcord.SlashOption(
description="Channel to register", description="Channel to register",
required=False, required=False,
@@ -48,7 +46,7 @@ class SettingsManagementCog(commands.Cog, name="Settings Management"):
Args: Args:
interaction (nextcord.Interaction): Interaction that invoked the command interaction (nextcord.Interaction): Interaction that invoked the command
group_id (Optional[int]): Group to register channel to. Is SlashOption. group_id (int): Group to register channel to. Is SlashOption.
channel (nextcord.abc.GuildChannel, optional): Channel to register channel (nextcord.abc.GuildChannel, optional): Channel to register
Is a SlashOption. Limited to text channels, Defaults to None. Is a SlashOption. Limited to text channels, Defaults to None.
""" """
@@ -109,7 +107,7 @@ class SettingsManagementCog(commands.Cog, name="Settings Management"):
Args: Args:
interaction (nextcord.Interaction): Interaction that invoked the command interaction (nextcord.Interaction): Interaction that invoked the command
channel (Optional[nextcord.abc.GuildChannel], optional): Channel to register channel (Optional[nextcord.abc.GuildChannel]): Channel to register
Is a SlashOption. Limited to text channels, Defaults to None. Is a SlashOption. Limited to text channels, Defaults to None.
""" """
if not channel: if not channel:
@@ -133,18 +131,16 @@ class SettingsManagementCog(commands.Cog, name="Settings Management"):
async def category_pad_length( async def category_pad_length(
self, self,
interaction: nextcord.Interaction, interaction: nextcord.Interaction,
group_id: Optional[int] = nextcord.SlashOption( group_id: int = nextcord.SlashOption(description="Category Group to assign to channel.", required=True),
description="Category Group to assign to channel.", required=True length: int = nextcord.SlashOption(description="Number of characters.", required=True, default=26),
),
length: Optional[int] = nextcord.SlashOption(description="Number of characters.", required=True, default=26),
) -> None: ) -> None:
""" """
Changes guild's category pad length. Changes guild's category pad length.
Args: Args:
interaction (nextcord.Interaction): Interaction that invoked the command interaction (nextcord.Interaction): Interaction that invoked the command
group_id (Optional[int]): Group to set pad length in. Is SlashOption. group_id (int): Group to set pad length in. Is SlashOption.
length (Optional[int]): Number of characters. Is SlashOption. Defaults to 26. length (int): Number of characters. Is SlashOption. Defaults to 26.
""" """
stmt = ( stmt = (
@@ -175,14 +171,14 @@ class SettingsManagementCog(commands.Cog, name="Settings Management"):
async def username_length( async def username_length(
self, self,
interaction: nextcord.Interaction, interaction: nextcord.Interaction,
length: Optional[int] = nextcord.SlashOption(description="Number of characters.", required=True, default=12), length: int = nextcord.SlashOption(description="Number of characters.", required=True, default=12),
) -> None: ) -> None:
""" """
Changes guild's username length limit. Changes guild's username length limit.
Args: Args:
interaction (nextcord.Interaction): Interaction that invoked the command interaction (nextcord.Interaction): Interaction that invoked the command
length (Optional[int]): Number of charactesr. Is SlashOption. Defaults to 12. length (int): Number of charactesr. Is SlashOption. Defaults to 12.
""" """
stmt = select(Guild).where(Guild.GuildId == interaction.guild_id) stmt = select(Guild).where(Guild.GuildId == interaction.guild_id)