You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use a space after the comma in parameter lists, and after opening brackets and before closing brackets except when calling a function, e.g.:
30
+
This applies to functions, `while` statements, `if` statments, lambdas, nearly anything that uses curly braces with statements!
31
+
32
+
### Lists
33
+
34
+
Lists should have a space after the comma in parameter lists, and after opening brackets and before closing brackets except when calling a function, for example:
Copy file name to clipboardexpand all lines: docpages/example_programs/interactions_and_components/context_menus.md
+12-10
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,9 @@ Context menus are application commands that appear on the context menu (right cl
4
4
5
5
\image html context_menu_user_command.png
6
6
7
-
The following example shows how to create and handle **user context menus**.
7
+
\note This example sets the command as the type dpp::ctxm_user which can only be used by right clicking on a user. To make it appear on a message, you'll want to switch the type to dpp::ctxm_message.
8
+
9
+
The following example shows how to create and handle **user context menus** for message context menus, read the notice above.
8
10
9
11
~~~~~~~~~~{.cpp}
10
12
#include <dpp/dpp.h>
@@ -18,21 +20,21 @@ int main()
18
20
19
21
bot.on_ready([&bot](const dpp::ready_t &event) {
20
22
if (dpp::run_once<struct register_bot_commands>()) {
23
+
24
+
/* Create the command */
25
+
dpp::slashcommand command("High Five", "Send a High Five!", bot.me.id);
26
+
27
+
command.set_type(dpp::ctxm_user);
28
+
21
29
/* Register the command */
22
-
bot.guild_command_create(
23
-
dpp::slashcommand()
24
-
.set_type(dpp::ctxm_user)
25
-
.set_name("High Five")
26
-
.set_application_id(bot.me.id),
27
-
857692897221033129 // you need to put your guild-id in here
28
-
);
30
+
bot.guild_command_create(command, guild_id);
29
31
}
30
32
});
31
33
32
34
/* Use the on_user_context_menu event to look for user context menu actions */
0 commit comments