Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: reorganize interactions and components, add subcategories and move some things to other places #942

Merged
merged 5 commits into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 5 additions & 15 deletions docpages/example_programs/interactions_and_components.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,10 @@
\page interactions-and-components Interactions And Components

The example programs listed here demonstrate lots of things to do with interactions, application commands (slash commands) and message components. If you're looking to make your bot **modern and user friendly** these examples are what you need.
Interactions are a unified way provided by Discord to handle \ref slashcommands "slash commands" and \ref components-menu "component interactions", such as \ref components "clicking a button". Slash commands are much better than message commands as they are not rate limited as much, meaning your bot can handle a lot more at once. They also contain a lot of data about a command, for example by making a command take a user as a parameter, \ref resolved-objects "the entire user object will be contained in the interaction" so you do not have to fetch it yourself, avoiding even more rate limits!

* \subpage slashcommands "Using Slash Commands and Interactions"
* \subpage clearing_slashcommands
* \subpage subcommands "Slash command sub-commands"
* \subpage slashcommands-menu "Slash Commands"
* \subpage user-only-messages "Ephemeral replies ('Only you can see this' replies)"
* \subpage components "Using button components"
* \subpage components2 "Advanced button components"
* \subpage components3 "Using select menu components"
* \subpage detecting-messages "Listening to messages"
* \subpage context-menu "Context Menus"
* \subpage modal-dialog-interactions "Modal Dialogs"
* \subpage commandhandler "Unified message/slash command handler"
* \subpage application-command-autocomplete "Slash command auto completion"
* \subpage discord-application-command-file-upload "Using file parameters in slash commands"
* \subpage private-messaging
* \subpage making_threads
* \subpage resolved-objects
* \subpage components-menu
* \subpage modal-dialog-interactions "Modals"
* \subpage context-menu "Context Menus"
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
\page components-menu Message components

Components are anything that can be attached to a message or a \ref modal-dialog-interactions "modal" and interacted with, for example buttons and select menus. Due to being \ref interactions-and-components "interactions", they benefit from a low rate limit and are much more efficient than the old ways of using reactions for this purpose.

* \subpage components "Button components"
* \subpage components2 "Advanced button components"
* \subpage components3 "Select menu components"
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
\page slashcommands-menu Slash commands

Here you will find examples on how to use slash commands, subcommands, and different types or parameters.

* \subpage slashcommands "Using Slash Commands"
* \subpage clearing_slashcommands
* \subpage subcommands "Slash command sub-commands"
* \subpage application-command-autocomplete "Slash command auto completion"
* \subpage discord-application-command-file-upload "Using file parameters in slash commands"
* \subpage commandhandler "Unified message/slash command handler"

\note Keep in mind, a slash command when sent to your bot is <b>NOT SENT AS A MESSAGE</b>! It is not a string but an interaction structure with its own data, and \ref resolved-objects "command parameters are objects".
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
\page slashcommands Using Slash Commands and Interactions

Slash commands and interactions are a newer feature of Discord which allow bot's commands to be registered centrally within the system and for users to easily explore and get help with available commands through the client itself.
Slash commands and interactions are a newer feature of Discord which allow a bot's commands to be registered centrally within the system and for users to easily explore and get help with available commands through the client itself.

To add a slash command you should use the dpp::cluster::global_command_create method for global commands (available to all guilds) or dpp::cluster::guild_command_create to create a local command (available only to one guild). If you want to add many commands, it is advised to use the dpp::cluster::global_bulk_command_create method for global commands or the dpp::cluster::guild_bulk_command_create method for local commands.

Expand Down
2 changes: 2 additions & 0 deletions docpages/example_programs/misc.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ This section lists examples that do not fit neatly into any of the categories ab

* \subpage making_a_http_request "Making arbitrary HTTP requests using D++"
* \subpage spdlog "Integrating with spdlog"
* \subpage editing-channels-and-messages
* \subpage making_threads
* \subpage caching-messages "Caching messages"
* \subpage collecting-reactions "Collecting Reactions"
* \subpage cpp-eval-command-discord "Making an eval command in C++"
Expand Down
5 changes: 3 additions & 2 deletions docpages/example_programs/the_basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ These example programs are great to get started with simple things in the D++ li

* \subpage firstbot "Creating Your First Bot"
* \subpage embed-message "Sending Embeds"
* \subpage private-messaging
* \subpage attach-file "Attaching a file"
* \subpage webhooks "Webhooks"
* \subpage callback-functions "Using Callback Functions"
* \subpage editing-channels-and-messages
* \subpage using-cache
* \subpage using-cache
* \subpage detecting-messages "Listening to messages"