-
-
Notifications
You must be signed in to change notification settings - Fork 169
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: added a page for clearing slashcommands (#939)
- Loading branch information
1 parent
a5ba94e
commit d6fd83d
Showing
3 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#include <dpp/dpp.h> | ||
|
||
int main() | ||
{ | ||
dpp::cluster bot("token"); | ||
|
||
bot.on_log(dpp::utility::cout_logger()); | ||
|
||
/* We won't be performing any commands, so we don't need to add the event here! */ | ||
|
||
bot.on_ready([&bot](const dpp::ready_t & event) { | ||
if (dpp::run_once<struct clear_bot_commands>()) { | ||
/* Now, we're going to wipe our commands */ | ||
bot.global_bulk_command_delete(); | ||
/* This one requires a guild id, otherwise it won't what guild's commands it needs to wipe! */ | ||
bot.guild_bulk_command_delete(857692897221033129); | ||
} | ||
|
||
/* Because the run_once above uses a 'clear_bot_commands' struct, you can continue to register commands below! */ | ||
}); | ||
|
||
bot.start(dpp::st_wait); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
docpages/example_programs/interactions_and_components/clearing_slashcommands.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
\page clearing_slashcommands Clearing registered commands | ||
|
||
After a while of creating commands, you may start to wonder "hm, how can I clear these?". Well, this tutorial covers it! All you have to do is simply call dpp::cluster::global_bulk_command_delete or dpp::cluster::guild_bulk_command_delete. | ||
|
||
\note Clearing **global commands** will only clear commands that were **made globally**, same goes for the opposite way round. The example will demonstrate using both functions. | ||
|
||
\include{cpp} clearing_slashcommands.cpp |