Skip to content

Commit

Permalink
add slash command documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
No767 committed Jul 24, 2024
1 parent 9be96ed commit 8821c0f
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions bot/cogs/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@

if TYPE_CHECKING:
from cogs.tickets import Tickets

from rodhaj import Rodhaj


Expand Down Expand Up @@ -311,7 +312,7 @@ class ConfigOptionFlags(commands.FlagConverter):
active: Optional[bool] = commands.flag(
name="active",
default=None,
description="Whether to show current active options or not. Using None will show all options, regardless of active status or not",
description="Whether to show current active options or not. Using None will show all options",
)


Expand Down Expand Up @@ -792,15 +793,13 @@ async def config_options(
@is_manager()
@commands.guild_only()
@config.command(name="help", aliases=["info"])
@app_commands.describe(option="Configuration option to use for lookup")
@app_commands.describe(key="Configuration key to use for lookup")
async def config_help(
self, ctx: GuildContext, option: Annotated[str, ConfigKeyConverter]
self, ctx: GuildContext, key: Annotated[str, ConfigKeyConverter]
) -> None:
"""Shows help information for different configuration options"""
# Because we are using the converter, all options are guaranteed to be correct
embed = ConfigEntryEmbed(
ConfigHelpEntry(key=option, **self.options_help[option])
)
embed = ConfigEntryEmbed(ConfigHelpEntry(key=key, **self.options_help[key]))
await ctx.send(embed=embed)

@is_manager()
Expand All @@ -821,6 +820,10 @@ async def config_help_all(self, ctx: GuildContext):
@is_manager()
@commands.guild_only()
@config.command(name="set-age")
@app_commands.describe(
type="Type of minimum age to set",
duration="The duration that this minimum age should be. E.g. 2 days",
)
async def config_set_age(
self,
ctx: GuildContext,
Expand All @@ -830,7 +833,7 @@ async def config_set_age(
FriendlyTimeResult, UserFriendlyTime(commands.clean_content, default="…")
],
) -> None:
"""Sets an minium duration for age-related options
"""Sets an minimum duration for age-related options
This command handles all age-related options. This means you can use this
to set the minimum age required to use Rodhaj
Expand All @@ -851,6 +854,10 @@ async def config_set_age(
@is_manager()
@commands.guild_only()
@config.command(name="set")
@app_commands.describe(
key="Configuration key to use for lookup",
value="Value to set for configuration",
)
async def config_set(
self,
ctx: GuildContext,
Expand Down Expand Up @@ -879,6 +886,10 @@ async def config_set(
@is_manager()
@commands.guild_only()
@config.command(name="toggle")
@app_commands.describe(
key="Configuration key to use for lookup",
value="Boolean option to set the configuration",
)
async def config_toggle(
self, ctx: GuildContext, key: Annotated[str, ConfigKeyConverter], *, value: bool
) -> None:
Expand Down

0 comments on commit 8821c0f

Please sign in to comment.