Skip to content

Commit

Permalink
Add information about lowercase requirement for some slash command pr…
Browse files Browse the repository at this point in the history
…operties
  • Loading branch information
KubaZ2 committed Nov 1, 2023
1 parent a2fef7c commit 9b3b206
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ Ok, you have everything prepared. It's time to create first slash commands!
Create a new file `FirstModule.cs`. Make sure the class is public and add `using NetCord;` and `using NetCord.Services.ApplicationCommands;`. Make the class inheriting from `ApplicationCommandModule<SlashCommandContext>`. The file should look like this:
[!code-cs[Program.cs](Introduction/SlashCommands/Partial/FirstModule.cs)]

> [!IMPORTANT]
> Please note that names of:
> - slash commands
> - sub slash commands
> - slash command parameters
>
> **must** be lowercase.
Now, we will create a `ping` command! Add the following lines to the class.
[!code-cs[FirstModule.cs](Introduction/SlashCommands/Full/FirstModule.cs#L8-L12)]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
# Parameters

> [!WARNING]
> Parameters are supported only by Slash Commands.
> Parameters are supported only by slash commands.
## Optional parameters
To mark parameters as optional, give them a default value, example:
[!code-cs[ExampleModule.cs](Parameters/ExampleModule.cs#L9-L14)]

## Parameter name and description

> [!IMPORTANT]
> Parameter names **must** be lowercase.
You can change parameter name and parameter description using @NetCord.Services.ApplicationCommands.SlashCommandParameterAttribute, example:
[!code-cs[ExampleModule.cs](Parameters/ExampleModule.cs#L16-L20)]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Subcommands

> [!NOTE]
> Subcommands are only supported by slash commands.
## Example
[!code-cs[GuildCommandsModule.cs](Subcommands/GuildCommandsModule.cs)]

0 comments on commit 9b3b206

Please sign in to comment.