Skip to content

Commit

Permalink
docs: fixed missing () in pages.
Browse files Browse the repository at this point in the history
Also added some spacing in places and removal of indentation in autocomplete.md where it wasn't needed.
  • Loading branch information
Jaskowicz1 committed Aug 20, 2023
1 parent 118f362 commit f5e8730
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ int main()
{
dpp::cluster bot("token");
bot.on_log(dpp::utility::cout_logger());
bot.on_log(dpp::utility::cout_logger());
bot.on_ready([&bot](const dpp::ready_t & event) {
if (dpp::run_once<struct register_bot_commands>()) {
/* Create a new global command once on ready event */
bot.global_command_create(dpp::slashcommand("blep", "Send a random adorable animal photo", bot.me.id)
.add_option(
Expand All @@ -28,6 +29,7 @@ int main()
/* The interaction create event is fired when someone issues your commands */
bot.on_slashcommand([&bot](const dpp::slashcommand_t & event) {
/* Check which command they ran */
if (event.command.get_command_name() == "blep") {
/* Fetch a parameter value from the command parameters */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ int main() {
/* The event is fired when someone issues your commands */
bot.on_slashcommand([&bot](const dpp::slashcommand_t& event) {
/* Check which command they ran */
if (event.command.get_command_name == "button") {
if (event.command.get_command_name() == "button") {
/* Create a message */
dpp::message msg(event.command.channel_id, "this text has a button");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ int main() {
/* The event is fired when someone issues your commands */
bot.on_slashcommand([&bot](const dpp::slashcommand_t& event) {
/* Check which command they ran */
if (event.command.get_command_name() == "math") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ int main() {
/* The event is fired when someone issues your commands */
bot.on_slashcommand([&bot](const dpp::slashcommand_t& event) {
/* Check which command they ran */
if (event.command.get_command_name == "select") {
if (event.command.get_command_name() == "select") {
/* Create a message */
dpp::message msg(event.command.channel_id, "This text has a select menu!");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,17 @@ int main()
bot.on_log(dpp::utility::cout_logger());
/* Use the on_user_context_menu event to look for user context menu actions */
bot.on_user_context_menu([&](const dpp::user_context_menu_t& event) {
/* check if the context menu name is High Five */
if (event.command.get_command_name() == "high five") {
dpp::user user = event.get_user(); // the user who the command has been issued on
dpp::user author = event.command.get_issuing_user(); // the user who clicked on the context menu
event.reply(author.get_mention() + " slapped " + user.get_mention());
}
});
bot.on_ready([&bot](const dpp::ready_t &event) {
if (dpp::run_once<struct register_bot_commands>()) {
Expand All @@ -32,16 +43,6 @@ int main()
}
});
/* Use the on_user_context_menu event to look for user context menu actions */
bot.on_user_context_menu([&](const dpp::user_context_menu_t& event) {
/* check if the context menu name is High Five */
if (event.command.get_command_name() == "high five") {
dpp::user user = event.get_user(); // the user who the command has been issued on
dpp::user author = event.command.get_issuing_user(); // the user who clicked on the context menu
event.reply(author.get_mention() + " slapped " + user.get_mention());
}
});
/* Start bot */
bot.start(dpp::st_wait);
Expand Down
2 changes: 1 addition & 1 deletion docpages/example_programs/misc/cache_messages.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ int main() {
/* The event is fired when someone issues your commands */
bot.on_slashcommand([&bot](const dpp::slashcommand_t& event) {
/* Check which command they ran */
if (event.command.get_command_name == "get") {
if (event.command.get_command_name() == "get") {
dpp::message* find_msg = message_cache.find(std::get<std::string>(event.get_parameter("message_id")));
Expand Down

0 comments on commit f5e8730

Please sign in to comment.