DiscordCoreAPI
A Discord bot library written in C++, with custom asynchronous coroutines.
Loading...
Searching...
No Matches
ApplicationCommandEntities.hpp
Go to the documentation of this file.
1/*
2 MIT License
3
4 DiscordCoreAPI, A bot library for Discord, written in C++, and featuring explicit multithreading through the usage of custom, asynchronous C++ CoRoutines.
5
6 Copyright 2022, 2023 Chris M. (RealTimeChris)
7
8 Permission is hereby granted, free of charge, to any person obtaining a copy
9 of this software and associated documentation files (the "Software"), to deal
10 in the Software without restriction, including without limitation the rights
11 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 copies of the Software, and to permit persons to whom the Software is
13 furnished to do so, subject to the following conditions:
14
15 The above copyright notice and this permission notice shall be included in all
16 copies or substantial portions of the Software.
17
18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 SOFTWARE.
25*/
26/// ApplicationCommandEntities.hpp - Header for the application_command_data classes
27/// and structs. aug 25, 2021 Chris M.
28/// https://discordcoreapi.com
29/// \file ApplicationCommandEntities.hpp
30#pragma once
31
34
36
37 /**
38 * \addtogroup foundation_entities
39 * @{
40 */
41
42 /// @brief For getting all of the global application commands.
44 snowflake applicationId{};///< The current application's snowflake (the bot's user_data snowflake).
45 bool withLocalizations{};///< Do we collect the name-and-description localizations?
46 };
47
48 /// @brief For collecting a single global application_command_data.
50 snowflake applicationId{};///< The current application's snowflake (the bot's user_data snowflake).
51 jsonifier::string commandId{};///< The id of the command which you would like to collect.
52 };
53
54 /// @brief For creating an application command.
56 friend class discord_core_client;
57
58 protected:
59 bool alwaysRegister{};
60 };
61
62 /// @brief For creating a single global application_command_data.
64
65 /// @brief For editing a single global application_command_data.
67 unordered_map<jsonifier::string, jsonifier::string>
68 descriptionLocalizations{};///< Dictionary with keys in available locales localization dictionary for the description field.
69 unordered_map<jsonifier::string, jsonifier::string> nameLocalizations{};///< Dictionary with keys in available locales localization dictionary for the name field.
70 jsonifier::vector<application_command_option_data> options{};///< The options for the application_command_data.
71 jsonifier::string defaultMemberPermissions{};///< Set of permissions represented as a bit set. only for globally - scoped commands.
72 jsonifier::string description{};///< A description of the command.
73 snowflake applicationId{};///< The current application's snowflake (the bot's user_data snowflake).
74 bool dmPermission{};///< Indicates whether the command is available in dms with the app.
75 jsonifier::string name{};///< A name for the new command.
76 };
77
78 /// @brief For deleting a single global application_command_data.
80 snowflake applicationId{};///< The current application's snowflake (the bot's user_data snowflake).
81 jsonifier::string name{};///< The name of the command to delete.
82 };
83
84 /// @brief For bulk-overwriting a collection of global application_commands.
86 jsonifier::vector<create_global_application_command_data> responseData{};///< A vector of the options for the application_commands.
87 snowflake applicationId{};///< The current application's snowflake (the bot's user_data snowflake).
88 };
89
90 /// @brief For acquiring all of the guild application_commands of a single guild.
92 snowflake applicationId{};///< The current application's snowflake (the bot's user_data snowflake).
93 bool withLocalizations{};///< Do we collect the name-and-description localizations?
94 snowflake guildId{};///< The id of the guild for which you would like to acquire the application_commands from.
95 };
96
97 /// @brief For creating a single guild application_command_data.
99
100 /// @brief For acquiring a single guild application_command_data.
102 snowflake applicationId{};///< The current application's snowflake (the bot's user_data snowflake).
103 snowflake commandId{};///< The command id which you would like to acquire.
104 snowflake guildId{};///< The id of the guild from which you would like to acquire the application_command_data from.
105 };
106
107 /// @brief For editing a single guild application_command_data.
109 unordered_map<jsonifier::string, jsonifier::string> descriptionLocalizations{};///< Dictionary with keys in available locales.
110 unordered_map<jsonifier::string, jsonifier::string> nameLocalizations{};///< Dictionary with keys in available locales.
111 jsonifier::vector<application_command_option_data> options{};///< The options for the application_command_data.
112 jsonifier::string defaultMemberPermissions{};///< Set of permissions represented as a bit set. only for globally - scoped commands.
113 jsonifier::string description{};///< A description of the command.
114 snowflake applicationId{};///< The current application's snowflake (the bot's user_data snowflake).
115 bool dmPermission{};///< Indicates whether the command is available in dms with the app.
116 snowflake guildId{};///< The id of the guild which you would like to add the new command to.
117 jsonifier::string name{};///< A name for the new command.
118 };
119
120 /// @brief For deleting a single guild application_command_data.
122 snowflake applicationId{};///< The current application's snowflake (the bot's user_data snowflake).
123 snowflake guildId{};///< The id of the guild which you would like to delete the command from.
124 jsonifier::string name{};///< A name of the command which you would like to delete.
125 };
126
127 /// @brief For bulk-overwriting a collection of guild application_commands.
129 jsonifier::vector<create_guild_application_command_data> responseData{};///< A vector of the options for the application_commands.
130 snowflake applicationId{};///< The current application's snowflake (the bot's user_data snowflake).
131 snowflake guildId{};///< The id of the guild which you would like to overwrite the commands of.
132 };
133
134 /// @brief For acquiring the permissions of a collection of guild application_commands.
136 snowflake applicationId{};///< The current application's snowflake (the bot's user_data snowflake).
137 snowflake guildId{};///< The id of the guild from which you would like to acquire the command permissions.
138 };
139
140 /// @brief For acquiring the permissions of a single guild application_command_data.
142 jsonifier::string commandName{};///< The name of the command which you would like to collect the permissions of.
143 snowflake applicationId{};///< The current application's snowflake (the bot's user_data snowflake).
144 snowflake guildId{};///< The id of the guild from which you would like to acquire the command permissions.
145 };
146
147 /// @brief For editing the permissions of a single guild application_command_data.
149 jsonifier::vector<application_command_permission_data> permissions{};///< A vector of application_command_data permissions.
150 jsonifier::string commandName{};///< The command name which you would like to edit the permissions of.
151 snowflake applicationId{};///< The current application's snowflake (the bot's user_data snowflake).
152 snowflake commandId{};///< The command id which you would like to edit the permissions of.
153 snowflake guildId{};///< The guild id of the guild for which you would like to edit the command permissions.
154 };
155
156 /// @brief For batch editing the permissions of a collection of guild application_commands.
158 jsonifier::vector<guild_application_command_permissions_data> permissions{};///< A vector of edit-guild-application-permissions responseData to edit.
159 snowflake applicationId{};///< The current application's snowflake (the bot's user_data snowflake).
160 snowflake guildId{};///< The guild id of the guild for which you would like to batch edit guild application permissions.
161 };
162
163 /**@}*/
164
165 /**
166 * \addtogroup main_endpoints
167 * @{
168 */
169 /// @brief An interface class for the application_command_data related discord endpoints.
171 public:
172 static void initialize(discord_core_internal::https_client*);
173
174 /// @brief Get all of the global application_commands for this bot.
175 /// @param dataPackage the info for acquiring the global_application_command_data.
176 /// @return a co_routine containing a vector<application_command_data>.
177 static co_routine<jsonifier::vector<application_command_data>> getGlobalApplicationCommandsAsync(get_global_application_commands_data dataPackage);
178
179 /// @brief Create a global application_command_data for this bot.
180 /// @param dataPackage a create_global_application_command_data structure.
181 /// @return a co_routine containing an application_command_data.
182 static co_routine<application_command_data> createGlobalApplicationCommandAsync(create_global_application_command_data dataPackage);
183
184 /// @brief Get a single global application_command_data for this bot.
185 /// @param dataPackage a get_global_application_command_data structure.
186 /// @return a co_routine containing an application_command_data.
187 static co_routine<application_command_data> getGlobalApplicationCommandAsync(get_global_application_command_data dataPackage);
188
189 /// @brief Edit a global application_command_data for this bot.
190 /// @param dataPackage an edit_global_application_command_data structure.
191 /// @return a co_routine containing an application_command_data.
192 static co_routine<application_command_data> editGlobalApplicationCommandAsync(edit_global_application_command_data dataPackage);
193
194 /// @brief Delete a global application_command_data for this bot.
195 /// @param dataPackage a delete_global_application_command_data structure.
196 /// @return a co_routine containing void.
197 static co_routine<void> deleteGlobalApplicationCommandAsync(delete_global_application_command_data dataPackage);
198
199 /// @brief Bulk overwrites a collection of global application_commands.
200 /// @param dataPackage a bulk_overwrite_global_application_commands_data structure.
201 /// @return a co_routine containing a vector<application_command_data>.
202 static co_routine<jsonifier::vector<application_command_data>> bulkOverwriteGlobalApplicationCommandsAsync(bulk_overwrite_global_application_commands_data dataPackage);
203
204 /// @brief Get all of the guild application_commands for a single guild for this bot.
205 /// @param dataPackage a get_guild_application_commands_data structure.
206 /// @return a co_routine containing a vector<application_command_data>.
207 static co_routine<jsonifier::vector<application_command_data>> getGuildApplicationCommandsAsync(get_guild_application_commands_data dataPackage);
208
209 /// @brief Create a guild application_command_data for a single server for this bot.
210 /// @param dataPackage a create_guild_application_command_data structure.
211 /// @return a co_routine containing an application_command_data.
212 static co_routine<application_command_data> createGuildApplicationCommandAsync(create_guild_application_command_data dataPackage);
213
214 /// @brief Get a single guild application_command_data for a single server for this bot.
215 /// @param dataPackage a get_guild_application_command_data structure.
216 /// @return a co_routine containing an application_command_data.
217 static co_routine<application_command_data> getGuildApplicationCommandAsync(get_guild_application_command_data dataPackage);
218
219 /// @brief Edit a single guild application_command_data for a single server for this bot.
220 /// @param dataPackage an edit_guild_application_command_data structure.
221 /// @return a co_routine containing an application_command_data.
222 static co_routine<application_command_data> editGuildApplicationCommandAsync(edit_guild_application_command_data dataPackage);
223
224 /// @brief Delete a single guild application_command_data for a single server for this bot.
225 /// @param dataPackage a delete_guild_application_command_data structure.
226 /// @return a co_routine containing void.
227 static co_routine<void> deleteGuildApplicationCommandAsync(delete_guild_application_command_data dataPackage);
228
229 /// @brief Bulkoverwrites some guild application_commands for this bot.
230 /// @param dataPackage a bulk_overwrite_guild_application_commands_data structure.
231 /// @return a co_routine containing a vector<application_command_data>.
232 static co_routine<jsonifier::vector<application_command_data>> bulkOverwriteGuildApplicationCommandsAsync(bulk_overwrite_guild_application_commands_data dataPackage);
233
234 /// @brief Gets guild application_command_data permissions for a single server on this bot.
235 /// @param dataPackage a get_guild_application_command_permissions_data structure.
236 /// @return a co_routine containing a vector<guild_application_command_permissions_data>.
237 static co_routine<jsonifier::vector<guild_application_command_permissions_data>> getGuildApplicationCommandPermissionsAsync(
238 const get_guild_application_command_permissions_data dataPackage);
239
240 /// @brief Get application_command_data permissions for a single command on this bot.
241 /// @param dataPackage a get_application_command_permissions_data structure.
242 /// @return a co_routine containing a guild_application_command_permissions_data.
243 static co_routine<guild_application_command_permissions_data> getApplicationCommandPermissionsAsync(get_application_command_permissions_data dataPackage);
244
245 /// @brief Edit guild application_command_data permissions for a server on this bot.
246 /// @param dataPackage an edit_guild_application_command_permissions_data structure.
247 /// @return a co_routine containing a guild_application_command_permissions_data.
248 static co_routine<guild_application_command_permissions_data> editGuildApplicationCommandPermissionsAsync(
249 const edit_guild_application_command_permissions_data dataPackage);
250
251 protected:
252 static discord_core_internal::https_client* httpsClient;
253 };
254
255 /**@}*/
256
257}
Data structure representing an application_command_data.
An interface class for the application_command_data related discord endpoints.
static co_routine< jsonifier::vector< application_command_data > > getGlobalApplicationCommandsAsync(get_global_application_commands_data dataPackage)
Get all of the global application_commands for this bot.
static co_routine< void > deleteGlobalApplicationCommandAsync(delete_global_application_command_data dataPackage)
Delete a global application_command_data for this bot.
static co_routine< jsonifier::vector< application_command_data > > bulkOverwriteGlobalApplicationCommandsAsync(bulk_overwrite_global_application_commands_data dataPackage)
Bulk overwrites a collection of global application_commands.
static co_routine< application_command_data > getGlobalApplicationCommandAsync(get_global_application_command_data dataPackage)
Get a single global application_command_data for this bot.
static co_routine< guild_application_command_permissions_data > editGuildApplicationCommandPermissionsAsync(const edit_guild_application_command_permissions_data dataPackage)
Edit guild application_command_data permissions for a server on this bot.
static co_routine< jsonifier::vector< application_command_data > > getGuildApplicationCommandsAsync(get_guild_application_commands_data dataPackage)
Get all of the guild application_commands for a single guild for this bot.
static co_routine< application_command_data > createGlobalApplicationCommandAsync(create_global_application_command_data dataPackage)
Create a global application_command_data for this bot.
static co_routine< jsonifier::vector< guild_application_command_permissions_data > > getGuildApplicationCommandPermissionsAsync(const get_guild_application_command_permissions_data dataPackage)
Gets guild application_command_data permissions for a single server on this bot.
static co_routine< application_command_data > editGlobalApplicationCommandAsync(edit_global_application_command_data dataPackage)
Edit a global application_command_data for this bot.
static co_routine< application_command_data > createGuildApplicationCommandAsync(create_guild_application_command_data dataPackage)
Create a guild application_command_data for a single server for this bot.
static co_routine< jsonifier::vector< application_command_data > > bulkOverwriteGuildApplicationCommandsAsync(bulk_overwrite_guild_application_commands_data dataPackage)
Bulkoverwrites some guild application_commands for this bot.
static co_routine< guild_application_command_permissions_data > getApplicationCommandPermissionsAsync(get_application_command_permissions_data dataPackage)
Get application_command_data permissions for a single command on this bot.
static co_routine< application_command_data > editGuildApplicationCommandAsync(edit_guild_application_command_data dataPackage)
Edit a single guild application_command_data for a single server for this bot.
static co_routine< void > deleteGuildApplicationCommandAsync(delete_guild_application_command_data dataPackage)
Delete a single guild application_command_data for a single server for this bot.
static co_routine< application_command_data > getGuildApplicationCommandAsync(get_guild_application_command_data dataPackage)
Get a single guild application_command_data for a single server for this bot.
The main namespace for the forward-facing interfaces.
For batch editing the permissions of a collection of guild application_commands.
snowflake applicationId
The current application's snowflake (the bot's user_data snowflake).
jsonifier::vector< guild_application_command_permissions_data > permissions
A vector of edit-guild-application-permissions responseData to edit.
snowflake guildId
The guild id of the guild for which you would like to batch edit guild application permissions.
For bulk-overwriting a collection of global application_commands.
snowflake applicationId
The current application's snowflake (the bot's user_data snowflake).
jsonifier::vector< create_global_application_command_data > responseData
A vector of the options for the application_commands.
For bulk-overwriting a collection of guild application_commands.
snowflake applicationId
The current application's snowflake (the bot's user_data snowflake).
jsonifier::vector< create_guild_application_command_data > responseData
A vector of the options for the application_commands.
snowflake guildId
The id of the guild which you would like to overwrite the commands of.
For creating a single global application_command_data.
For creating a single guild application_command_data.
For deleting a single global application_command_data.
jsonifier::string name
The name of the command to delete.
snowflake applicationId
The current application's snowflake (the bot's user_data snowflake).
For deleting a single guild application_command_data.
jsonifier::string name
A name of the command which you would like to delete.
snowflake applicationId
The current application's snowflake (the bot's user_data snowflake).
snowflake guildId
The id of the guild which you would like to delete the command from.
For editing a single global application_command_data.
bool dmPermission
Indicates whether the command is available in dms with the app.
jsonifier::string description
A description of the command.
unordered_map< jsonifier::string, jsonifier::string > descriptionLocalizations
Dictionary with keys in available locales localization dictionary for the description field.
snowflake applicationId
The current application's snowflake (the bot's user_data snowflake).
jsonifier::string defaultMemberPermissions
Set of permissions represented as a bit set. only for globally - scoped commands.
unordered_map< jsonifier::string, jsonifier::string > nameLocalizations
Dictionary with keys in available locales localization dictionary for the name field.
jsonifier::vector< application_command_option_data > options
The options for the application_command_data.
For editing a single guild application_command_data.
jsonifier::string description
A description of the command.
unordered_map< jsonifier::string, jsonifier::string > nameLocalizations
Dictionary with keys in available locales.
bool dmPermission
Indicates whether the command is available in dms with the app.
jsonifier::string defaultMemberPermissions
Set of permissions represented as a bit set. only for globally - scoped commands.
snowflake applicationId
The current application's snowflake (the bot's user_data snowflake).
jsonifier::vector< application_command_option_data > options
The options for the application_command_data.
snowflake guildId
The id of the guild which you would like to add the new command to.
unordered_map< jsonifier::string, jsonifier::string > descriptionLocalizations
Dictionary with keys in available locales.
For editing the permissions of a single guild application_command_data.
snowflake commandId
The command id which you would like to edit the permissions of.
jsonifier::vector< application_command_permission_data > permissions
A vector of application_command_data permissions.
snowflake applicationId
The current application's snowflake (the bot's user_data snowflake).
jsonifier::string commandName
The command name which you would like to edit the permissions of.
snowflake guildId
The guild id of the guild for which you would like to edit the command permissions.
For acquiring the permissions of a single guild application_command_data.
snowflake applicationId
The current application's snowflake (the bot's user_data snowflake).
snowflake guildId
The id of the guild from which you would like to acquire the command permissions.
jsonifier::string commandName
The name of the command which you would like to collect the permissions of.
For collecting a single global application_command_data.
snowflake applicationId
The current application's snowflake (the bot's user_data snowflake).
jsonifier::string commandId
The id of the command which you would like to collect.
For getting all of the global application commands.
bool withLocalizations
Do we collect the name-and-description localizations?
snowflake applicationId
The current application's snowflake (the bot's user_data snowflake).
For acquiring a single guild application_command_data.
snowflake guildId
The id of the guild from which you would like to acquire the application_command_data from.
snowflake commandId
The command id which you would like to acquire.
snowflake applicationId
The current application's snowflake (the bot's user_data snowflake).
For acquiring the permissions of a collection of guild application_commands.
snowflake guildId
The id of the guild from which you would like to acquire the command permissions.
snowflake applicationId
The current application's snowflake (the bot's user_data snowflake).
For acquiring all of the guild application_commands of a single guild.
snowflake applicationId
The current application's snowflake (the bot's user_data snowflake).
bool withLocalizations
Do we collect the name-and-description localizations?
snowflake guildId
The id of the guild for which you would like to acquire the application_commands from.