39 template<>
struct core<discord_core_api::create_global_application_command_data> {
40 using value_type = discord_core_api::create_global_application_command_data;
41 static constexpr auto parseValue = createValue(
"id", &value_type::id,
"application_id", &value_type::applicationId,
"name", &value_type::name,
"description",
42 &value_type::description,
"type", &value_type::type,
"default_permission", &value_type::defaultMemberPermissions,
"options", &value_type::options,
"version",
43 &value_type::version,
"guild_id", &value_type::guildId,
"dm_permission", &value_type::dmPermission,
"name_localizations", &value_type::nameLocalizations,
44 "description_localizations", &value_type::descriptionLocalizations);
47 template<>
struct core<discord_core_api::create_guild_application_command_data> {
48 using value_type = discord_core_api::create_guild_application_command_data;
49 static constexpr auto parseValue = createValue(
"id", &value_type::id,
"application_id", &value_type::applicationId,
"name", &value_type::name,
"description",
50 &value_type::description,
"type", &value_type::type,
"default_permission", &value_type::defaultMemberPermissions,
"options", &value_type::options,
"version",
51 &value_type::version,
"guild_id", &value_type::guildId,
"dm_permission", &value_type::dmPermission,
"name_localizations", &value_type::nameLocalizations,
52 "description_localizations", &value_type::descriptionLocalizations);
55 template<>
struct core<discord_core_api::bulk_overwrite_global_application_commands_data> {
56 using value_type = discord_core_api::bulk_overwrite_global_application_commands_data;
57 static constexpr auto parseValue = createValue(
"commands", &value_type::responseData,
"application_id", &value_type::applicationId);
60 template<>
struct core<discord_core_api::edit_global_application_command_data> {
61 using value_type = discord_core_api::edit_global_application_command_data;
62 static constexpr auto parseValue = createValue(
"name", &value_type::name,
"description", &value_type::description,
"options", &value_type::options,
"default_permission",
63 &value_type::defaultMemberPermissions,
"name_localization", &value_type::nameLocalizations,
"description_localization", &value_type::descriptionLocalizations,
64 "application_id", &value_type::applicationId,
"dm_permission", &value_type::dmPermission);
67 template<>
struct core<discord_core_api::edit_guild_application_command_data> {
68 using value_type = discord_core_api::edit_guild_application_command_data;
69 static constexpr auto parseValue = createValue(
"description_localizations", &value_type::descriptionLocalizations,
"name_localizations", &value_type::nameLocalizations,
70 "options", &value_type::options,
"default_permission", &value_type::defaultMemberPermissions,
"description", &value_type::description,
"application_id",
71 &value_type::applicationId,
"guild_id", &value_type::guildId,
"name", &value_type::name);
74 template<>
struct core<discord_core_api::bulk_overwrite_guild_application_commands_data> {
75 using value_type = discord_core_api::bulk_overwrite_guild_application_commands_data;
76 static constexpr auto parseValue = createValue(
"commands", &value_type::responseData,
"application_id", &value_type::applicationId,
"guild_id", &value_type::guildId);
79 template<>
struct core<discord_core_api::edit_guild_application_command_permissions_data> {
80 using value_type = discord_core_api::edit_guild_application_command_permissions_data;
81 static constexpr auto parseValue = createValue(
"permissions", &value_type::permissions,
"command", &value_type::commandName,
"application_id", &value_type::applicationId,
82 "id", &value_type::commandId,
"guild_id", &value_type::guildId);
85 template<>
struct core<discord_core_api::batch_edit_guild_application_command_permissions_data> {
86 using value_type = discord_core_api::batch_edit_guild_application_command_permissions_data;
87 static constexpr auto parseValue = createValue(
"permissions", &value_type::permissions,
"application_id", &value_type::applicationId,
"guild_id", &value_type::guildId);
94 application_commands::httpsClient = client;
98 discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Get_Global_Application_Commands };
100 workload.workloadClass = discord_core_internal::https_workload_class::Get;
101 workload.relativePath =
"/applications/" + dataPackage.
applicationId +
"/commands";
103 workload.relativePath +=
"?with_localizations=true";
105 workload.callStack =
"application_commands::getGlobalApplicationCommandsAsync()";
106 jsonifier::vector<application_command_data> returnData{};
107 application_commands::httpsClient->submitWorkloadAndGetResult(std::move(workload), returnData);
108 co_return returnData;
112 discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Post_Global_Application_Command };
114 workload.workloadClass = discord_core_internal::https_workload_class::Post;
115 dataPackage.generateExcludedKeys();
116 workload.relativePath =
"/applications/" + dataPackage.
applicationId +
"/commands";
117 parser.serializeJson(dataPackage, workload.content);
118 workload.callStack =
"application_commands::createGlobalApplicationCommandAsync()";
119 application_command_data returnData{};
120 application_commands::httpsClient->submitWorkloadAndGetResult(std::move(workload), returnData);
121 co_return returnData;
125 discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Get_Global_Application_Command };
127 workload.workloadClass = discord_core_internal::https_workload_class::Get;
128 workload.relativePath =
"/applications/" + dataPackage.
applicationId +
"/commands/" + dataPackage.
commandId;
129 workload.callStack =
"application_commands::getGlobalApplicationCommandAsync()";
130 application_command_data returnData{};
131 application_commands::httpsClient->submitWorkloadAndGetResult(std::move(workload), returnData);
132 co_return returnData;
136 discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Patch_Global_Application_Command };
140 snowflake appCommandId{};
141 for (
auto& value: appCommands) {
142 if (value.name == dataPackage.
name) {
143 appCommandId = value.id;
148 co_return application_command_data();
150 workload.workloadClass = discord_core_internal::https_workload_class::Patch;
151 workload.relativePath =
"/applications/" + dataPackage.
applicationId +
"/commands/" + appCommandId.operator jsonifier::string();
152 parser.serializeJson(dataPackage, workload.content);
153 workload.callStack =
"application_commands::editGlobalApplicationCommandAsync()";
154 application_command_data returnData{};
155 application_commands::httpsClient->submitWorkloadAndGetResult(std::move(workload), returnData);
156 co_return returnData;
160 discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Delete_Global_Application_Command };
163 snowflake commandId{};
164 bool isItFound =
false;
165 for (
auto& value: appCommands) {
166 if (value.name == dataPackage.
name) {
167 commandId = value.id;
174 workload.workloadClass = discord_core_internal::https_workload_class::Delete;
175 workload.relativePath =
"/applications/" + dataPackage.
applicationId +
"/commands/" + commandId.operator jsonifier::string();
176 workload.callStack =
"application_commands::deleteGlobalApplicationCommandAsync()";
177 application_commands::httpsClient->submitWorkloadAndGetResult(std::move(workload));
183 discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Bulk_Put_Global_Application_Commands };
185 workload.workloadClass = discord_core_internal::https_workload_class::Put;
186 workload.relativePath =
"/applications/" + dataPackage.
applicationId +
"/commands";
187 parser.serializeJson(dataPackage, workload.content);
188 workload.callStack =
"application_commands::bulkOverwriteGlobalApplicationCommandsAsync()";
189 jsonifier::vector<application_command_data> returnData{};
190 application_commands::httpsClient->submitWorkloadAndGetResult(std::move(workload), returnData);
191 co_return returnData;
195 discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Get_Guild_Application_Commands };
197 workload.workloadClass = discord_core_internal::https_workload_class::Get;
198 workload.relativePath =
"/applications/" + dataPackage.
applicationId +
"/guilds/" + dataPackage.
guildId +
"/commands";
200 workload.relativePath +=
"?with_localizations=true";
202 workload.callStack =
"application_commands::getGuildApplicationCommandsAsync()";
203 jsonifier::vector<application_command_data> returnData{};
204 application_commands::httpsClient->submitWorkloadAndGetResult(std::move(workload), returnData);
205 co_return returnData;
209 discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Post_Guild_Application_Command };
212 workload.workloadClass = discord_core_internal::https_workload_class::Post;
213 dataPackage.generateExcludedKeys();
214 workload.relativePath =
"/applications/" + dataPackage.
applicationId +
"/guilds/" + dataPackage.
guildId +
"/commands";
215 parser.serializeJson(dataPackage, workload.content);
216 workload.callStack =
"application_commands::createGuildApplicationCommandAsync()";
217 application_command_data returnData{};
218 application_commands::httpsClient->submitWorkloadAndGetResult(std::move(workload), returnData);
219 co_return returnData;
223 discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Get_Guild_Application_Command };
225 workload.workloadClass = discord_core_internal::https_workload_class::Get;
226 workload.relativePath =
"/applications/" + dataPackage.
applicationId +
"/guilds/" + dataPackage.
guildId +
"/commands/" + dataPackage.
commandId;
227 workload.callStack =
"application_commands::getGuildApplicationCommandAsync()";
228 application_command_data returnData{};
229 application_commands::httpsClient->submitWorkloadAndGetResult(std::move(workload), returnData);
230 co_return returnData;
234 discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Patch_Guild_Application_Command };
237 bool isItFound =
false;
238 snowflake appCommandId{};
239 for (
auto& value: appCommands) {
240 if (value.name == dataPackage.
name) {
241 appCommandId = value.id;
246 co_return application_command_data();
248 workload.workloadClass = discord_core_internal::https_workload_class::Patch;
249 workload.relativePath =
"/applications/" + dataPackage.
applicationId +
"/guilds/" + dataPackage.
guildId +
"/commands/" + appCommandId;
250 parser.serializeJson(dataPackage, workload.content);
251 workload.callStack =
"application_commands::editGuildApplicationCommandAsync()";
252 application_command_data returnData{};
253 application_commands::httpsClient->submitWorkloadAndGetResult(std::move(workload), returnData);
254 co_return returnData;
258 discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Delete_Guild_Application_Command };
262 bool isItFound =
false;
263 for (
auto& value: appCommands) {
264 if (value.name == dataPackage.
name) {
265 commandId = value.
id;
272 workload.workloadClass = discord_core_internal::https_workload_class::Delete;
273 workload.relativePath =
"/applications/" + dataPackage.
applicationId +
"/guilds/" + dataPackage.
guildId +
"/commands/" + commandId;
274 workload.callStack =
"application_commands::deleteGuildApplicationCommandAsync()";
275 application_commands::httpsClient->submitWorkloadAndGetResult(std::move(workload));
281 discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Bulk_Put_Guild_Application_Commands };
283 parser.serializeJson(dataPackage, workload.content);
284 workload.workloadClass = discord_core_internal::https_workload_class::Put;
285 workload.relativePath =
"/applications/" + dataPackage.
applicationId +
"/guilds/" + dataPackage.
guildId +
"/commands";
286 workload.callStack =
"application_commands::bulkOverwriteGuildApplicationCommandsAsync()";
287 jsonifier::vector<application_command_data> returnData{};
288 application_commands::httpsClient->submitWorkloadAndGetResult(std::move(workload), returnData);
289 co_return returnData;
294 discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Get_Guild_Application_Commands_Permissions };
296 workload.workloadClass = discord_core_internal::https_workload_class::Get;
297 workload.relativePath =
"/applications/" + dataPackage.
applicationId +
"/guilds/" + dataPackage.
guildId +
"/commands/permissions";
298 workload.callStack =
"application_commands::getGuildApplicationCommandPermissionsAsync()";
299 jsonifier::vector<guild_application_command_permissions_data> returnData{};
300 application_commands::httpsClient->submitWorkloadAndGetResult(std::move(workload), returnData);
301 co_return returnData;
305 discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Get_Guild_Application_Command_Permissions };
309 bool isItFound =
false;
310 for (
auto& value: appCommands) {
312 commandId = value.
id;
317 co_return guild_application_command_permissions_data();
319 workload.workloadClass = discord_core_internal::https_workload_class::Get;
320 workload.relativePath =
"/applications/" + dataPackage.
applicationId +
"/guilds/" + dataPackage.
guildId +
"/commands/" + commandId +
"/permissions";
321 workload.callStack =
"application_commands::getApplicationCommandPermissionsAsync()";
322 guild_application_command_permissions_data returnData{};
323 application_commands::httpsClient->submitWorkloadAndGetResult(std::move(workload), returnData);
324 co_return returnData;
329 discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Put_Guild_Application_Command_Permissions };
333 bool isItFound =
false;
334 for (
auto& value: appCommands) {
336 commandId = value.
id;
341 co_return guild_application_command_permissions_data();
343 workload.workloadClass = discord_core_internal::https_workload_class::Put;
344 workload.relativePath =
"/applications/" + dataPackage.
applicationId +
"/guilds/" + dataPackage.
guildId +
"/commands/" + commandId +
"/permissions";
345 parser.serializeJson(dataPackage, workload.content);
346 workload.callStack =
"application_commands::editGuildApplicationCommandPermissionsAsync()";
347 guild_application_command_permissions_data returnData{};
348 application_commands::httpsClient->submitWorkloadAndGetResult(std::move(workload), returnData);
349 co_return returnData;
snowflake applicationId
The current application id.
snowflake guildId
(where applicable) a guild id for which guild to assign this application_command_data to.
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.
A co_routine - representing a potentially asynchronous operation/function.
For sending Https requests.
uint64_t id
The snowflake id.
DCA_INLINE auto newThreadAwaitable()
An awaitable that can be used to launch the co_routine onto a new thread - as well as return the hand...
The main namespace for the forward-facing interfaces.
For bulk-overwriting a collection of global application_commands.
snowflake applicationId
The current application's snowflake (the bot's user_data snowflake).
For bulk-overwriting a collection of guild application_commands.
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 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.
snowflake applicationId
The current application's snowflake (the bot's user_data snowflake).
jsonifier::string name
A name for the new command.
For editing 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 which you would like to add the new command to.
jsonifier::string name
A name for the new command.
For editing the permissions of a single guild application_command_data.
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.