@@ -14,7 +14,24 @@ class ApplicationCommand : public DiscordObject {
14
14
enum Type {
15
15
CHAT_INPUT = 1 ,
16
16
USER = 2 ,
17
- MESSAGE = 3
17
+ MESSAGE = 3 ,
18
+ PRIMARY_ENTRY_POINT = 4
19
+ };
20
+
21
+ enum IntegrationType {
22
+ GUILD_INSTALL = 0 ,
23
+ USER_INSTALL = 1
24
+ };
25
+
26
+ enum ContextType {
27
+ GUILD = 0 ,
28
+ BOT_DM = 1 ,
29
+ PRIVATE_CHANNEL = 2
30
+ };
31
+
32
+ enum HandlerType {
33
+ APP_HANDLER = 1 ,
34
+ DISCORD_LAUNCH_ACTIVITY = 2
18
35
};
19
36
20
37
private:
@@ -33,10 +50,16 @@ class ApplicationCommand : public DiscordObject {
33
50
// / Parameters for the command, max of 25.
34
51
std::vector<ApplicationCommandOptionVariant> options;
35
52
// default_member_permissions
36
- // / Indicates wether the command is enabled in DMs. Defaults to true.
37
- bool dm_permission = true ;
53
+ // / Indicates whether the command is age-restricted, defaults to false.
54
+ bool nsfw = false ;
55
+ // / Installation contexts where the command is available, only for globally-scoped commands. Defaults to your app's configured contexts.
56
+ std::vector<IntegrationType> integration_types;
57
+ // / Interaction context(s) where the command can be used, only for globally-scoped commands. Defaults to all.
58
+ std::vector<ContextType> contexts;
38
59
// / Autoincrementing version identifier updated during substantial record changes.
39
60
std::string version;
61
+ // / Determines whether the interaction is handled by the app's interactions handler or by Discord. Use when type is PRIMARY_ENTRY_POINT.
62
+ std::optional<HandlerType> handler;
40
63
41
64
public:
42
65
DLL_EXPORT ApplicationCommand () = default;
@@ -59,10 +82,16 @@ class ApplicationCommand : public DiscordObject {
59
82
DLL_EXPORT Type get_type () { return type; }
60
83
// / @return Parameters for the command, max of 25.
61
84
DLL_EXPORT std::vector<ApplicationCommandOptionVariant> get_options () { return options; }
62
- // / @return Indicates wether the command is enabled in DMs. Defaults to true.
63
- DLL_EXPORT bool has_dm_permission () { return dm_permission; }
85
+ // / @return Indicates whether the command is age-restricted, defaults to false.
86
+ DLL_EXPORT bool is_nsfw () { return nsfw; }
87
+ // / @return Installation contexts where the command is available.
88
+ DLL_EXPORT std::vector<IntegrationType> get_integration_types () { return integration_types; }
89
+ // / @return Interaction context(s) where the command can be used.
90
+ DLL_EXPORT std::vector<ContextType> get_contexts () { return contexts; }
64
91
// / @return Autoincrementing version identifier updated during substantial record changes.
65
92
DLL_EXPORT std::string get_version () { return version; }
93
+ // / @return The handler type for PRIMARY_ENTRY_POINT.
94
+ DLL_EXPORT std::optional<HandlerType> get_handler () { return handler; }
66
95
67
96
// / Set the guild of the command.
68
97
DLL_EXPORT void set_guild_id (std::string guild_id) { this ->guild_id .emplace (guild_id); }
@@ -74,7 +103,13 @@ class ApplicationCommand : public DiscordObject {
74
103
DLL_EXPORT void set_type (Type type) { this ->type = type; }
75
104
// / Add parameters for the command, max of 25.
76
105
DLL_EXPORT void add_option (ApplicationCommandOptionVariant option) { options.push_back (option); }
77
- // / Set indicator wether the command is enabled in DMs.
78
- DLL_EXPORT void set_dm_permission (bool dm_permission) { this ->dm_permission = dm_permission; }
106
+ // / Set whether the command is age-restricted, defaults to false.
107
+ DLL_EXPORT void set_nsfw (bool nsfw) { this ->nsfw = nsfw; }
108
+ // / Add installation context where the command is available.
109
+ DLL_EXPORT void add_integration_types (IntegrationType integration_type) { integration_types.push_back (integration_type); }
110
+ // / Add interaction context where the command can be used.
111
+ DLL_EXPORT void add_contexts (ContextType context) { contexts.push_back (context); }
112
+ // / Set the handler type for PRIMARY_ENTRY_POINT.
113
+ DLL_EXPORT void get_handler (HandlerType handler) { this ->handler .emplace (handler); }
79
114
};
80
- } // namespace DiscordCPP
115
+ } // namespace DiscordCPP
0 commit comments