Skip to content

Commit 3a1e3c5

Browse files
authored
docs: improve hybrid cmd section (#1577)
1 parent 116c0f9 commit 3a1e3c5

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

docs/src/Guides/03 Creating Commands.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -521,13 +521,16 @@ If your bot is complex enough, you might find yourself wanting to use custom mod
521521

522522
To do this, you'll want to use a string option, and define a converter. Information on how to use converters can be found [on the converter page](../08 Converters).
523523

524-
## Prefixed/Text Commands
524+
## Hybrid Commands
525525

526-
To use prefixed commands, instead of typing `/my_command`, you will need to type instead `!my_command`, provided that the prefix you set is `!`.
526+
!!! note
527+
Prefixed commands, called by Discord as "text commands" and sometimes called "message commands" (not to be confused with Context Menu Message Commands), are commands that are triggered when a user sends a normal message with a designated "prefix" in front of them (ie `!my_command`).
528+
529+
interactions.py contains an extension for making these commands, which you can [read about here](/interactions.py/Guides/26 Prefixed Commands).
527530

528531
Hybrid commands are are slash commands that also get converted to an equivalent prefixed command under the hood. They are their own extension, and require [prefixed commands to be set up beforehand](/interactions.py/Guides/26 Prefixed Commands). After that, use the `setup` function in the `hybrid_commands` extension in your main bot file.
529532

530-
Your setup can (but doesn't necessarily have to) look like this:
533+
Your setup should look similar to this:
531534

532535
```python
533536
import interactions
@@ -549,7 +552,7 @@ async def my_command_function(ctx: HybridContext):
549552
await ctx.send("Hello World")
550553
```
551554

552-
Suggesting you are using the default mention settings for your bot, you should be able to run this command by `@BotPing my_command`.
555+
Suggesting you are using the default mention settings for your bot, you should be able to run this command by typing out `@BotPing my_command` or using the slash command `/my_command`. Both will work largely equivalently.
553556

554557
As you can see, the only difference between hybrid commands and slash commands, from a developer perspective, is that they use `HybridContext`, which attempts
555558
to seamlessly allow using the same context for slash and prefixed commands. You can always get the underlying context via `inner_context`, though.

0 commit comments

Comments
 (0)