DiscordCoreAPI
A Discord bot library written in C++, with custom asynchronous coroutines.
Loading...
Searching...
No Matches
FoundationEntities.hpp
Go to the documentation of this file.
1/*
2 DiscordCoreAPI, A bot library for Discord, written in C++, and featuring explicit multithreading through the usage of custom, asynchronous C++ CoRoutines.
3
4 Copyright 2021, 2022 Chris M. (RealTimeChris)
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
10
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public
17 License along with this library; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
19 USA
20*/
21/// FoundationEntities.hpp - Header for all of the Discord/Support API data
22/// structures. May 12, 2021 Chris M.
23/// https://discordcoreapi.com
24/// \file FoundationEntities.hpp
25
26#pragma once
27
28#ifndef FOUNDATION_ENTITIES
29 #define FOUNDATION_ENTITIES
30
33
34namespace DiscordCoreInternal {
35
36 struct DiscordCoreAPI_Dll VoiceConnectInitData {
37 DiscordCoreAPI::StreamType streamType{};
38 DiscordCoreAPI::StreamInfo streamInfo{};
39 Bool selfDeaf{ false };
40 Bool selfMute{ false };
41 Snowflake channelId{};
42 Int32 currentShard{};
43 Snowflake guildId{};
44 Snowflake userId{};
45 };
46
47 struct DiscordCoreAPI_Dll VoiceConnectionData {
48 String sessionId{};
49 String endPoint{};
50 String token{};
51 };
52
53 struct DiscordCoreAPI_Dll WebSocketResumeData {
54 Int32 lastNumberReceived{};
55 String sessionId{};
56 String botToken{};
57
58 operator DiscordCoreAPI::JsonObject();
59 };
60
61 struct DiscordCoreAPI_Dll WebSocketIdentifyData {
62 UpdatePresenceData presence{};
63 Int32 largeThreshold{ 250 };
64 Int32 numberOfShards{};
65 Int32 currentShard{};
66 String botToken{};
67 Int64 intents{};
68
69 operator DiscordCoreAPI::JsonObject();
70 };
71
72 struct DiscordCoreAPI_Dll VoiceSocketProtocolPayloadData {
73 String voiceEncryptionMode{};
74 String externalIp{};
75 Uint64 voicePort{};
76
77 operator DiscordCoreAPI::JsonObject();
78 };
79
80 struct DiscordCoreAPI_Dll VoiceIdentifyData {
81 VoiceConnectInitData connectInitData{};
82 VoiceConnectionData connectionData{};
83
84 operator DiscordCoreAPI::JsonObject();
85 };
86
87 enum class SendSpeakingType : Uint8 {
88 Microphone = 1 << 0,
89 Soundshare = 1 << 1,
90 Priority = 1 << 2,
91 Priority_And_Voice = Microphone | Priority,
92 };
93
94 struct DiscordCoreAPI_Dll SendSpeakingData {
95 SendSpeakingType type{};
96 Int32 delay{};
97 Int32 ssrc{};
98
99 operator DiscordCoreAPI::JsonObject();
100 };
101
102 enum class HttpsWorkloadClass : Uint8 { Get = 0, Put = 1, Post = 2, Patch = 3, Delete = 4 };
103
104 enum class PayloadType : Uint8 { Application_Json = 1, Multipart_Form = 2 };
105
106 enum class HttpsWorkloadType : Uint8 {
107 Unset = 0,
108 Get_Global_Application_Commands = 1,
109 Post_Global_Application_Command = 2,
110 Get_Global_Application_Command = 3,
111 Patch_Global_Application_Command = 4,
112 Delete_Global_Application_Command = 5,
113 Bulk_Put_Global_Application_Commands = 6,
114 Get_Guild_Application_Commands = 7,
115 Post_Guild_Application_Command = 8,
116 Get_Guild_Application_Command = 9,
117 Patch_Guild_Application_Command = 10,
118 Delete_Guild_Application_Command = 11,
119 Bulk_Put_Guild_Application_Commands = 12,
120 Get_Guild_Application_Commands_Permissions = 13,
121 Get_Guild_Application_Command_Permissions = 14,
122 Put_Guild_Application_Command_Permissions = 15,
123 Batch_Put_Guild_Application_Command_Permissions = 16,
124 Post_Interaction_Response = 17,
125 Get_Interaction_Response = 18,
126 Patch_Interaction_Response = 19,
127 Delete_Interaction_Response = 20,
128 Post_Followup_Message = 21,
129 Get_Followup_Message = 22,
130 Patch_Followup_Message = 23,
131 Delete_Followup_Message = 24,
132 Get_Guild_Audit_Logs = 25,
133 Get_Channel = 26,
134 Patch_Channel = 27,
135 Delete_Channel = 28,
136 Get_Messages = 29,
137 Get_Message = 30,
138 Post_Message = 31,
139 Crosspost_Message = 32,
140 Put_Reaction = 33,
141 Delete_Own_Reaction = 34,
142 Delete_User_Reaction = 35,
143 Get_Reactions = 36,
144 Delete_All_Reactions = 37,
145 Delete_Reactions_By_Emoji = 38,
146 Patch_Message = 39,
147 Delete_Message = 40,
148 Delete_Message_Old = 41,
149 Bulk_Delete_Messages = 42,
150 Put_Channel_Permission_Overwrites = 43,
151 Get_Channel_Invites = 44,
152 Post_Channel_Invite = 45,
153 Delete_Channel_Permission_Overwrites = 46,
154 Post_Follow_News_Channel = 47,
155 Post_Trigger_Typing_Indicator = 48,
156 Get_Pinned_Messages = 49,
157 Put_Pin_Message = 50,
158 Delete_Pin_Message = 51,
159 Put_Recipient_To_Group_Dm = 52,
160 Delete_Recipient_From_Group_Dm = 53,
161 Post_Thread_With_Message = 54,
162 Post_Thread_Without_Message = 55,
163 Put_Self_In_Thread = 56,
164 Put_Thread_Member = 57,
165 Delete_Self_From_Thread = 58,
166 Delete_Thread_Member = 59,
167 Get_Thread_Member = 60,
168 Get_Thread_Members = 61,
169 Get_Active_Threads = 62,
170 Get_Public_Archived_Threads = 63,
171 Get_Private_Archived_Threads = 64,
172 Get_Joined_Private_Archived_Threads = 65,
173 Get_Emoji_List = 66,
174 Get_Guild_Emoji = 67,
175 Post_Guild_Emoji = 68,
176 Patch_Guild_Emoji = 69,
177 Delete_Guild_Emoji = 70,
178 Post_Guild = 71,
179 Get_Guild = 72,
180 Get_Guild_Preview = 73,
181 Patch_Guild = 74,
182 Delete_Guild = 75,
183 Get_Guild_Channels = 76,
184 Post_Guild_Channel = 77,
185 Patch_Guild_Channel_Positions = 78,
186 Get_Guild_Active_Threads = 79,
187 Get_Guild_Member = 80,
188 Get_Guild_Members = 81,
189 Get_Search_Guild_Members = 82,
190 Put_Guild_Member = 83,
191 Patch_Guild_Member = 84,
192 Patch_Current_Guild_Member = 85,
193 Put_Guild_Member_Role = 86,
194 Delete_Guild_Member_Role = 87,
195 Delete_Guild_Member = 88,
196 Get_Guild_Bans = 89,
197 Get_Guild_Ban = 90,
198 Put_Guild_Ban = 91,
199 Delete_Guild_Ban = 92,
200 Get_Guild_Roles = 93,
201 Post_Guild_Role = 94,
202 Patch_Guild_Role_Positions = 95,
203 Patch_Guild_Role = 96,
204 Delete_Guild_Role = 97,
205 Get_Guild_Prune_Count = 98,
206 Post_Guild_Prune = 99,
207 Get_Guild_Voice_Regions = 100,
208 Get_Guild_Invites = 101,
209 Get_Guild_Integrations = 102,
210 Delete_Guild_Integration = 103,
211 Get_Guild_Widget_Settings = 104,
212 Patch_Guild_Widget = 105,
213 Get_Guild_Widget = 106,
214 Get_Vanity_Invite = 107,
215 Get_Guild_Widget_Image = 108,
216 Get_Guild_Welcome_Screen = 109,
217 Patch_Guild_Welcome_Screen = 110,
218 Patch_Current_User_Voice_State = 111,
219 Patch_User_Voice_State = 112,
220 Get_Guild_Scheduled_Events = 113,
221 Post_Guild_Scheduled_Event = 114,
222 Get_Guild_Scheduled_Event = 115,
223 Patch_Guild_Scheduled_Event = 116,
224 Delete_Guild_Scheduled_Event = 117,
225 Get_Guild_Scheduled_Event_Users = 118,
226 Get_Guild_Template = 119,
227 Post_Guild_From_Guild_Template = 120,
228 Get_Guild_Templates = 121,
229 Post_Guild_Template = 122,
230 Put_Guild_Template = 123,
231 Patch_Guild_Template = 124,
232 Delete_Guild_Template = 125,
233 Get_Invite = 126,
234 Delete_Invite = 127,
235 Post_Stage_Instance = 128,
236 Get_Stage_Instance = 129,
237 Patch_Stage_Instance = 130,
238 Delete_Stage_Instance = 131,
239 Get_Sticker = 132,
240 Get_Nitro_Sticker_Packs = 133,
241 Get_Guild_Stickers = 134,
242 Post_Guild_Sticker = 135,
243 Patch_Guild_Sticker = 136,
244 Delete_Guild_Sticker = 137,
245 Get_Current_User = 138,
246 Get_User = 139,
247 Patch_Current_User = 140,
248 Get_Current_User_Guilds = 141,
249 Delete_Leave_Guild = 142,
250 Post_Create_User_Dm = 143,
251 Get_User_Connections = 144,
252 Get_Voice_Regions = 145,
253 Post_Webhook = 146,
254 Get_Channel_Webhooks = 147,
255 Get_Guild_Webhooks = 148,
256 Get_Webhook = 149,
257 Get_Webhook_With_Token = 150,
258 Patch_Webhook = 151,
259 Patch_Webhook_With_Token = 152,
260 Delete_Webhook = 153,
261 Delete_Webhook_With_Token = 154,
262 Post_Execute_Webhook = 155,
263 Get_Webhook_Message = 156,
264 Patch_Webhook_Message = 157,
265 Delete_Webhook_Message = 158,
266 Get_Application_Info = 159,
267 Get_Authorization_Info = 160,
268 Get_Gateway_Bot = 161,
269 Post_Thread_In_Forum_Channel = 162,
270 Get_Auto_Moderation_Rules = 163,
271 Get_Auto_Moderation_Rule = 164,
272 Post_Auto_Moderation_Rule = 165,
273 Patch_Auto_Moderation_Rule = 166,
274 Delete_Auto_Moderation_Rule = 167,
275 YouTubeGetSearchResults = 168,
276 SoundCloudGetSearchResults = 169,
277 LAST = 170
278 };
279
280 class DiscordCoreAPI_Dll HttpsWorkloadData {
281 public:
282 friend class HttpsClient;
283
284 static std::unordered_map<HttpsWorkloadType, std::unique_ptr<AtomicInt64>> workloadIdsExternal;
285 static std::unordered_map<HttpsWorkloadType, std::unique_ptr<AtomicInt64>> workloadIdsInternal;
286
287 mutable std::unordered_map<String, String> headersToInsert{};
288 PayloadType payloadType{ PayloadType::Application_Json };
289 mutable AtomicInt64 thisWorkerId{ 0 };
290 HttpsWorkloadClass workloadClass{};
291 mutable String baseUrl{};
292 String relativePath{};
293 String callStack{};
294 String content{};
295
296 HttpsWorkloadData& operator=(const HttpsWorkloadData& other) noexcept;
297
298 HttpsWorkloadData(const HttpsWorkloadData& other) noexcept;
299
300 HttpsWorkloadData(DiscordCoreInternal::HttpsWorkloadType theType) noexcept;
301
302 protected:
303 static Int64 incrementAndGetWorkloadId(HttpsWorkloadType workloadType) noexcept;
304
305 HttpsWorkloadType workloadType{};
306 };
307
308 struct DiscordCoreAPI_Dll HelloData {
309 HelloData(simdjson::ondemand::value);
310 Int32 heartbeatInterval{};
311 };
312
313 struct DiscordCoreAPI_Dll WebSocketMessage {
314 WebSocketMessage() noexcept = default;
315 WebSocketMessage(simdjson::ondemand::value);
316 Uint64 op{ static_cast<Uint64>(-1) };
317 template<typename ReturnType> ReturnType processJsonMessage() {
318 return ReturnType{ this->d };
319 }
320 simdjson::ondemand::value d{};
321 String t{};
322 Uint64 s{};
323 };
324
325 struct DiscordCoreAPI_Dll InvalidSessionData {
326 InvalidSessionData(simdjson::ondemand::value);
327 Bool d{};
328 };
329}
330
331/// The main namespace for this library. \brief The main namespace for this
332/// library.
333namespace DiscordCoreAPI {
334
335 /**
336 * \addtogroup foundation_entities
337 * @{
338 */
339
340 class DiscordCoreAPI_Dll NewBase {};
341
342 struct DiscordCoreAPI_Dll ConnectionPackage {
343 Int32 currentReconnectTries{ 0 };
344 Bool areWeResuming{ false };
345 Uint32 currentShard{ 0 };
346 };
347
348 /// Timeout durations for the timeout command. \brief Timeout durations for the timeout command.
349 enum class TimeoutDurations : Int16 {
350 None = 0,///< None - remove timeout.
351 Minute = 1,///< 1 Minute timeout.
352 Five_Minutes = 5,///< 5 Minute timeout.
353 Ten_Minutes = 10,///< 10 Minute timeout.
354 Hour = 60,///< 1 Hour timeout.
355 Day = 1440,///< 1 Day timeout.
356 Week = 10080///< 1 Week timeout.
357 };
358
359 /// Base class for all Discord entities. \brief Base class for all Discord entities.
360 class DiscordCoreAPI_Dll DiscordEntity {
361 public:
362 Snowflake id{};///< The identifier "snowflake" of the given entity.
363 /// Converts the snowflake-id into a time and date stamp. \brief Converts the
364 /// snowflake-id into a time and date stamp. \returns String A
365 /// String containing the timestamp.
366 String getCreatedAtTimestamp(TimeFormat timeFormat);
367
368 virtual ~DiscordEntity() noexcept = default;
369 };
370
371 /// Role tags data. \brief Role tags data.
372 struct DiscordCoreAPI_Dll RoleTagsData {
373 String premiumSubscriber{};///< Are they a premium subscriber?
374 String integrationId{};///< What is the integration id?
375 String botId{};///< What is the bot id?
376
377 RoleTagsData() noexcept = default;
378
379 RoleTagsData(simdjson::ondemand::value);
380
381 virtual ~RoleTagsData() noexcept = default;
382 };
383
384 /// User flags. \brief User flags.
385 enum class UserFlags : Int32 {
386 Staff = 1 << 0,///< Discord Employee.
387 Partner = 1 << 1,///< Partnered Server Owner.
388 Hypesquad = 1 << 2,///< HypeSquad Events Member.
389 Bug_Hunter_Level_1 = 1 << 3,///< Bug Hunter Level 1.
390 Hypesquad_Online_House_1 = 1 << 6,///< House Bravery Member.
391 Hypesquad_Online_House_2 = 1 << 7,///< House Brilliance Member.
392 Hypesquad_Online_House_3 = 1 << 8,///< House Balance Member.
393 Premium_Early_Suppoerter = 1 << 9,///< Early Nitro Supporter.
394 Team_Pseudo_User = 1 << 10,///< User is a team.
395 Bug_Hunter_Level_2 = 1 << 14,///< Bug Hunter Level 2.
396 Verified_Bot = 1 << 16,///< Verified Bot.
397 Verified_Developer = 1 << 17,///< Early Verified Bot Developer.
398 Certified_Moderator = 1 << 18,///< Discord Certified Moderator.
399 Bot_Http_Interactions = 1 << 19,///< Bot uses only HTTP interactions and is shown in the online member list.
400 Bot = 1 << 20,///< Is it a bot?
401 MFAEnabled = 1 << 21,///< Is MFA enabled?
402 System = 1 << 22,///< Is it a system integration?
403 Verified = 1 << 23///< Is it verified?
404 };
405
406 /// Premium types denote the level of premium a user has. \brief Premium types denote the level of premium a user has.
407 enum class PremiumType : Uint8 {
408 None = 0,///< None.
409 Nitro_Classic = 1,///< Nitro classic.
410 Nitro = 2///< Nitro.
411 };
412
413 /// Data structure representing a single User. \brief Data structure representing a single User.
414 class DiscordCoreAPI_Dll UserData : public DiscordEntity {
415 public:
416 friend class GuildData;
417
418 StringWrapper discriminator{};///< The user's 4-digit discord-tag identify.
419 StringWrapper userName{};///< The user's userName, not unique across the platform identify.
420 IconHash avatar{};///< The user's avatar hash.
421 Int32 flags{};///< The public flags on a user' s account.
422
423 UserData() noexcept = default;
424
425 UserData& operator=(UserData&&) noexcept = default;
426
427 UserData(UserData&&) noexcept = default;
428
429 UserData& operator=(const UserData&) noexcept = default;
430
431 UserData(const UserData&) noexcept = default;
432
433 UserData(simdjson::ondemand::value jsonObjectData);
434
435 String getAvatarUrl();
436
437 virtual ~UserData() noexcept = default;
438 };
439
440 /// Attachment data. \brief Attachment data.
441 class DiscordCoreAPI_Dll AttachmentData : public DiscordEntity {
442 public:
443 String contentType{};///< Type of content for the attachment.
444 String description{};///< A description of the attachment.
445 Bool ephemeral{ false };///< Whether it was an ephemeral response.
446 String filename{};///< The file name of the attachment.
447 String proxyUrl{};///< The proxy url for the attachment.
448 Int32 height{ 0 };///< The height of the attachment.
449 Int32 width{ 0 };///< The width of the attachment.
450 Int32 size{ 0 };///< The size of the attachment.
451 String url{};///< The url for the attachment.
452
453 operator JsonObject();
454
455 AttachmentData() noexcept = default;
456
457 AttachmentData(simdjson::ondemand::value);
458
459 virtual ~AttachmentData() noexcept = default;
460 };
461
462 /// Sticker format types. \brief Sticker format types.
463 enum class StickerFormatType : Uint8 {
464 Png = 1,///< Png.
465 Apng = 2,///< Apng.
466 Lottie = 3///< Lottie
467 };
468
469 /// Embed footer data. \brief Embed footer data.
470 struct DiscordCoreAPI_Dll EmbedFooterData {
471 String proxyIconUrl{};///< Proxy icon url.
472 String iconUrl{};///< Icon url.
473 String text{};///< Footer text.
474
475 EmbedFooterData() noexcept = default;
476
477 EmbedFooterData(simdjson::ondemand::value jsonObjectData);
478
479 virtual ~EmbedFooterData() noexcept = default;
480 };
481
482 /// Embed image data. \brief Embed image data.
483 struct DiscordCoreAPI_Dll EmbedImageData {
484 String proxyUrl{};///< Proxy url.
485 Int32 height{ 0 };///< Image height.
486 Int32 width{ 0 };///< Image width.
487 String url{};///< Image url.
488
489 EmbedImageData() noexcept = default;
490
491 EmbedImageData(simdjson::ondemand::value jsonObjectData);
492
493 virtual ~EmbedImageData() noexcept = default;
494 };
495
496 /// Embed thumbnail data. \brief Embed thumbnail data.
497 struct DiscordCoreAPI_Dll EmbedThumbnailData {
498 String proxyUrl{};///< Proxy url.
499 Int32 height{ 0 };///< Image height.
500 Int32 width{ 0 };///< Image width.
501 String url{};///< Image url.
502
503 EmbedThumbnailData() noexcept = default;
504
505 EmbedThumbnailData(simdjson::ondemand::value jsonObjectData);
506
507 virtual ~EmbedThumbnailData() noexcept = default;
508 };
509
510 /// Embed video data. \brief Embed video data.
511 struct DiscordCoreAPI_Dll EmbedVideoData {
512 String proxyUrl{};///< Proxy url.
513 Int32 height{ 0 };///< Image height.
514 Int32 width{ 0 };///< Image width.
515 String url{};///< Image url.
516
517 EmbedVideoData() noexcept = default;
518
519 EmbedVideoData(simdjson::ondemand::value jsonObjectData);
520
521 virtual ~EmbedVideoData() noexcept = default;
522 };
523
524 /// Embed provider data. \brief Embed provider data.
525 struct DiscordCoreAPI_Dll EmbedProviderData {
526 String name{};///< Name.
527 String url{};///< Url.
528
529 EmbedProviderData() noexcept = default;
530
531 EmbedProviderData(simdjson::ondemand::value jsonObjectData);
532
533 virtual ~EmbedProviderData() noexcept = default;
534 };
535
536 /// Embed author data. \brief Embed author data.
537 struct DiscordCoreAPI_Dll EmbedAuthorData {
538 String proxyIconUrl{};///< Proxy icon url.
539 String iconUrl{};///< Icon url.
540 String name{};///< Name.
541 String url{};///< Url.
542
543 EmbedAuthorData() noexcept = default;
544
545 EmbedAuthorData(simdjson::ondemand::value jsonObjectData);
546
547 virtual ~EmbedAuthorData() noexcept = default;
548 };
549
550 /// Embed field data. \brief Embed field data.
551 struct DiscordCoreAPI_Dll EmbedFieldData {
552 Bool Inline{ false };///< Is the field inline with the rest of them?
553 String value{};///< The text on the field.
554 String name{};///< The title of the field.
555
556 EmbedFieldData() noexcept = default;
557
558 EmbedFieldData(simdjson::ondemand::value jsonObjectData);
559
560 operator JsonObject();
561
562 virtual ~EmbedFieldData() noexcept = default;
563 };
564
565 /// Embed types. \brief Embed types.
566 enum class EmbedType : Uint8 {
567 Rich = 0,///< Rich.
568 Image = 1,///< Image.
569 Video = 2,///< Video.
570 Gifv = 3,///< Gifv.
571 Article = 4,///< Article.
572 link = 5///< Link.
573 };
574
575 /// Embed data. \brief Embed data.
576 class DiscordCoreAPI_Dll EmbedData {
577 public:
578 std::vector<EmbedFieldData> fields{};///< Array of embed fields.
579 EmbedThumbnailData thumbnail{};///< Embed thumbnail data.
580 ColorValue hexColorValue{ 0 };///< Hex color value of the embed.
581 EmbedProviderData provider{};///< Embed provider data.
582 String description{};///< Description of the embed.
583 EmbedFooterData footer{};///< Embed footer data.
584 EmbedAuthorData author{};///< Embed author data.
585 String timestamp{};///< Timestamp to be placed on the embed.
586 EmbedImageData image{};///< Embed image data.
587 EmbedVideoData video{};///< Embed video data.
588 String title{};///< Title of the embed.
589 String type{};///< Type of the embed.
590 String url{};///< Url for the embed.
591
592 EmbedData() noexcept = default;
593
594 operator JsonObject();
595
596 /// Sets the author's name and avatar for the embed. \brief Sets the author's name and avatar for the embed.
597 /// \param authorName The author's name.
598 /// \param authorAvatarUrl The url to their avatar.
599 /// \returns EmbedData& A reference to this embed.
600 EmbedData& setAuthor(const String& authorName, const String& authorAvatarUrl = "");
601
602 /// Sets the footer's values for the embed. \brief Sets the footer's values for the embed.
603 /// \param footerText The footer's text.
604 /// \param footerIconUrlText Url to the footer's icon.
605 /// \returns EmbedData& A reference to this embed.
606 EmbedData& setFooter(const String& footerText, const String& footerIconUrlText = "");
607
608 /// Sets the timestamp on the embed. \brief Sets the timestamp on the embed.
609 /// \param timeStamp The timestamp to be set.
610 /// \returns EmbedData& A reference to this embed.
611 EmbedData& setTimeStamp(const String& timeStamp);
612
613 /// Adds a field to the embed. \brief Adds a field to the embed.
614 /// \param name The title of the embed field.
615 /// \param value The contents of the embed field.
616 /// \param Inline Is it inline with the rest of the fields on the embed?
617 /// \returns EmbedData& A reference to this embed.
618 EmbedData& addField(const String& name, const String& value, Bool Inline = true);
619
620 /// Sets the description (the main contents) of the embed. \brief Sets the description (the main contents) of the embed.
621 /// \param descriptionNew The contents of the description to set.
622 /// \returns EmbedData& A reference to this embed.
623 EmbedData& setDescription(const String& descriptionNew);
624
625 /// Sets the color of the embed, by applying a hex-color value. \brief Sets the color of the embed, by applying a hex-color value.
626 /// \param hexColorValueNew A string containing a hex-number value (Between 0x00 0xFFFFFF).
627 /// \returns EmbedData& A reference to this embed.
628 EmbedData& setColor(const String& hexColorValueNew);
629
630 /// Sets the thumbnail of the embed. \brief Sets the thumbnail of the embed.
631 /// \param thumbnailUrl The url to the thumbnail to be used.
632 /// \returns EmbedData& A reference to this embed.
633 EmbedData& setThumbnail(const String& thumbnailUrl);
634
635 /// Sets the title of the embed. \brief Sets the title of the embed.
636 /// \param titleNew A string containing the desired title.
637 /// \returns EmbedData& A reference to this embed.
638 EmbedData& setTitle(const String& titleNew);
639
640 /// Sets the image of the embed. \brief Sets the image of the embed.
641 /// \param imageUrl The url of the image to be set on the embed.
642 /// \returns EmbedData& A reference to this embed.
643 EmbedData& setImage(const String& imageUrl);
644
645 EmbedData(simdjson::ondemand::value jsonObjectData);
646
647 virtual ~EmbedData() noexcept = default;
648 };
649
650 /// Message reference data.\brief Message reference data.
651 struct DiscordCoreAPI_Dll MessageReferenceData {
652 Bool failIfNotExists{ false };///< Fail if the Message doesn't exist?
653 Snowflake messageId{};///< Id of the Message to reference.
654 Snowflake channelId{};///< Id of the Channel that the referenced Message was sent in.
655 Snowflake guildId{};///< Id of the Guild that the referenced Message was sent in.
656
657 MessageReferenceData() noexcept = default;
658
659 MessageReferenceData(simdjson::ondemand::value jsonObjectData);
660
661 operator JsonObject();
662
663 virtual ~MessageReferenceData() noexcept = default;
664 };
665
666 enum class MediaType : Uint8 { png = 0, gif = 1, jpeg = 2, mpeg = 3, mp3 = 4 };
667
668 /// Data representing a file to be sent via multipart-form data. \brief Data representing a file to be sent via multipart-form data.
669 struct DiscordCoreAPI_Dll File {
670 String fileName{};///< The name of the file.
671 String data{};///< The data of the file.
672 };
673
674 /// Channel types. \brief Channel types.
675 enum class ChannelType : Uint8 {
676 Guild_Text = 0,///< Guild text.
677 Dm = 1,///< Direct-Message.
678 Guild_Voice = 2,/// Guild voice.
679 Group_Dm = 3,///< Group direct-Message.
680 Guild_Category = 4,///< Guild category.
681 Guild_News = 5,///< Guild news.
682 Guild_Store = 6,///< Guild store.
683 Guild_News_Thread = 10,///< Guild news Thread.
684 Guild_Public_Thread = 11,///< Guild public Thread.
685 Guild_Private_Thread = 12,///< Guild private Thread.
686 Guild_Stage_Voice = 13,///< Guild stage-voice.
687 Guild_Directory = 14,///< The channel in a hub containing the listed servers.
688 Guild_Forum = 15///< A channel that can only contain threads.
689 };
690
691 /// Meta data for a Thread type of Channel. \brief Meta data for a Thread type of Channel.
692 struct DiscordCoreAPI_Dll ThreadMetadataData {
693 TimeStamp<std::chrono::milliseconds> archiveTimestamp{};///< (Where applicable) the time at which this Thread was archived.
694 Int32 autoArchiveDuration{ 0 };///< How Int64 before archiving this Thread.
695 Bool invitable{ false };///< The id of the individual who archived this Thread.
696 Bool archived{ false };///< Whether or not this Thread is currently archived.
697 Bool locked{ false };///< Whether or not this Thread is currently locked.
698
699 ThreadMetadataData() noexcept = default;
700
701 ThreadMetadataData(simdjson::ondemand::value);
702
703 virtual ~ThreadMetadataData() noexcept = default;
704 };
705
706 /// Data for a single member of a Thread. \brief Data for a single member of a Thread.
707 class DiscordCoreAPI_Dll ThreadMemberData : public DiscordEntity {
708 public:
709 TimeStamp<std::chrono::milliseconds> joinTimestamp{};///< The time at which the member joined this Thread.
710 Int32 flags{ 0 };///< Flags.
711 Snowflake userId{};///< The User's id.
712
713 ThreadMemberData() noexcept = default;
714
715 ThreadMemberData(simdjson::ondemand::value);
716
717 virtual ~ThreadMemberData() noexcept = default;
718 };
719
720 class DiscordCoreAPI_Dll ThreadMemberDataVector {
721 public:
722 ThreadMemberDataVector() noexcept = default;
723
724 operator std::vector<ThreadMemberData>();
725
726 ThreadMemberDataVector(simdjson::ondemand::value);
727
728 virtual ~ThreadMemberDataVector() noexcept = default;
729
730 protected:
731 std::vector<ThreadMemberData> theThreadMemberDatas{};
732 };
733
734 /// Thread types. \brief Thread types.
735 enum class ThreadType : Uint8 {
736 Guild_News_Thread = 10,///< Guild news Thread.
737 Guild_Public_Thread = 11,///< Guild public Thread.
738 Guild_Private_Thread = 12///< Guild private Thread.
739 };
740
741 /// Voice state data. \brief Voice state data.
742 struct DiscordCoreAPI_Dll VoiceStateData {
743 TimeStamp<std::chrono::milliseconds> requestToSpeakTimestamp{ "" };///< The time at which the User requested to speak.
744 String sessionId{};///< The session id for this voice state.
745 Bool selfStream{ false };///< Whether this User is streaming using "Go Live".
746 Bool selfVideo{ false };///< Whether this User's camera is enabled.
747 Bool selfDeaf{ false };///< Whether this User is locally deafened.
748 Bool selfMute{ false };///< Whether this User is locally muted.
749 Bool suppress{ false };///< Whether this User is muted by the current User.
750 Snowflake channelId{};///< The Channel id this User is connected to.
751 Bool deaf{ false };///< Whether this User is deafened by the server.
752 Bool mute{ false };///< Whether this User is muted by the server.
753 Snowflake guildId{};///< The Guild id this voice state is for.
754 Snowflake userId{};///< The User id this voice state is for.
755
756 VoiceStateData() noexcept = default;
757
758 VoiceStateData(simdjson::ondemand::value jsonObjectData);
759
760 virtual ~VoiceStateData() noexcept = default;
761 };
762
763 /// Automatic Thread archiving durations. \brief Automatic Thread archiving durations.
764 enum class ThreadAutoArchiveDuration : Int16 {
765 Shortest = 60,///< Shortest.
766 Short = 1440,///< Short.
767 Long = 4320,///< Long.
768 Longest = 10080///< Longest.
769 };
770
771 /// Party data. \brief Party data.
772 class DiscordCoreAPI_Dll PartyData : public DiscordEntity {
773 public:
774 std::vector<Int32> size{ 0, 0 };///< The size of the party.
775
776 PartyData() noexcept = default;
777
778 PartyData(simdjson::ondemand::value jsonObjectData);
779
780 virtual ~PartyData() noexcept = default;
781 };
782
783 enum class RoleFlags : Uint8 { Mentionable = 1 << 0, Managed = 1 << 1, Hoist = 1 << 2 };
784
785 /// Data structure representing a single Role. \brief Data structure representing a single Role.
786 class DiscordCoreAPI_Dll RoleData : public DiscordEntity {
787 public:
788 friend class GuildData;
789
790 StringWrapper unicodeEmoji{};///< Emoji representing the Role.
791 Permissions permissions{};///< The Role's base Guild Permissions.
792 Int16 position{ 0 };///< Its position amongst the rest of the Guild's roles.
793 ColorValue color{ 0 };///< The Role's color.
794 StringWrapper name{};///< The Role's name.
795 Snowflake guildId{};///< The id of the Guild that this Role is from.
796 Int8 flags{ 0 };///< Role flags.
797
798 RoleData() noexcept = default;
799
800 RoleData& operator=(RoleData&&) noexcept = default;
801
802 RoleData(RoleData&&) noexcept = default;
803
804 RoleData& operator=(const RoleData&) noexcept = default;
805
806 RoleData(const RoleData&) noexcept = default;
807
808 RoleData(simdjson::ondemand::value jsonObjectData);
809
810 virtual ~RoleData() noexcept = default;
811 };
812
813 /// Data structure representing a single emoji. \brief Data structure representing a single emoji.
814 class DiscordCoreAPI_Dll EmojiData : public DiscordEntity {
815 public:
816 std::wstring unicodeName{ L"" };///< What is its unicode name?
817 std::vector<RoleData> roles{};///< Roles that are allowed to use this emoji.
818 Bool requireColons{ false };///< Require colons to render it?
819 Bool available{ true };///< Is it available to be used?
820 Bool animated{ false };///< Is it animated?
821 Bool managed{ false };///< Is it managed?
822 StringWrapper name{};///< What is its name?
823 UserData user{};///< User that created this emoji.
824
825 EmojiData() noexcept = default;
826
827 EmojiData(simdjson::ondemand::value jsonObjectData);
828
829 virtual ~EmojiData() noexcept = default;
830 };
831
832 /// Assets data. \brief Party data.
833 struct DiscordCoreAPI_Dll AssetsData {
834 StringWrapper largeImage{};///< Keyname of an asset to display.
835 StringWrapper smallImage{};///< Keyname of an asset to display.
836 StringWrapper largeText{};///< Hover text for the large image.
837 StringWrapper smallText{};///< Hover text for the small image.
838
839 AssetsData() noexcept = default;
840
841 virtual ~AssetsData() noexcept = default;
842 };
843
844 /// Secrets data. \brief Secrets data.
845 struct DiscordCoreAPI_Dll SecretsData {
846 StringWrapper spectate{};///< Unique hash for the given match context.
847 StringWrapper match{};///< Unique hash for Spectate button.
848 StringWrapper join{};///< Unique hash for chat invitesand Ask to Join.
849
850 SecretsData() noexcept = default;
851
852 virtual ~SecretsData() noexcept = default;
853 };
854
855 /// Timestamp data. \brief Timestamp data.
856 struct DiscordCoreAPI_Dll TimestampData {
857 Int64 start{ 0 };///< Unix timestamp - Send this to have an "elapsed" timer.
858 Int64 end{ 0 };///< Unix timestamp - send this to have a "remaining" timer.
859
860 TimestampData() noexcept = default;
861
862 virtual ~TimestampData() noexcept = default;
863 };
864
865 /// Button data. \brief Button data.
866 struct DiscordCoreAPI_Dll ButtonData {
867 StringWrapper label{};///< Visible label of the button.
868 StringWrapper url{};///< Url to display on the button.
869 };
870
871 /// Activity types. \brief Activity types.
872 enum class ActivityType : Uint8 {
873 Game = 0,///< Game.
874 Streaming = 1,///< Streaming.
875 Listening = 2,///< Listening.
876 Watching = 3,///< Watching.
877 Custom = 4,///< Custom.
878 Competing = 5///< Competing.
879 };
880
881 /// Activity data. \brief Activity data.
882 struct DiscordCoreAPI_Dll ActivityData {
883 TimestampData timestamps{};///< Timestamp data.
884 Snowflake applicationId{};///< Application id for the current application.
885 StringWrapper details{};///< Details about the activity.
886 Int32 createdAt{ 0 };///< Timestamp of when the activity began.
887 Bool instance{ false };///< Whether this activity is an instanced context, like a match.
888 StringWrapper state{};///< The player's current party status.
889 SecretsData secrets{};///< Secrets data.
890 ButtonData buttons{};///< Button Data.
891 StringWrapper name{};///< Name of the activity.
892 ActivityType type{};///< Activity data.
893 AssetsData assets{};///< Assets data.
894 StringWrapper url{};///< Url associated with the activity.
895 Int32 flags{ 0 };///< Flags.
896 EmojiData emoji{};///< Emoji associated with the activity.
897 PartyData party{};///< Party data.
898
899 ActivityData() noexcept = default;
900
901 virtual ~ActivityData() noexcept = default;
902 };
903
904 enum class PresenceUpdateFlags : Uint8 {
905 Desktop_Online = 0b00000001,
906 Desktop_Idle = 0b00000010,
907 Desktop_Dnd = 0b000000011,
908 Mobile_Online = 0b00000010,
909 Mobile_Idle = 0b00000100,
910 Mobile_Dnd = 0b00000110,
911 Web_Online = 0b00000100,
912 Web_Idle = 0b00001000,
913 Web_Dnd = 0b00001100,
914 Status_Online = 0b00001000,
915 Status_Idle = 0b00010000,
916 Status_Dnd = 0b00011000
917 };
918
919 void parseObject(simdjson::ondemand::value jsonObjectData, PresenceUpdateFlags& theData);
920
921 /// Presence update data. \brief Presence update data.
922 struct DiscordCoreAPI_Dll PresenceUpdateData {
923 Uint8 theStatus{};///< Current client status.
924 Snowflake guildId{};///< Guild id for the current presence.
925 Snowflake userId{};///< User id for the current presence.
926
927 PresenceUpdateData() noexcept = default;
928
929 PresenceUpdateData(simdjson::ondemand::value jsonObjectData);
930
931 virtual ~PresenceUpdateData() noexcept = default;
932 };
933
934 enum class GuildMemberFlags : Uint8 { Pending = 1 << 0, Deaf = 1 << 1, Mute = 1 << 2 };
935
936 /// Data structure representing a single GuildMember. \brief Data structure representing a single GuildMember.
937 /// Data structure representing a single Guild. \brief Data structure representing a single Guild.
938 class DiscordCoreAPI_Dll GuildMemberData : public DiscordEntity {
939 public:
940 friend class GuildData;
941 TimeStamp<std::chrono::milliseconds> joinedAt{};///< When they joined the Guild.
942 std::vector<Snowflake> roles{};///< The Guild roles that they have.
943 Snowflake voiceChannelId{};///< Currently held voice channel, if applicable.
944 Permissions permissions{};///< Their base-level Permissions in the Guild
945 Snowflake guildId{};///< The current Guild's id.
946 StringWrapper nick{};///< Their nick/display name.
947 IconHash avatar{};///< This GuildMember's Guild Avatar.
948 Int8 flags{ 0 };///< GuildMember flags.
949
950 GuildMemberData() noexcept = default;
951
952 GuildMemberData& operator=(GuildMemberData&&) noexcept;
953
955
956 GuildMemberData& operator=(const GuildMemberData&) noexcept = default;
957
958 GuildMemberData(const GuildMemberData&) noexcept = default;
959
960 GuildMemberData(simdjson::ondemand::value);
961
962 String getAvatarUrl();
963
964 UserData getUserData();
965
966 virtual ~GuildMemberData() noexcept = default;
967 };
968
969 /// PermissionTypes overwrites types. \brief PermissionTypes overwrites types.
970 enum class PermissionOverwritesType : Uint8 {
971 Role = 0,///< Role.
972 User = 1///< User.
973 };
974
975 /// A PermissionTypes overwrite, for a given Channel. \brief A PermissionTypes overwrite, for a given Channel.
976 class DiscordCoreAPI_Dll OverWriteData : public DiscordEntity {
977 public:
978 PermissionOverwritesType type{};///< Role or User type.
979 Uint64 allow{};///< Collection of Permissions to allow.
980 Uint64 deny{};///< Collection of Permissions to deny.
981
982 OverWriteData() noexcept = default;
983
984 OverWriteData(simdjson::ondemand::value jsonObjectData);
985
986 virtual ~OverWriteData() noexcept = default;
987 };
988
989 enum class ChannelFlags : Uint8 { NSFW = 1 << 0 };
990
991 /// Data structure representing a single Channel. \brief Data structure representing a single Channel.
992 class DiscordCoreAPI_Dll ChannelData : public DiscordEntity {
993 public:
994 friend class GuildData;
995
996 std::vector<OverWriteData> permissionOverwrites{};
997 ChannelType type{ ChannelType::Dm };///< The type of the Channel.
998 Int32 memberCount{ 0 };///< Count of members active in the Channel.
999 Uint16 position{ 0 };///< The position of the Channel, in the Guild's Channel list.
1000 Snowflake parentId{};///< Id of the Channel's parent Channel/category.
1001 StringWrapper topic{};///< Channel topic.
1002 Snowflake ownerId{};///< Id of the Channel's owner.
1003 Snowflake guildId{};///< Id of the Channel's Guild, if applicable.
1004 StringWrapper name{};///< Name of the Channel.
1005 Uint8 flags{};///< Flags combined as a bitmask.
1006
1007 ChannelData() noexcept = default;
1008
1009 ChannelData& operator=(ChannelData&&) noexcept = default;
1010
1011 ChannelData(ChannelData&&) noexcept = default;
1012
1013 ChannelData& operator=(const ChannelData&) noexcept = default;
1014
1015 ChannelData(const ChannelData&) noexcept = default;
1016
1017 ChannelData(simdjson::ondemand::value);
1018
1019 virtual ~ChannelData() noexcept = default;
1020 };
1021
1022 /// Data representing an active Thread. \brief Data representing an active Thread.
1023 struct DiscordCoreAPI_Dll ActiveThreadsData {
1024 std::vector<ThreadMemberData> members{};
1025 std::vector<ChannelData> threads{};
1026 Bool hasMore{ false };
1027
1028 ActiveThreadsData() noexcept = default;
1029
1030 ActiveThreadsData(simdjson::ondemand::value jsonObjectData);
1031
1032 virtual ~ActiveThreadsData() noexcept = default;
1033 };
1034
1035 /// Data representing an archived Thread. \brief Data representing an archived Thread.
1036 struct DiscordCoreAPI_Dll ArchivedThreadsData {
1037 std::vector<ThreadMemberData> members{};
1038 std::vector<ChannelData> threads{};
1039 Bool hasMore{ false };
1040
1041 ArchivedThreadsData() noexcept = default;
1042
1043 ArchivedThreadsData(simdjson::ondemand::value jsonObjectData);
1044
1045 virtual ~ArchivedThreadsData() noexcept = default;
1046 };
1047
1048 /// Application command-option types. \brief Application command-option types.
1049 enum class ApplicationCommandOptionType : Uint8 {
1050 Sub_Command = 1,///< Sub-command.
1051 Sub_Command_Group = 2,///< Sub-command group.
1052 String = 3,///< String.
1053 Integer = 4,///< Integer.
1054 Boolean = 5,///< Boolean.
1055 User = 6,///< User.
1056 Channel = 7,///< Channel.
1057 Role = 8,///< Role.
1058 Mentionable = 9,///< Mentionable.
1059 Number = 10,///< Number.
1060 Attachment = 11///< Attachment.
1061 };
1062
1063 /// Application command permission-types. \brief Application command permission-types.
1065 Role = 1,///< Role.
1066 User = 2,///< User.
1067 Channel = 3///< Channel.
1068 };
1069
1070 /// Event types for auto-moderation. \brief Event types for auto-moderation.
1071 enum class EventType : Uint8 {
1072 Message_Send = 1,///< When a member sends or edits a message in the guild.
1073 };
1074
1075 /// Trigger types for auto-moderation. \brief Trigger types for auto-moderation.
1076 enum class TriggerType : Uint8 {
1077 Keyword = 1,///< Check if content contains words from a user defined list of keywords.
1078 Harmful_Link = 2,///< Check if content contains any harmful links.
1079 Spam = 3,///< Check if content represents generic spam.
1080 Keyword_Preset = 4///< Check if content contains words from internal pre-defined wordsets.
1081 };
1082
1083 /// Keyword preset types for auto-moderation. \brief Keyword preset types for auto-moderation.
1084 enum class KeywordPresetType : Uint8 {
1085 Profanity = 1,///< Words that may be considered forms of swearing or cursing.
1086 Sexual_Content = 2,///< Words that refer to sexually explicit behavior or activity
1087 Slurs = 3///< Personal insults or words that may be considered hate speech.
1088 };
1089
1090 /// Action types for auto-moderation. \brief Action types for auto-moderation.
1091 enum class ActionType : Uint8 {
1092 Block_Message = 1,///< Blocks the content of a message according to the rule.
1093 Send_Alert_Message = 2,///< Logs user content to a specified channel.
1094 Timeout = 3///< Timeout user for a specified duration.
1095 };
1096
1097 /// Action metadata for auto-moderation-rules. \brief Action metadata for auto-moderation-rules.
1098 struct DiscordCoreAPI_Dll ActionMetaData {
1099 Snowflake channelId{};///< Channel to which user content should be logged.
1100 Int64 durationSeconds{};///< Timeout duration in seconds.
1101
1102 ActionMetaData() noexcept = default;
1103
1104 ActionMetaData(simdjson::ondemand::value jsonObjectData);
1105
1106 virtual ~ActionMetaData() noexcept = default;
1107 };
1108
1109 /// Trigger metadata for auto-moderation-rules. \brief Trigger metadata for auto-moderation-rules.
1110 struct DiscordCoreAPI_Dll TriggerMetaData {
1111 std::vector<String> keywordFilter{};///< Substrings which will be searched for in content.
1112 std::vector<KeywordPresetType> presets{};///< The internally pre-defined wordsets which will be searched for in content.
1113
1114 TriggerMetaData() noexcept = default;
1115
1116 TriggerMetaData(simdjson::ondemand::value jsonObjectData);
1117
1118 virtual ~TriggerMetaData() noexcept = default;
1119 };
1120
1121 /// For representing a single auto-moderation-rule-action. \brief For representing a single auto-moderation-rule-action.
1122 struct DiscordCoreAPI_Dll ActionData {
1123 ActionType type{};///< The type of action.
1124 ActionMetaData metadata{};///< Additional metadata needed during execution for this specific action type.
1125
1126 ActionData() noexcept = default;
1127
1128 ActionData(simdjson::ondemand::value jsonObjectData);
1129
1130 virtual ~ActionData() noexcept = default;
1131 };
1132
1133 /// Represents an auto-moderation-rule. \brief Represents an auto-moderation-rule.
1134 class DiscordCoreAPI_Dll AutoModerationRuleData : public DiscordEntity {
1135 public:
1136 std::vector<Snowflake> exemptChannels{};///< The channel ids that should not be affected by the rule(Maximum of 50).
1137 std::vector<Snowflake> exemptRoles{};///< The role ids that should not be affected by the rule(Maximum of 20).
1138 std::vector<ActionData> actions{};///< Actions which will execute when the rule is triggered.
1139 TriggerMetaData triggerMetaData{};///< The rule trigger metadata actions array of action objects the.
1140 TriggerType triggerType{};///< The rule trigger type.
1141 EventType eventType{};///< The rule event type.
1142 Snowflake creatorId{};///< The user which first created this rule.
1143 Snowflake guildId{};///< The guild which this rule belongs to.
1144 String name{};///< The rule name.
1145 Bool enabled{};///< Whether the rule is enabled.
1146
1147 AutoModerationRuleData() noexcept = default;
1148
1149 AutoModerationRuleData(simdjson::ondemand::value jsonObjectData);
1150
1151 virtual ~AutoModerationRuleData() noexcept = default;
1152 };
1153
1154 /// Permissions data for an ApplicationCommand. \brief Permissions data for an ApplicationCommand.
1155 class DiscordCoreAPI_Dll ApplicationCommandPermissionData : public DiscordEntity {
1156 public:
1157 ApplicationCommandPermissionType type{ ApplicationCommandPermissionType::Role };///< The type of PermissionTypes.
1158 Bool permission{ false };///< Whether the PermissionTypes is active or not.
1159
1160 ApplicationCommandPermissionData() noexcept = default;
1161
1162 ApplicationCommandPermissionData(simdjson::ondemand::value jsonObjectData);
1163
1164 virtual ~ApplicationCommandPermissionData() noexcept = default;
1165 };
1166
1167 /// Represents the Permissions for accessing an ApplicationCommand from within a Guild. \brief Represents the Permissions for accessing an ApplicationCommand from within a Guild.
1168 class DiscordCoreAPI_Dll GuildApplicationCommandPermissionsData : public DiscordEntity {
1169 public:
1170 std::vector<ApplicationCommandPermissionData> permissions{};///< The Permissions.
1171 Snowflake applicationId{};///< The application's id.
1172 Snowflake guildId{};///< The Guild's id.
1173
1174 GuildApplicationCommandPermissionsData() noexcept = default;
1175
1176 GuildApplicationCommandPermissionsData(simdjson::ondemand::value jsonObjectData);
1177
1178 virtual ~GuildApplicationCommandPermissionsData() noexcept = default;
1179 };
1180
1181 class DiscordCoreAPI_Dll GuildApplicationCommandPermissionsDataVector {
1182 public:
1183 GuildApplicationCommandPermissionsDataVector() noexcept = default;
1184
1185 operator std::vector<GuildApplicationCommandPermissionsData>();
1186
1187 GuildApplicationCommandPermissionsDataVector(simdjson::ondemand::value jsonObjectData);
1188
1189 virtual ~GuildApplicationCommandPermissionsDataVector() noexcept = default;
1190
1191 protected:
1192 std::vector<GuildApplicationCommandPermissionsData> theGuildApplicationCommandPermissionsDatas{};
1193 };
1194
1195 class DiscordCoreAPI_Dll EmojiDataVector {
1196 public:
1197 EmojiDataVector() noexcept = default;
1198
1199 EmojiDataVector(simdjson::ondemand::value jsonObjectData);
1200
1201 virtual ~EmojiDataVector() noexcept = default;
1202
1203 protected:
1204 std::vector<EmojiData> theEmojiDatas{};
1205 };
1206
1207 /// For updating/modifying a given Channel's properties. \brief For updating/modifying a given Channel's properties.
1208 struct DiscordCoreAPI_Dll UpdateChannelData {
1209 std::vector<OverWriteData> permissionOverwrites{};
1210 Int32 defaultAutoArchiveDuration{ 10080 };
1211 Int32 videoQualityMode{ 1 };
1212 Int32 rateLimitPerUser{ 0 };
1213 Int32 bitrate{ 48000 };
1214 String parentId{};
1215 String rtcRgion{};
1216 Int32 userLimit{ 0 };
1217 Int32 position{ 0 };
1218 String topic{};
1219 String name{};
1220 ChannelType type{};
1221 Bool nsfw{ false };
1222 };
1223
1224 /// Data structure representing a single reaction. \brief/// Data structure representing a single reaction.
1225 class DiscordCoreAPI_Dll ReactionData : public DiscordEntity {
1226 public:
1227 GuildMemberData member{};///< The GuildMember who placed the reaction.
1228 Snowflake channelId{};///< The id of the Channel where it was placed.
1229 Snowflake messageId{};///< The id of the Message upon which it was placed.
1230 Snowflake guildId{};///< The id of the Guild where it was placed.
1231 Int32 count{ 0 };///< The number of times this particular emoji was placed as a reaction to the given Message.
1232 EmojiData emoji{};///< The emoji that was placed as a reaction.
1233 Snowflake userId{};///< The id of the User who placed the reaction.
1234 Bool me{ false };///< Whether or not I (The bot) placed it.
1235
1236 ReactionData() noexcept = default;
1237
1238 ReactionData(simdjson::ondemand::value jsonObjectData);
1239
1240 virtual ~ReactionData() noexcept = default;
1241 };
1242
1243 /// Structure representing Voice Region Data. \brief Structure representing Voice Region Data.
1244 struct DiscordCoreAPI_Dll VoiceRegionData {
1245 Bool deprecated{ false };///< Whether this is a deprecated voice region(avoid switching to these).
1246 Bool optimal{ false };///< True for a single server that is closest to the current User's client.
1247 Bool custom{ false };///< Whether this is a custom voice region(used for events / etc).
1248 String name{};///< Name of the region.
1249 Snowflake id{};///< Unique ID for the region.
1250
1251 VoiceRegionData() noexcept = default;
1252
1253 VoiceRegionData(simdjson::ondemand::value jsonObjectData);
1254
1255 virtual ~VoiceRegionData() noexcept = default;
1256 };
1257
1258 class DiscordCoreAPI_Dll VoiceRegionDataVector {
1259 public:
1260 VoiceRegionDataVector() noexcept = default;
1261
1262 operator std::vector<VoiceRegionData>();
1263
1264 VoiceRegionDataVector(simdjson::ondemand::value jsonObjectData);
1265
1266 virtual ~VoiceRegionDataVector() noexcept = default;
1267
1268 protected:
1269 std::vector<VoiceRegionData> theVoiceRegionDatas{};
1270 };
1271
1272 /// Message activity types. \brief Message activity types.
1273 enum class MessageActivityType : Uint8 {
1274 Join = 1,///< Join.
1275 Spectate = 2,///< Spectate.
1276 Listen = 3,///< Listen.
1277 Join_Request = 5///< Join-request.
1278 };
1279
1280 /// Message activity data. \brief Message activity data.
1281 struct DiscordCoreAPI_Dll MessageActivityData {
1282 MessageActivityType type{ MessageActivityType::Join };///< Message activity type.
1283 String partyId{};///< Party id.
1284
1285 MessageActivityData() noexcept = default;
1286
1287 MessageActivityData(simdjson::ondemand::value jsonObjectData);
1288
1289 virtual ~MessageActivityData() noexcept = default;
1290 };
1291
1292 /// Ban data. \brief Ban data.
1293 struct DiscordCoreAPI_Dll BanData {
1294 Bool failedDueToPerms{ false };///< Failed due to perms?
1295 String reason{};///< Reason for the ban.
1296 UserData user{};///< User that was banned.
1297
1298 BanData() noexcept = default;
1299
1300 BanData(simdjson::ondemand::value jsonObjectData);
1301
1302 virtual ~BanData() noexcept = default;
1303 };
1304
1305 class DiscordCoreAPI_Dll BanDataVector {
1306 public:
1307 BanDataVector() noexcept = default;
1308
1309 operator std::vector<BanData>();
1310
1311 BanDataVector(simdjson::ondemand::value jsonObjectData);
1312
1313 virtual ~BanDataVector() noexcept = default;
1314
1315 protected:
1316 std::vector<BanData> theBanDatas{};
1317 };
1318
1319 /// Team members object data. \brief Team members object data.
1320 struct DiscordCoreAPI_Dll TeamMembersObjectData {
1321 std::vector<Permissions> permissions{};///< Permissions for the team.
1322 Int32 membershipState{ 0 };///< Current state.
1323 String teamId{};///< Id of the current team.
1324 UserData user{};///< User data of the current User.
1325
1326 TeamMembersObjectData() noexcept = default;
1327
1328 TeamMembersObjectData(simdjson::ondemand::value jsonObjectData);
1329
1330 virtual ~TeamMembersObjectData() noexcept = default;
1331 };
1332
1333 /// For updating the current voice state. \brief For updating the current voice state.
1334 struct DiscordCoreAPI_Dll UpdateVoiceStateData {
1335 Bool selfMute{ false };///< Whether or not we self-mute ourselves.
1336 Bool selfDeaf{ false };///< Whether or not we self-deafen ourselves.
1337 Snowflake channelId{};///< Id of the desired voice Channel. Leave blank to disconnect.
1338 Snowflake guildId{};///< The id of the Guild fo which we would like to establish a voice connection.
1339
1340 operator DiscordCoreAPI::JsonObject();
1341 };
1342
1343 /// Team object data. \brief Team object data.
1344 class DiscordCoreAPI_Dll TeamObjectData : public DiscordEntity {
1345 public:
1346 std::vector<TeamMembersObjectData> members{};///< Array of team members object data.
1347 Snowflake ownerUserId{};///< User id of the team owner.
1348 String icon{};///< Icon for the team.
1349
1350 TeamObjectData() noexcept = default;
1351
1352 TeamObjectData(simdjson::ondemand::value jsonObjectData);
1353
1354 virtual ~TeamObjectData() noexcept = default;
1355 };
1356
1357 /// Application flags, for the ApplicationData structure.
1358 enum class ApplicationFlags : Int32 {
1359 Gateway_Presence = 1 << 12,///< Intent required for bots in 100 or more servers to receive presence_update events.
1360 Gateway_Presence_Limited = 1 << 13,///< Intent required for bots in under 100 servers to receive presence_update events, found in Bot Settings.
1361 Gateway_Guild_Members = 1 << 14,///< Intent required for bots in 100 or more servers to receive member-related events like guild_member_add.
1362 Gateway_Guild_Members_Limited = 1 << 15,///< Intent required for bots in under 100 servers to receive member-related events like guild_member_add, found in Bot Settings.
1363 Verificatino_Pending_Guild_Limit = 1 << 16,///< Indicates unusual growth of an app that prevents verification
1364 Embedded = 1 << 17,///< Indicates if an app is embedded within the Discord client (currently unavailable publicly)
1365 Gateway_Message_Content = 1 << 18,///< Intent required for bots in 100 or more servers to receive message content
1366 Gateway_Message_Content_Limited = 1 << 19///< Intent required for bots in under 100 servers to receive message content, found in Bot Settings};
1367 };
1368
1369 /// Install params data, for application data. \brief Install params data, for application data.
1370 struct DiscordCoreAPI_Dll InstallParamsData {
1371 std::vector<String> scopes{};///< The scopes to add the application to the server with.
1372 Permissions permissions{};///< The permissions to request for the bot role.
1373
1374 InstallParamsData() noexcept = default;
1375
1376 InstallParamsData(simdjson::ondemand::value jsonObjectData);
1377
1378 virtual ~InstallParamsData() noexcept = default;
1379 };
1380
1381 /// Application data. \brief Application data.
1382 class DiscordCoreAPI_Dll ApplicationData : public DiscordEntity {
1383 public:
1384 std::vector<String> rpcOrigins{};///< Array of RPC origin strings.
1385 Bool botRequireCodeGrant{ false };///< Does the bot require a code grant?
1386 std::vector<String> tags{};///< Up to 5 tags describing the content and functionality of the application install_params.
1387 String termsOfServiceUrl{};///< Terms of service Url.
1388 String privacyPolicyUrl{};///< Privacy policy Url.
1389 ApplicationFlags flags{ 0 };///< Application flags.
1390 InstallParamsData params{};///< Settings for the application's default in-app authorization link, if enabled String customInstallUrl{};
1391 String primarySkuId{};///< Primary SKU Id.
1392 String description{};///< Description of the application.
1393 String coverImage{};///< The cover image.
1394 Bool botPublic{ false };///< Is the bot public?
1395 String verifyKey{};///< The verification key.
1396 String summary{};///< Summary of the application.
1397 TeamObjectData team{};///< Team object data.
1398 Snowflake guildId{};///< Guild id.
1399 String slug{};///< Sluhg.
1400 String name{};///< Application's name.
1401 String icon{};///< Application's icon.
1402 UserData owner{};///< Application's owner.
1403
1404 ApplicationData() noexcept = default;
1405
1406 ApplicationData(simdjson::ondemand::value jsonObjectData);
1407
1408 virtual ~ApplicationData() noexcept = default;
1409 };
1410
1411 /// Authorization info structure. \brief Authorization info structure.
1412 struct DiscordCoreAPI_Dll AuthorizationInfoData {
1413 std::vector<String> scopes{};///< Array of strings - the scopes the User has authorized the application for.
1414 ApplicationData application{};///< Partial application object the current application.
1415 String expires{};///< When the access token expires.
1416 UserData user{};/// The User who has authorized, if the User has authorized with the identify scope.
1417
1418 AuthorizationInfoData() noexcept = default;
1419
1420 AuthorizationInfoData(simdjson::ondemand::value jsonObjectData);
1421
1422 virtual ~AuthorizationInfoData() noexcept = default;
1423 };
1424
1425 /// Account data. \brief Account data.
1426 class DiscordCoreAPI_Dll AccountData : public DiscordEntity {
1427 public:
1428 String name{};///< Name of the account.
1429
1430 AccountData() noexcept = default;
1431
1432 AccountData(simdjson::ondemand::value jsonObjectData);
1433
1434 virtual ~AccountData() noexcept = default;
1435 };
1436
1437 /// Guild Widget Data. \brief Guild Widget Data.
1438 struct DiscordCoreAPI_Dll GuildWidgetData {
1439 Bool enabled{ false };///< Whether the widget is enabled.
1440 Snowflake channelId{};///< The widget Channel id.
1441
1442 GuildWidgetData() noexcept = default;
1443
1444 GuildWidgetData(simdjson::ondemand::value jsonObjectData);
1445
1446 virtual ~GuildWidgetData() noexcept = default;
1447 };
1448
1449 /// Get Guild Widget Data. \brief Get Guild Widget Data.
1450 struct DiscordCoreAPI_Dll GetGuildWidgetObjectData : public DiscordEntity {
1451 std::vector<ChannelData> channels{};///< Voice and stage channels which are accessible by everyone.
1452 std::vector<UserData> members{};///< Special widget user objects that includes users presence (Limit 100).
1453 String instantInvite{};///< Instant invite for the guilds specified widget invite channel.
1454 Int32 presence_count{ 0 };///< Number of online members in this guild.
1455 String name{};///< Guild name (2-100 characters).
1456 };
1457
1458 /// Widget style options. \brief Widget style options.
1459 enum class WidgetStyleOptions : Uint8 {
1460 Shield = 0,///< Shield
1461 Banner1 = 1,///< Banner1
1462 Banner2 = 2,///< Banner2
1463 Banner3 = 3,///< Banner3
1464 Banner4 = 4///< Banner4
1465 };
1466
1467 /// Guild widget image data. \brief Guild widget image data.
1468 struct DiscordCoreAPI_Dll GuildWidgetImageData {
1469 String url{};
1470
1471 GuildWidgetImageData() noexcept = default;
1472
1473 GuildWidgetImageData(simdjson::ondemand::value jsonObjectData);
1474
1475 virtual ~GuildWidgetImageData() noexcept = default;
1476 };
1477
1478 /// Integration data. \brief Integration data.
1479 class DiscordCoreAPI_Dll IntegrationData : public DiscordEntity {
1480 public:
1481 TimeStamp<std::chrono::milliseconds> syncedAt{};///< Time it was last synced at.
1482 Int32 expireGracePeriod{ 0 };///< How Int64 before the integration expires.
1483 ApplicationData application{};///< Application data.
1484 Int32 subscriberCount{ 0 };///< Number of current subscribers.
1485 Bool enableEmoticons{ true };///< Emoticons enabled?
1486 Int32 expireBehavior{ 0 };///< What to do upon expiry.
1487 Bool enabled{ false };///< Enabled?
1488 Bool syncing{ false };///< Is it syncing?
1489 AccountData account{};///< Account data.
1490 Bool revoked{ false };///< Has it been revoked?
1491 String name{};///< Name of the integration.
1492 String type{};///< Type of integration.
1493 Snowflake roleId{};///< Role Id.
1494 UserData user{};///< User data for the integration.
1495
1496 IntegrationData() noexcept = default;
1497
1498 IntegrationData(simdjson::ondemand::value jsonObjectData);
1499
1500 virtual ~IntegrationData() noexcept = default;
1501 };
1502
1503 class DiscordCoreAPI_Dll IntegrationDataVector {
1504 public:
1505 IntegrationDataVector() noexcept = default;
1506
1507 operator std::vector<IntegrationData>();
1508
1509 IntegrationDataVector(simdjson::ondemand::value jsonObjectData);
1510
1511 virtual ~IntegrationDataVector() noexcept = default;
1512
1513 protected:
1514 std::vector<IntegrationData> theIntegrationDatas{};
1515 };
1516
1517 /// Audit log events. \brief Audit log events.
1518 enum class AuditLogEvent : Uint8 {
1519 Guild_Update = 1,///< Guild update.
1520 Channel_Create = 10,///< Channel create.
1521 Channel_Update = 11,///< Channel update.
1522 Channel_Delete = 12,///< Channel delete.
1523 Channel_Overwrite_Create = 13,///< Channel overwrite create.
1524 Channel_Overwrite_Update = 14,///< Channel overwrite update.
1525 Channel_Overwrite_Delete = 15,///< Channel overwrite delete.
1526 Member_Kick = 20,///< Member kick.
1527 Member_Prune = 21,///< Member prune.
1528 Member_Ban_Add = 22,///< Member ban add.
1529 Member_Ban_Remove = 23,///< Member ban remove.
1530 Member_Update = 24,///< Member update.
1531 Member_Role_Update = 25,///< Member role update.
1532 Member_Move = 26,///< Member move.
1533 Member_Disconnect = 27,///< Member disconnect.
1534 Bot_Add = 28,///< Bot add.
1535 Role_Create = 30,///< Role create.
1536 Role_Update = 31,///< Role update.
1537 Role_Delete = 32,///< Role delete.
1538 Invite_Create = 40,///< Invite create.
1539 Invite_Update = 41,///< Invite update.
1540 Invite_Delete = 42,///< Invite delete.
1541 Webhook_Create = 50,///< Webhook create.
1542 Webhook_Update = 51,///< Webhook update.
1543 Webhook_Delete = 52,///< Webhook delete.
1544 Emoji_Create = 60,///< Emoji create.
1545 Emoji_Update = 61,///< Emoji update.
1546 Emoji_Delete = 62,///< Emoji delete.
1547 Message_Delete = 72,///< Message delete.
1548 Message_Bulk_Delete = 73,///< Message bulk delete.
1549 Message_Pin = 74,///< Message pin.
1550 Message_Unpin = 75,///< Message unpin.
1551 Integration_Create = 80,///< Integration create.
1552 Integration_Update = 81,///< Integration update.
1553 Integration_Delete = 82,///< Integration delete.
1554 Stage_Instance_Create = 83,///< Stage-Instance create.
1555 Stage_Instance_Update = 84,///< Stage-Instance update.
1556 Stage_Instance_Delete = 85,///< Stage-Instance delete.
1557 Sticker_Create = 90,///< Sticker create.
1558 Sticker_Update = 91,///< Sticker update.
1559 Sticker_Delete = 92,///< Sticker delete.
1560 Guild_Scheduled_Event_Create = 100,///< Guild-scheduled-event create.
1561 Guild_Scheduled_Event_Update = 101,///< Guild-scheduled-event update.
1562 Guild_Scheduled_Event_Delete = 102,///< Guild-scheduled-event delete.
1563 Thread_Create = 110,///< Thread create.
1564 Thread_Update = 111,///< Thread update.
1565 Thread_Delete = 112,///< Thread delete.
1566 Application_Command_Permission_Update = 121,///< Permissions were updated for a command.
1567 Auto_Moderation_Rule_Create = 140,///< Auto Moderation rule was created.
1568 Auto_Moderation_Rule_Update = 141,///< Auto Moderation rule was updated.
1569 Auto_Moderation_Rule_Delete = 142,///< Auto Moderation rule was deleted.
1570 Auto_Moderation_Block_Message = 143///< Message was blocked by AutoMod (according to a rule).
1571 };
1572
1573 /// Audit log entry info data \brief Audit log entry info data.
1574 class DiscordCoreAPI_Dll OptionalAuditEntryInfoData : public DiscordEntity {
1575 public:
1576 String deleteMemberDays{};///< Number of days for which the member's Messages were deleted.
1577 String membersRemoved{};///< Number of members that were removed upon a prune.
1578 Snowflake applicationId{};///< ID of the app whose permissions were targeted APPLICATION_COMMAND_PERMISSION_UPDATE.
1579 String roleName{};///< Role name.
1580 Snowflake channelId{};///< Channel Id.
1581 Snowflake messageId{};///< Message Id.
1582 String count{};///< Count.
1583 String type{};///< Type.
1584
1585 OptionalAuditEntryInfoData() noexcept = default;
1586
1587 OptionalAuditEntryInfoData(simdjson::ondemand::value jsonObjectData);
1588
1589 virtual ~OptionalAuditEntryInfoData() noexcept = default;
1590 };
1591
1592 /// Audit log change data. \brief Audit log change data.
1593 struct DiscordCoreAPI_Dll AuditLogChangeData {
1594 JsonStringValue newValue{};///< New value.
1595 JsonStringValue oldValue{};///< Old value.
1596 String key{};///< The key of the audit log change.
1597
1598 AuditLogChangeData() noexcept = default;
1599
1600 AuditLogChangeData(simdjson::ondemand::value jsonObjectData);
1601
1602 virtual ~AuditLogChangeData() noexcept = default;
1603 };
1604
1605 /// Guild prune count data. \brief Guild prune count data.
1606 struct DiscordCoreAPI_Dll GuildPruneCountData {
1607 Int32 count{ 0 };
1608
1609 GuildPruneCountData() noexcept = default;
1610
1611 GuildPruneCountData(simdjson::ondemand::value jsonObjectData);
1612
1613 virtual ~GuildPruneCountData() noexcept = default;
1614 };
1615
1616 /// Audit log entry data. \brief Audit log entry data.
1617 class DiscordCoreAPI_Dll AuditLogEntryData : public DiscordEntity {
1618 public:
1619 TimeStamp<std::chrono::milliseconds> createdTimeStamp{ "" };///< Time at which this entry was created.
1620 std::vector<AuditLogChangeData> changes{};///< Array of audit log change data.
1621 OptionalAuditEntryInfoData options{};///< Audit log entry info data.
1622 AuditLogEvent actionType{};///< Audit log action type.
1623 String reason{};///< The reason that was entered for the given change.
1624 Snowflake targetId{};///< Id of the target User.
1625 Snowflake userId{};///< Id of the executing User.
1626
1627 AuditLogEntryData() noexcept = default;
1628
1629 AuditLogEntryData(simdjson::ondemand::value jsonObjectData);
1630
1631 virtual ~AuditLogEntryData() noexcept = default;
1632 };
1633
1634 /// Premium tier levels. \brief Premium tier levels.
1635 enum class PremiumTier : Uint8 {
1636 None = 0,///< None.
1637 Tier_1 = 1,///< Tier 1.
1638 Tier_2 = 2,///< Tier 2.
1639 Tier_3 = 3///< Tier 3.
1640 };
1641
1642 /// Default Message notification levels. \brief Default Message notification
1643 /// levels.
1645 All_Messages = 0,///< All messages.
1646 Only_Mentions = 1///< Only mentions.
1647 };
1648
1649 /// Explicit content filter levels. \brief Explicit content filter levels.
1650 enum class ExplicitContentFilterLevel : Uint8 {
1651 Disabled = 0,///< Disabled.
1652 Members_Without_Roles = 1,///< Members without roles.
1653 All_Members = 2///< All members.
1654 };
1655
1656 /// MFA levels. \brief MFA levels.
1657 enum class MFALevel : Uint8 {
1658 None = 0,///< None.
1659 Elevated = 1///< Elevated.
1660 };
1661
1662 /// Verification levels. \brief/// Verification levels.
1663 enum class VerificationLevel : Uint8 {
1664 None = 0,///< None.
1665 Low = 1,///< Low.
1666 Medium = 2,///< Medium.
1667 High = 3,///< High.
1668 Very_High = 4///< Very high.
1669 };
1670
1671 /// Welcome screen Channel data. \brief Welcome screen Channel data.
1672 struct DiscordCoreAPI_Dll WelcomeScreenChannelData {
1673 String description{};///< Description of the welcome Channel.
1674 String emojiName{};///< Emoji name for the Channel.
1675 Snowflake channelId{};///< Id of the welcome Channel.
1676 Snowflake emojiId{};///< Emoji id for the Channel.
1677
1678 WelcomeScreenChannelData() noexcept = default;
1679
1680 WelcomeScreenChannelData(simdjson::ondemand::value jsonObjectData);
1681
1682 virtual ~WelcomeScreenChannelData() noexcept = default;
1683 };
1684
1685 /// Welcome screen data. \brief Welcome screen data.
1686 struct DiscordCoreAPI_Dll WelcomeScreenData {
1687 std::vector<WelcomeScreenChannelData> welcomeChannels{};///< Welcome screen Channel data.
1688 String description{};///< Description of the welcome screen.
1689
1690 WelcomeScreenData() noexcept = default;
1691
1692 WelcomeScreenData(simdjson::ondemand::value jsonObjectData);
1693
1694 virtual ~WelcomeScreenData() noexcept = default;
1695 };
1696
1697 /// Stage instance privacy levels. \brief Stage instance privacy levels.
1698 enum class StageInstancePrivacyLevel : Uint8 {
1699 Public = 1,///< Public.
1700 Guild_Only = 2///< Guild only.
1701 };
1702
1703 /// Stage instance data. \brief Stage instance data.
1704 class DiscordCoreAPI_Dll StageInstanceData : public DiscordEntity {
1705 public:
1706 StageInstancePrivacyLevel privacyLevel{ 0 };///< Privacy level of the Channel.
1707 Bool discoverableDisabled{ false };///< Is it discoverable?
1708 Snowflake channelId{};///< The Channel's id.
1709 String topic{};///< The topic of the StageInstance.
1710 Snowflake guildId{};///< The Guild id for which the Channel exists in.
1711
1712 StageInstanceData() noexcept = default;
1713
1714 StageInstanceData(simdjson::ondemand::value jsonObjectData);
1715
1716 virtual ~StageInstanceData() noexcept = default;
1717 };
1718
1719 /// Sticker types. \brief Sticker types.
1720 enum class StickerType : Uint8 {
1721 Standard = 1,///< Standard.
1722 Guild = 2///< Guild.
1723 };
1724
1725 enum class StickerFlags : Uint8 { Available = 1 << 0 };
1726
1727 /// Data representing a single Sticker. \brief Data representing a single Sticker.
1728 class DiscordCoreAPI_Dll StickerData : public DiscordEntity {
1729 public:
1730 StickerFormatType formatType{};///< Format type.
1731 String description{};///< Description of the Sticker.
1732 Int8 stickerFlags{ 0 };///< Sticker flags.
1733 Int32 nsfwLevel{ 0 };///< NSFW warning level.
1734 Int32 sortValue{ 0 };///< Where in the stack of stickers it resides.
1735 String packId{};///< Pack id of the Sticker.
1736 String asset{};///< Asset value for the Sticker.
1737 String name{};///< The Sticker's name.
1738 String tags{};///< Tags for the Sticker to use.
1739 StickerType type{};///< The type of Sticker.
1740 Snowflake guildId{};///< The Guild id for which the Sticker exists in.
1741 UserData user{};///< The User that uploaded the Guild Sticker.
1742
1743 StickerData() noexcept = default;
1744
1745 StickerData(simdjson::ondemand::value jsonObjectData);
1746
1747 virtual ~StickerData() noexcept = default;
1748 };
1749
1750 /// Data representing a single Guild preview. \brief Data representing a single Guild preview.
1751 struct DiscordCoreAPI_Dll GuildPreviewData {
1752 Int32 approximatePresenceCount{ 0 };
1753 std::vector<String> features{};
1754 std::vector<StickerData> stickers{};
1755 Int32 approximateMemberCount{ 0 };
1756 std::vector<EmojiData> emojis{};
1757 String discoverySplash{};
1758 String description{};
1759 String splash{};
1760 String name{};
1761 String icon{};
1762 Snowflake id{};
1763
1764 GuildPreviewData() noexcept = default;
1765
1766 GuildPreviewData(simdjson::ondemand::value jsonObjectData);
1767
1768 virtual ~GuildPreviewData() noexcept = default;
1769 };
1770
1771 /// Afk timeout durations. \brief Afk timeout durations.
1772 enum class AfkTimeOutDurations : Int16 {
1773 Shortest = 60,///< Shortest.
1774 Short = 300,///< Short.
1775 Medium = 900,///< Medium.
1776 Long = 1800,///< Long.
1777 Longest = 3600///< Longest.
1778 };
1779
1780 /// Guild NSFW level. \brief Guild NSFW level.
1781 enum class GuildNSFWLevel : Uint8 {
1782 Default = 0,///< Default.
1783 Explicit = 1,///< Explicit.
1784 Safe = 2,///< Safe.
1785 Age_Restricted = 3///< Age restricted.
1786 };
1787
1788 /// System channel flags. \brief System channel flags.
1789 enum class SystemChannelFlags : Uint8 {
1790 Suppress_Join_Notifications = 1 << 0,///< Suppress member join notifications.
1791 Suppress_Premium_Subscriptions = 1 << 1,///< Suppress server boost notifications.
1792 Suppress_Guild_Reminder_Notifications = 1 << 2,///< Suppress server setup tips.
1793 Suppress_Join_Notification_Replies = 1 << 3///< Hide member join sticker reply buttons.
1794 };
1795
1796 /// Guild flags. \brief Guild flags.
1797 enum class GuildFlags : Uint8 {
1798 WidgetEnabled = 1 << 0,///< Widget enabled.
1799 Unavailable = 1 << 1,///< Unavailable.
1800 Owner = 1 << 2,///< Owner.
1801 Large = 1 << 3,///< Large.
1802 Premium_Progress_Bar_Enabled = 1 << 4///< Premium progress bar enabled
1803 };
1804
1805 /// Data structure representing a single Guild. \brief Data structure representing a single Guild.
1806 class DiscordCoreAPI_Dll GuildData : public DiscordEntity {
1807 public:
1808 DiscordCoreClient* discordCoreClient{ nullptr };///< A pointer to the DiscordCoreClient.
1809 TimeStamp<std::chrono::milliseconds> joinedAt{};///< When the bot joined this Guild.
1810 VoiceConnection* voiceConnectionPtr{ nullptr };///< A pointer to the VoiceConnection, if present.
1811 std::vector<Snowflake> guildScheduledEvents{};///< Array of Guild channels.
1812 std::vector<PresenceUpdateData> presences{};///< Presence states for each of the GuildMembers..
1813 std::vector<Snowflake> stageInstances{};///< Array of Guild channels.
1814 std::vector<Snowflake> stickers{};///< Array of Guild channels.
1815 std::vector<Snowflake> channels{};///< Array of Guild channels.
1816 std::vector<Snowflake> threads{};///< Array of Guild channels.
1817 std::vector<Snowflake> members{};///< Array of GuildMembers.
1818 std::vector<Snowflake> roles{};///< Array of Guild roles.
1819 std::vector<Snowflake> emoji{};///< Array of Guild channels.
1820 Int32 memberCount{ 0 };///< Member count.
1821 StringWrapper name{};///< The Guild's name.
1822 Snowflake ownerId{};///< User id of the Guild's owner.
1823 Int8 flags{ 0 };///< Guild flags.
1824 IconHash icon{};///< Url to the Guild's icon.
1825
1826 GuildData() noexcept = default;
1827
1828 GuildData& operator=(GuildData&&) noexcept = default;
1829 ;
1830
1831 GuildData(GuildData&&) noexcept = default;
1832
1833 GuildData& operator=(const GuildData&) noexcept = default;
1834
1835 GuildData(const GuildData&) noexcept = default;
1836
1837 GuildData(simdjson::ondemand::value jsonObjectData);
1838
1839 /// For connecting to an individual voice channel. \brief For connecting to an individual voice channel.
1840 /// \param guildMemberId An id of the guild member who's current voice channel to connect to.
1841 /// \param channelId An id of the voice channel to connect to.
1842 /// \param selfDeaf Whether or not to self-deafen the bot.
1843 /// \param selfMute Whether or not to self-mute the bot.
1844 /// \param streamType For usage with the Vc-to-Vc audio streaming option.
1845 /// \param streamInfo For usage with the Vc-to-Vc audio streaming option.
1846 /// \returns VoiceConnection* A pointer to the currently held voice connection, or nullptr if it failed to connect.
1847 VoiceConnection* connectToVoice(const Snowflake guildMemberId, const Snowflake channelId = Snowflake{ 0 }, Bool selfDeaf = false, Bool selfMute = false,
1848 StreamType streamType = StreamType::None, StreamInfo streamInfo = StreamInfo{});
1849
1850 String getBannerUrl() noexcept;
1851
1852 String getIconUrl() noexcept;
1853
1854 Bool areWeConnected();
1855
1856 void disconnect();
1857
1858 virtual ~GuildData() noexcept = default;
1859 };
1860
1861 class DiscordCoreAPI_Dll GuildDataVector {
1862 public:
1863 friend class Guilds;
1864
1865 GuildDataVector() noexcept = default;
1866
1867 operator std::vector<GuildData>();
1868
1869 GuildDataVector(simdjson::ondemand::value jsonObjectData);
1870
1871 virtual ~GuildDataVector() noexcept = default;
1872
1873 protected:
1874 std::vector<GuildData> theGuildDatas{};
1875 };
1876
1877 /// Guild scheduled event privacy levels. \brief Guild scheduled event privacy levels.
1879 Public = 1,///< Public.
1880 Guild_Only = 2///< Guild only.
1881 };
1882
1883 /// GuildScheduledEventStatus. \brief GuildScheduledEventStatus.
1884 enum class GuildScheduledEventStatus : Uint8 {
1885 Scheduled = 1,///< Scheduled.
1886 Active = 2,///< Active.
1887 Completed = 3,///< Completed.
1888 Canceled = 4///< Cancelled.
1889 };
1890
1891 /// Guild scheduled event entity types. \brief Guild scheduled event entity types.
1893 None = 0,///< None.
1894 State_Instance = 1,///< Stage instance.
1895 Voice = 2,///< Voice.
1896 External = 3///< External.
1897 };
1898
1899 /// Guild scheduled event entity metadata. \brief Guild scheduled event entity metadata.
1900 struct DiscordCoreAPI_Dll GuildScheduledEventMetadata {
1901 String location{};
1902
1903 GuildScheduledEventMetadata() noexcept = default;
1904
1905 GuildScheduledEventMetadata(simdjson::ondemand::value jsonObjectData);
1906
1907 virtual ~GuildScheduledEventMetadata() noexcept = default;
1908 };
1909
1910 /// Data representing a Guild Scheduled Event. \brief Data representing a Guild Scheduled Event.
1911 class DiscordCoreAPI_Dll GuildScheduledEventData : public DiscordEntity {
1912 public:
1913 GuildScheduledEventPrivacyLevel privacyLevel{};///< The privacy level of the scheduled event.
1914 GuildScheduledEventMetadata entityMetadata{};///< Additional metadata for the Guild scheduled event.
1915 GuildScheduledEventEntityType entityType{};///< The type of the scheduled event.
1916 GuildScheduledEventStatus status{};///< The status of the scheduled event.
1917 String scheduledStartTime{};///< The time the scheduled event will start.
1918 String scheduledEndTime{};///< The time the scheduled event will end, required if entity_type is External.
1919 String description{};///< The description of the scheduled event(1 - 1000 characters.
1920 Uint32 userCount{ 0 };///< The number of users subscribed to the scheduled event.
1921 String creatorId{};///< The id of the User that created the scheduled event *.
1922 String entityId{};///< The id of an entity associated with a Guild scheduled event.
1923 Snowflake channelId{};///< The Channel id in which the scheduled event will be hosted, or null if scheduled entity type is External.
1924 Snowflake guildId{};///< The Guild id which the scheduled event belongs to.
1925 String name{};///< The name of the scheduled event(1 - 100 characters).
1926 UserData creator{};///< The User that created the scheduled event.
1927
1928 GuildScheduledEventData() noexcept = default;
1929
1930 GuildScheduledEventData(simdjson::ondemand::value jsonObjectData);
1931
1932 virtual ~GuildScheduledEventData() noexcept = default;
1933 };
1934
1935 /// Data representing a single GuildScheduledEventUser. \brief Data representing a single GuildScheduledEventUser.
1936 struct DiscordCoreAPI_Dll GuildScheduledEventUserData {
1937 Snowflake guildScheduledEventId{};///< The scheduled event id which the User subscribed to/
1938 GuildMemberData member{};///< Guild member data for this User for the Guild which this event belongs to, if any.
1939 UserData user{};///< User which subscribed to an event.
1940
1941 GuildScheduledEventUserData() noexcept = default;
1942
1943 GuildScheduledEventUserData(simdjson::ondemand::value jsonObjectData);
1944
1945 virtual ~GuildScheduledEventUserData() noexcept = default;
1946 };
1947
1948 class DiscordCoreAPI_Dll GuildScheduledEventUserDataVector {
1949 public:
1950 GuildScheduledEventUserDataVector() noexcept = default;
1951
1952 operator std::vector<GuildScheduledEventUserData>();
1953
1954 GuildScheduledEventUserDataVector(simdjson::ondemand::value jsonObjectData);
1955
1956 virtual ~GuildScheduledEventUserDataVector() noexcept = default;
1957
1958 protected:
1959 std::vector<GuildScheduledEventUserData> theGuildScheduledEventUserDatas{};
1960 };
1961
1962 class DiscordCoreAPI_Dll GuildScheduledEventDataVector {
1963 public:
1964 GuildScheduledEventDataVector() noexcept = default;
1965
1966 operator std::vector<GuildScheduledEventData>();
1967
1968 GuildScheduledEventDataVector(simdjson::ondemand::value jsonObjectData);
1969
1970 virtual ~GuildScheduledEventDataVector() noexcept = default;
1971
1972 protected:
1973 std::vector<GuildScheduledEventData> theGuildScheduledEventDatas{};
1974 };
1975
1976 /// Invite data. \brief Invite data.
1977 struct DiscordCoreAPI_Dll InviteData {
1978 TimeStamp<std::chrono::milliseconds> expiresAt{};///< When the invite expires.
1979 TimeStamp<std::chrono::milliseconds> createdAt{};///< Time it was created at.
1980 GuildScheduledEventData guildScheduledEvent{};///< Scheduled Guild event.
1981 Int32 approximatePresenceCount{ 0 };///< Approximate presence count.
1982 ApplicationData targetApplication{};///< Application data.
1983 Int32 approximateMemberCount{ 0 };///< Approximate member count.
1984 StageInstanceData stageInstance{};///< Stage instance data.
1985 Int32 targetType{ 0 };///< Target type.
1986 Bool temporary{ false };///< Is it temporary?
1987 UserData targetUser{};///< Target User of the invite.
1988 ChannelData channel{};///< Channel data of the Channel that the invite is for.
1989 Int32 maxUses{ 0 };///< Max number of uses.
1990 Int32 maxAge{ 0 };///< Maximum age of the invite.
1991 Snowflake guildId{};///< The Guild this invite is for.
1992 String code{};///< Unique invite code.
1993 UserData inviter{};///< The User who created the invite.
1994 GuildData guild{};///< Guild data of the Channel that the invite is for.
1995 Int32 uses{ 0 };///< The current number of uses.
1996
1997 InviteData() noexcept = default;
1998
1999 InviteData(simdjson::ondemand::value jsonObjectData);
2000
2001 virtual ~InviteData() noexcept = default;
2002 };
2003
2004 class DiscordCoreAPI_Dll InviteDataVector {
2005 public:
2006 InviteDataVector() noexcept = default;
2007
2008 operator std::vector<InviteData>();
2009
2010 InviteDataVector(simdjson::ondemand::value jsonObjectData);
2011
2012 virtual ~InviteDataVector() noexcept = default;
2013
2014 protected:
2015 std::vector<InviteData> theInviteDatas{};
2016 };
2017
2018 /// Represents a Guild Template. \brief Represents a Guild Template.
2019 struct DiscordCoreAPI_Dll GuildTemplateData {
2020 GuildData serializedSourceGuild{};///< The Guild snapshot this template contains.
2021 String sourceGuildId{};///< The ID of the Guild this template is based on.
2022 String description{};///< The description for the template.
2023 Uint32 usageCount{ 0 };///< Number of times this template has been used.
2024 String creatorId{};///< The ID of the User who created the template.
2025 String createdAt{};///< When this template was created.
2026 String updatedAt{};///< When this template was last synced to the source Guild.
2027 Bool isDirty{ false };///< Whether the template has unsynced changes.
2028 String code{};///< The template code(unique ID).
2029 String name{};///< Template name.
2030 UserData creator{};///< The User who created the template.
2031
2032 GuildTemplateData() noexcept = default;
2033
2034 GuildTemplateData(simdjson::ondemand::value jsonObjectData);
2035
2036 virtual ~GuildTemplateData() noexcept = default;
2037 };
2038
2039 class DiscordCoreAPI_Dll GuildTemplateDataVector {
2040 public:
2041 GuildTemplateDataVector() noexcept = default;
2042
2043 operator std::vector<GuildTemplateData>();
2044
2045 GuildTemplateDataVector(simdjson::ondemand::value jsonObjectData);
2046
2047 virtual ~GuildTemplateDataVector() noexcept = default;
2048
2049 protected:
2050 std::vector<GuildTemplateData> theGuildTemplateDatas{};
2051 };
2052
2053 /// Invite target types. \brief Invite target types.
2054 enum class InviteTargetTypes : Uint8 {
2055 Stream = 1,///< Stream.
2056 Embedded_Application = 2///< Embedded application.
2057 };
2058
2059 /// WebHook types. \brief WebHook types.
2060 enum class WebHookType : Uint8 {
2061 Incoming = 1,///< Incoming.
2062 Channel_Follower = 2,///< Channel follower.
2063 Application = 3///< Application.
2064 };
2065
2066 /// WebHook data. \brief WebHook data.
2067 class DiscordCoreAPI_Dll WebHookData : public DiscordEntity {
2068 public:
2069 ChannelData sourceChannel{};///< Channel for which th WebHook was issued.
2070 Snowflake applicationId{};///< Application id.
2071 GuildData sourceGuild{};///< Source Guild id.
2072 WebHookType type{ 0 };///< Type of WebHook.
2073 String avatar{};///< Avatar of the WebHook.
2074 Snowflake channelId{};///< Channel id for which the WebHook was issued.
2075 String token{};///< Token of the WebHook.
2076 Snowflake guildId{};///< Guild id for which the WebHook was issued.
2077 String name{};///< Name of the WebHook.
2078 String url{};///< Url of the WebHook.
2079 UserData user{};///< User which create the WebHook.
2080
2081 WebHookData() noexcept = default;
2082
2083 WebHookData(simdjson::ondemand::value jsonObjectData);
2084
2085 virtual ~WebHookData() noexcept = default;
2086 };
2087
2088 class DiscordCoreAPI_Dll WebHookDataVector {
2089 public:
2090 WebHookDataVector() noexcept = default;
2091
2092 operator std::vector<WebHookData>();
2093
2094 WebHookDataVector(simdjson::ondemand::value jsonObjectData);
2095
2096 virtual ~WebHookDataVector() noexcept = default;
2097
2098 protected:
2099 std::vector<WebHookData> theWebHookDatas{};
2100 };
2101
2102 /// Audit log data. \brief Audit log data.
2103 class DiscordCoreAPI_Dll AuditLogData {
2104 public:
2105 std::vector<GuildScheduledEventData> guildScheduledEvents{};///< Array of guild scheduled event objects.
2106 std::vector<AutoModerationRuleData> autoModerationRules{};///< List of auto moderation rules referenced in the audit log.
2107 std::vector<AuditLogEntryData> auditLogEntries{};///< Array of audit log entry objects.
2108 std::vector<IntegrationData> integrations{};///< Array of partial integration objects.
2109 std::vector<WebHookData> webhooks{};///< Array of webhook objects.
2110 std::vector<ChannelData> threads{};///< Array of thread-specific channel objects.
2111 std::vector<UserData> users{};///< Array of user objects.
2112
2113 auto getAuditLogData(const Snowflake userIdOfChanger, AuditLogEvent auditLogType);
2114
2115 auto getAuditLogData(AuditLogEvent auditLogType, const Snowflake userIdOfTarget);
2116
2117 AuditLogData() noexcept = default;
2118
2119 AuditLogData(simdjson::ondemand::value jsonObjectData);
2120
2121 virtual ~AuditLogData() noexcept = default;
2122 };
2123
2124 /// For removing a reaction. \brief For removing a reaction.
2125 struct DiscordCoreAPI_Dll ReactionRemoveData {
2126 Snowflake channelId{};
2127 Snowflake messageId{};
2128 Snowflake guildId{};
2129 Snowflake userId{};
2130 EmojiData emoji{};
2131
2132 ReactionRemoveData() noexcept = default;
2133
2134 ReactionRemoveData(simdjson::ondemand::value jsonObjectData);
2135
2136 virtual ~ReactionRemoveData() noexcept = default;
2137 };
2138
2139 /// For storing Interaction-related values. \brief For storing Interaction-related values.
2140 struct DiscordCoreAPI_Dll InteractionPackageData {
2141 String interactionToken{};
2142 Snowflake applicationId{};
2143 Snowflake interactionId{};
2144 };
2145
2146 /// For storing Message-related values. \brief For storing Message-related values.
2147 struct DiscordCoreAPI_Dll MessagePackageData {
2148 Snowflake channelId{};
2149 Snowflake messageId{};
2150 };
2151
2152 enum class JsonType { Unset = 0, Integer = 1, Float = 2, String = 3, Boolean = 4 };
2153
2154 /// Data structure representing an ApplicationCommand's option choice. \brief Data structure representing an ApplicationCommand's option choice.
2155 class DiscordCoreAPI_Dll ApplicationCommandOptionChoiceData {
2156 public:
2157 std::unordered_map<String, String> nameLocalizations{};///< Dictionary with keys in available locales Localization dictionary for the name field.
2158 JsonType type{};///< The value of the option.
2159 String name{};///< The name of the current choice.
2160 Double valueFloat{};
2161 Uint64 valueInt{};
2162 StringView valueString{};
2163 String valueStringReal{};
2164 Bool valueBool{};
2165
2166 ApplicationCommandOptionChoiceData() noexcept = default;
2167
2168 operator JsonObject();
2169
2170 ApplicationCommandOptionChoiceData(simdjson::ondemand::value jsonObjectData);
2171
2172 virtual ~ApplicationCommandOptionChoiceData() noexcept = default;
2173 };
2174
2175 /// Data structure representing an ApplicationCommand's option. \brief Data structure representing an ApplicationCommand's option.
2176 struct DiscordCoreAPI_Dll ApplicationCommandOptionData {
2177 std::unordered_map<String, String> descriptionLocalizations{};///< Dictionary for the description localizations field.
2178 std::unordered_map<String, String> nameLocalizations{};///< Dictionary for the name localizations field.
2179 std::vector<ApplicationCommandOptionChoiceData> choices{};///< A vector of possible choices for the current ApplicationCommand option.
2180 std::vector<ApplicationCommandOptionData> options{};///< A vector of possible options for the current ApplicationCommand option.
2181 std::vector<ChannelType> channelTypes{};///< Set when the ApplicationCommand option type is set to Channel.
2182 ApplicationCommandOptionType type{};///< The type of command option.
2183 Bool autocomplete{ false };///< If autocomplete interactions are enabled for this STRING, INTEGER, or NUMBER type option.
2184 String description{};///< A description of the current ApplicationCommand option.
2185 Bool required{ false };///< If the parameter is required or optional-- default false.
2186 Int32 minValue{ 0 };///< If the option is an INTEGER or NUMBER type, the minimum value permitted.
2187 Int32 maxValue{ 0 };///< If the option is an INTEGER or NUMBER type, the maximum value permitted.
2188 String name{};///< Name of the current ApplicationCommand option.
2189
2190 ApplicationCommandOptionData() noexcept = default;
2191
2192 operator JsonObject();
2193
2194 ApplicationCommandOptionData(simdjson::ondemand::value jsonObjectData);
2195
2196 virtual ~ApplicationCommandOptionData() noexcept = default;
2197 };
2198
2199 /// Representing "TypingStart" data. \brief Representing "TypingStart" data.
2200 struct DiscordCoreAPI_Dll TypingStartData {
2201 GuildMemberData member{};
2202 Int32 timestamp{ 0 };
2203 Snowflake channelId{};
2204 Snowflake guildId{};
2205 Snowflake userId{};
2206
2207 TypingStartData() noexcept = default;
2208
2209 TypingStartData(simdjson::ondemand::value jsonObjectData);
2210
2211 virtual ~TypingStartData() noexcept = default;
2212 };
2213
2214 struct DiscordCoreAPI_Dll YouTubeFormat {
2215 String signatureCipher{};
2216 String audioSampleRate{};
2217 Int32 averageBitrate{ 0 };
2218 Int64 contentLength{ 0 };
2219 String audioQuality{};
2220 String downloadUrl{};
2221 String signature{};
2222 String mimeType{};
2223 String quality{};
2224 String codecs{};
2225 String aitags{};
2226 Int32 bitrate{ 0 };
2227 Int32 height{ 0 };
2228 Int32 width{ 0 };
2229 Int32 itag{ 0 };
2230 Int32 fps{ 0 };
2231 YouTubeFormat() noexcept = default;
2232 YouTubeFormat(simdjson::ondemand::value);
2233 };
2234
2235 /// YouTube format data. \brief YouTube format data.
2236 class DiscordCoreAPI_Dll YouTubeFormatVector {
2237 public:
2238 YouTubeFormatVector() noexcept = default;
2239
2240 operator std::vector<YouTubeFormat>();
2241
2242 YouTubeFormatVector(simdjson::ondemand::value jsonObjectData);
2243
2244 virtual ~YouTubeFormatVector() noexcept = default;
2245
2246 protected:
2247 std::vector<YouTubeFormat> theFormats{};
2248 };
2249
2250 /// Application command types. \brief Application command types.
2251 enum class ApplicationCommandType : Uint8 {
2252 Chat_Input = 1,///< Chat input.
2253 User = 2,///< User.
2254 Message = 3///< Message.
2255 };
2256
2257 /// User command Interaction data. \brief User command Interaction data.
2258 struct DiscordCoreAPI_Dll UserCommandInteractionData {
2259 Snowflake targetId{};///< The target User's id.
2260
2261 UserCommandInteractionData() noexcept = default;
2262
2263 UserCommandInteractionData(simdjson::ondemand::value jsonObjectData);
2264
2265 virtual ~UserCommandInteractionData() noexcept = default;
2266 };
2267
2268 /// Message command interacction data. \brief Message command interacction data.
2269 struct DiscordCoreAPI_Dll MessageCommandInteractionData {
2270 Snowflake targetId{};///< The target Message's id.
2271
2272 MessageCommandInteractionData() noexcept = default;
2273
2274 MessageCommandInteractionData(simdjson::ondemand::value jsonObjectData);
2275
2276 virtual ~MessageCommandInteractionData() noexcept = default;
2277 };
2278
2279 /// Component types. \brief Component types.
2280 enum class ComponentType : Uint8 {
2281 ActionRow = 1,///< A container for other components.
2282 Button = 2,///< A button object.
2283 SelectMenu = 3,///< A select menu for picking from choices.
2284 TextInput = 4///< A text input object
2285 };
2286
2287 /// Component Interaction data. \brief Component Interaction data.
2288 struct DiscordCoreAPI_Dll ComponentInteractionData {
2289 std::vector<String> values{};///< The values of the components.
2290 ComponentType componentType{};///< The type of component.
2291 String customId{};///< The custom id of the Interaction entity.
2292
2293 ComponentInteractionData() noexcept = default;
2294
2295 ComponentInteractionData(simdjson::ondemand::value jsonObjectData);
2296
2297 virtual ~ComponentInteractionData() noexcept = default;
2298 };
2299
2300 /// Modal interaction data, for inputs from text modals. \brief Modal interaction data, for inputs from text modals.
2301 struct DiscordCoreAPI_Dll ModalInteractionData {
2302 String customIdSmall{};///< The custom id of a particular modal input.
2303 String customId{};///< The custom id of the Interaction entity.
2304 String value{};///< The input value of the modal.
2305
2306 ModalInteractionData() noexcept = default;
2307
2308 ModalInteractionData(simdjson::ondemand::value jsonObjectData);
2309
2310 virtual ~ModalInteractionData() noexcept = default;
2311 };
2312
2313 /// Allowable mentions for a Message. \brief Allowable mentions for a Message.
2314 class DiscordCoreAPI_Dll AllowedMentionsData {
2315 public:
2316 std::vector<String> parse{};///< A vector of allowed mention types to parse from the content.
2317 std::vector<String> roles{};///< Array of role_ids to mention (Max size of 100)
2318 std::vector<String> users{};///< Array of user_ids to mention (Max size of 100)
2319 Bool repliedUser{ false };///< For replies, whether to mention the author of the Message being replied to (default false).
2320
2321 AllowedMentionsData() noexcept = default;
2322
2323 AllowedMentionsData(simdjson::ondemand::value jsonObjectData);
2324
2325 operator JsonObject();
2326
2327 virtual ~AllowedMentionsData() noexcept = default;
2328 };
2329
2330 /// Interaction types. \brief Interaction types.
2331 enum class InteractionType : Uint8 {
2332 Ping = 1,///< Ping.
2333 Application_Command = 2,///< Application command.
2334 Message_Component = 3,///< Message component.
2335 Application_Command_Autocomplete = 4,///< Application command autocomplete.
2336 Modal_Submit = 5///< Modal submission.
2337 };
2338
2339 /// Represents a single selection from a select-menu. \brief Represents a single selection from a select-menu.
2340 class DiscordCoreAPI_Dll SelectOptionData {
2341 public:
2342 String description{};///< Description of the select-menu-option.
2343 Bool _default{ false };///< Is it the default option?
2344 String label{};///< A visible label for the select-menu-option.
2345 String value{};///< A value for identifying the option.
2346 EmojiData emoji{};///< An optional emoji to put on it.
2347
2348 SelectOptionData() noexcept = default;
2349
2350 SelectOptionData(simdjson::ondemand::value jsonObjectData);
2351
2352 virtual ~SelectOptionData() noexcept = default;
2353 };
2354
2355 /// Button styles. \brief Button styles.
2356 enum class ButtonStyle : Uint8 {
2357 Primary = 1,///< Primary.
2358 Success = 3,///< Success.
2359 Secondary = 2,///< Secondary.
2360 Danger = 4,///< Danger.
2361 Link = 5///< Link.
2362 };
2363
2364 /// Represents a single Message-component. \brief Represents a single Message-component.
2365 struct DiscordCoreAPI_Dll ComponentData {
2366 std::vector<SelectOptionData> options{};///< Aray of select options the choices in the select, max 25.
2367 String placeholder{};///< Custom placeholder text if nothing is selected, max 100 characters.
2368 String customId{};///< A developer-defined identifier for the component, max 100 characters.
2369 Int32 minValues{ 0 };///< The minimum number of items that must be chosen; default 1, min 0, max 25.
2370 Int32 maxValues{ 0 };///< The maximum number of items that can be chosen; default 1, max 25.
2371 Bool disabled{ false };///< Whether the component is disabled, default false.
2372 Int32 minLength{ 0 };///< The minimum input length for a text input.
2373 Int32 maxLength{ 0 };///< The maximum input length for a text input.
2374 Bool required{ false };///< Whether this component is required to be filled.
2375 ComponentType type{};///< Integer component type.
2376 String label{};///< The label for this component.
2377 String value{};///< A pre-filled value for this component.
2378 String title{};///< Url, for url types.
2379 Int32 style{};///< One of ButtonStyle, or TextInputStyle.
2380 String url{};///< Url, for url types.
2381 EmojiData emoji{};///< Emoji name, id, and animated.
2382 ComponentData() noexcept = default;
2383 ComponentData(simdjson::ondemand::value);
2384 };
2385
2386 /// Action row data of Message components. \brief Action row data of Message components.
2387 class DiscordCoreAPI_Dll ActionRowData {
2388 public:
2389 std::vector<ComponentData> components{};///< Array of components to make up the action-row.
2390
2391 ActionRowData() noexcept = default;
2392
2393 operator JsonObject();
2394
2395 ActionRowData(simdjson::ondemand::value jsonObjectData);
2396
2397 virtual ~ActionRowData() noexcept = default;
2398 };
2399
2400 /// Interaction callback types. \brief Interaction callback types.
2401 enum class InteractionCallbackType : Uint8 {
2402 Pong = 1,///< ACK a Ping.
2403 Channel_Message_With_Source = 4,///< Respond to an interaction with a message.
2404 Deferred_Channel_Message_With_Source = 5,///< ACK an interaction and edit a response later, the user sees a loading state.
2405 Deferred_Update_Message = 6,///< For components, ACK an interaction and edit the original message later; the user does not see a loading state.
2406 Update_Message = 7,///< For components, edit the message the component was attached to.
2407 Application_Command_Autocomplete_Result = 8,///< Respond to an autocomplete interaction with suggested choices.
2408 Modal = 9///< Respond to an interaction with a popup modal.
2409 };
2410
2411 /// Interaction ApplicationCommand callback data. \brief Interaction ApplicationCommand callback data.
2412 struct DiscordCoreAPI_Dll InteractionCallbackData {
2413 std::vector<ApplicationCommandOptionChoiceData> choices{};///< Autocomplete choices(max of 25 choices).
2414 std::vector<AttachmentData> attachments{};///< Array of partial attachment objects attachment objects with filename and description.
2415 std::vector<ActionRowData> components{};///< Message components.
2416 AllowedMentionsData allowedMentions{};///< Allowed mentions data.
2417 std::vector<EmbedData> embeds{};///< Message embeds.
2418 std::vector<File> files{};///< Files for uploading.
2419 String customId{};///< A developer-defined identifier for the component, max 100 characters.
2420 String content{};///< Message content.
2421 String title{};///< The title of the popup modal.
2422 Int32 flags{ 0 };///< Flags.
2423 Bool tts{ false };///< Is it TTS?
2424 };
2425
2426 /// Data structure representing an ApplicationCommand. \brief Data structure representing an ApplicationCommand.
2427 class DiscordCoreAPI_Dll ApplicationCommandData : public DiscordEntity {
2428 public:
2429 std::unordered_map<String, String> descriptionLocalizations{};///< Dictionary with keys in available locales Localization dictionary for name field.
2430 std::unordered_map<String, String> nameLocalizations{};///< Dictionary with keys in available locales Localization dictionary for name field.
2431 std::vector<ApplicationCommandOptionData> options{};///< A vector of possible options for the current ApplicationCommand.
2432 Permissions defaultMemberPermissions{};///< Set of permissions represented as a bit set all
2433 ApplicationCommandType type{};///< The type of ApplicationCommand.
2434 Bool dmPermission{ false };///< Indicates whether the command is available in DMs with the app, only for globally - scoped commands.
2435 String description{};///< A description of the current ApplicationCommand.
2436 Snowflake applicationId{};///< The current application id.
2437 String version{};///< An autoincremented version.
2438 String name{};///< Name of the current ApplicationCommand.
2439 Snowflake guildId{};///< (Where applicable) a Guild id for which guild to assign this ApplicationCommand to.
2440
2441 ApplicationCommandData() noexcept = default;
2442
2443 ApplicationCommandData(simdjson::ondemand::value jsonObjectData);
2444
2445 virtual ~ApplicationCommandData() noexcept = default;
2446 };
2447
2448 /// Channel mention data. \brief Channel mention data.
2449 class DiscordCoreAPI_Dll ChannelMentionData : public DiscordEntity {
2450 public:
2451 Snowflake guildId{};///< The id of the Guild where it took place.
2452 String name{};///< The name of the Channel that was mentioned.
2453 ChannelType type{};///< The type of Channel that was mentioned.
2454
2455 ChannelMentionData() noexcept = default;
2456
2457 ChannelMentionData(simdjson::ondemand::value jsonObjectData);
2458
2459 virtual ~ChannelMentionData() noexcept = default;
2460 };
2461
2462 /// Data for when some Channel pins are updated. \brief Data for when some Channel pins are updated.
2463 struct DiscordCoreAPI_Dll ChannelPinsUpdateEventData {
2464 TimeStamp<std::chrono::milliseconds> lastPinTimeStamp{};///< The time of the last pinned Message.
2465 Snowflake channelId{};///< The id of the Channel within which the Message was pinned.
2466 Snowflake guildId{};///< The id of the Guild within which the Message was pinned.
2467
2468 ChannelPinsUpdateEventData() noexcept = default;
2469
2470 ChannelPinsUpdateEventData(simdjson::ondemand::value jsonObjectData);
2471
2472 virtual ~ChannelPinsUpdateEventData() noexcept = default;
2473 };
2474
2475 /// Data for when threads are synced. \brief Data for when threads are synced.
2476 struct DiscordCoreAPI_Dll ThreadListSyncData {
2477 std::vector<ThreadMemberData> members{};///< Array of members that are a part of the Thread.
2478 std::vector<String> channelIds{};///< The parent Channel ids whose threads are being synced. If omitted, then threads were synced for entire Guild.
2479 std::vector<ChannelData> threads{};///< All active threads in the given channels that the current User can access.
2480 Snowflake guildId{};///< The id of the Guild for which the threads are being synced.
2481
2482 ThreadListSyncData() noexcept = default;
2483
2484 ThreadListSyncData(simdjson::ondemand::value jsonObjectData);
2485
2486 virtual ~ThreadListSyncData() noexcept = default;
2487 };
2488
2489 /// Represents a Thread-members-update. \brief Represents a Thread-members-update.
2490 class DiscordCoreAPI_Dll ThreadMembersUpdateData : public DiscordEntity {
2491 public:
2492 std::vector<ThreadMemberData> addedMembers{};///< New members added to the Thread.
2493 std::vector<String> removedMemberIds{};///< Members who have been removed.
2494 Int32 memberCount{ 0 };///< Number of Guild-members in the Thread.
2495 Snowflake guildId{};///< Guild id of the Thread.
2496
2497 ThreadMembersUpdateData() noexcept = default;
2498
2499 ThreadMembersUpdateData(simdjson::ondemand::value jsonObjectData);
2500
2501 virtual ~ThreadMembersUpdateData() noexcept = default;
2502 };
2503
2504 /// Message Interaction data. \brief Message Interaction data.
2505 class DiscordCoreAPI_Dll MessageInteractionData : public DiscordEntity {
2506 public:
2507 GuildMemberData member{};
2508 InteractionType type{};
2509 String name{};
2510 UserData user{};
2511
2512 MessageInteractionData() noexcept = default;
2513
2514 MessageInteractionData(simdjson::ondemand::value jsonObjectData);
2515
2516 virtual ~MessageInteractionData() noexcept = default;
2517 };
2518
2519 /// Message types. \brief Message types.
2520 enum class MessageType : Uint8 {
2521 Default = 0,///< Default.
2522 Recipient_Add = 1,///< Recipient add.
2523 Recipient_Remove = 2,///< Recipient remove.
2524 Call = 3,///< Call.
2525 Channel_Name_Change = 4,///< Channel name change.
2526 Channel_Icon_Change = 5,///< Channel icon change.
2527 Channel_Pinned_Message = 6,///< Channel pinned Message.
2528 Guild_Member_Join = 7,///< Guild memeber join.
2529 User_Premium_Guild_Subscription = 8,///< User premium Guild subscription.
2530 User_Premium_Guild_Subscription_Tier_1 = 9,///< User premium Guild subscription tier 1.
2531 User_Premium_Guild_Subscription_Tier_2 = 10,///< User premium Guild subscription tier 2.
2532 User_Premium_Guild_Subscription_Tier_3 = 11,///< User premium Guild subscription tier 3.
2533 Channel_Follow_Add = 12,///< Channel follow add.
2534 Guild_Discovery_Disqualified = 14,///< Guild discovery disqualified.
2535 Guild_Discovery_Requalified = 15,///< Guild discovery requalified.
2536 Guild_Discovery_Grace_Period_Initial_Warning = 16,///< Guild discovery grade period initial warning.
2537 Guild_Discovery_Grace_Period_Final_Warning = 17,///< Guild discovery grade period final warning.
2538 Thread_Created = 18,///< Thread created.
2539 Reply = 19,///< Reply.
2540 Chat_Input_Command = 20,///< Chat input command.
2541 Thread_Starter_Message = 21,///< Thread starter Message.
2542 Guild_Invite_Reminder = 22,///< Guild invite reminder.
2543 Context_Menu_Command = 23///< Context menu command.
2544 };
2545
2546 /// Message flags. \brief Message flags.
2547 enum class MessageFlags : Uint8 {
2548 Crossposted = 1 << 0,///< Crossposted.
2549 Is_Crosspost = 1 << 1,///< Is crosspost.
2550 Suppress_Embeds = 1 << 2,///< Supress embeds.
2551 Source_Message_Deleted = 1 << 3,///< Source Message deleted.
2552 Urgent = 1 << 4,///< Urgent.
2553 Has_Thread = 1 << 5,///< Has Thread.
2554 Ephemeral = 1 << 6,///< Ephemeral.
2555 Loading = 1 << 7///< Loading.
2556 };
2557
2558 /// Sticker item types. \brief Sticker item types.
2559 enum class StickerItemType : Uint8 {
2560 Png = 1,///< Png.
2561 Apng = 2,///< Apng.
2562 Lottie = 3///< Lottie.
2563 };
2564
2565 /// Represents a forum thread message. \brief Represents a forum thread message.
2566 struct DiscordCoreAPI_Dll ForumThreadMessageData {
2567 std::vector<AttachmentData> attachments{};///< Array of partial attachment objects attachment objects with filename.
2568 std::vector<ActionRowData> components{};///< Array of message component objects the components to include with the message.
2569 AllowedMentionsData allowedMentions{};///< Allowed mention object allowed mentions for the message.
2570 std::vector<String> stickerIds{};///< Array of snowflakes IDs of up to 3 stickers in the server to send in the message.
2571 std::vector<EmbedData> embeds{};///< Array of embed objects embedded rich content (up to 6000 characters).
2572 std::vector<File> files{};///< File contents the contents of the file being sent one of content, file, embed(s), sticker_ids.
2573 String content{};///< The message contents (up to 2000 characters).
2574 Int32 flags{ 0 };///< Flags to be set for the message.
2575 };
2576
2577 /// Message Sticker item data. \brief Message Sticker item data.
2578 class DiscordCoreAPI_Dll StickerItemData : public DiscordEntity {
2579 public:
2580 StickerItemType formatType{};///< Message Sticker item type.
2581 String name{};///< The name of the Sticker.
2582
2583 StickerItemData() noexcept = default;
2584
2585 StickerItemData(simdjson::ondemand::value jsonObjectData);
2586
2587 virtual ~StickerItemData() noexcept = default;
2588 };
2589
2590 /// The core of a Message's data structure. \brief The core of a Message's data structure.
2591 class DiscordCoreAPI_Dll MessageDataOld : public DiscordEntity {
2592 public:
2593 TimeStamp<std::chrono::milliseconds> editedTimestamp{};///< The time at which it was edited.
2594 std::vector<ChannelMentionData> mentionChannels{};///< array of Channel mention data.
2595 TimeStamp<std::chrono::milliseconds> timestamp{};///< The timestamp of when the Message was created.
2596 std::vector<StickerItemData> stickerItems{};///< Array of Message Sticker item data.
2597 std::vector<AttachmentData> attachments{};///< Array of attachment data.
2598 MessageReferenceData messageReference{};///< Message reference data.
2599 std::vector<String> mentionRoles{};///< Vector of "mention roles" ids.
2600 std::vector<ActionRowData> components{};///< Array of action row data.
2601 std::vector<ReactionData> reactions{};//< Array of reaction data.
2602 MessageInteractionData interaction{};///< Message Interaction data.
2603 std::vector<StickerData> stickers{};///< Array of Message Sticker data.
2604 std::vector<UserData> mentions{};///< Array of User data, for individual's that were mentioned.
2605 std::vector<EmbedData> embeds{};///< Array of Message embeds.
2606 MessageActivityData activity{};///< Message activity data.
2607 Bool mentionEveryone{ false };///< Does the Message mention everyone?
2608 ApplicationData application{};///< Application data.
2609 Snowflake applicationId{};///< Application id.
2610 GuildMemberData member{};///< The author's Guild member data.
2611 String content{};///< The Message's content.
2612 Snowflake channelId{};///< The Channel it was sent in.
2613 Snowflake webHookId{};///< WebHook id of the Message, if applicable.
2614 Bool pinned{ false };///< Is it pinned?
2615 ChannelData thread{};///< The Thread that the Message was sent in, if applicable.
2616 String nonce{};///< Nonce.
2617 Snowflake guildId{};///< The id of the Guild the Message was sent in.
2618 Int32 flags{ 0 };///< Flags.
2619 MessageType type{};///< Message type.
2620 UserData author{};///< The author's User data.
2621 Bool tts{ false };///< Is it a text-to-speech Message?
2622
2623 MessageDataOld() noexcept = default;
2624
2625 MessageDataOld(simdjson::ondemand::value jsonObjectData);
2626
2627 virtual ~MessageDataOld() noexcept = default;
2628 };
2629
2630 /// Data structure representing a single Message. \brief Data structure representing a single Message.
2631 class DiscordCoreAPI_Dll MessageData : public MessageDataOld {
2632 public:
2633 std::unique_ptr<MessageDataOld> referencedMessage{ std::make_unique<MessageDataOld>() };///< The referenced Message, to reply to.
2634
2635 MessageData& operator=(const MessageData& other);
2636
2637 MessageData(const MessageData& other);
2638
2639 MessageData() noexcept = default;
2640
2641 MessageData(simdjson::ondemand::value jsonObjectData);
2642
2643 virtual ~MessageData() noexcept = default;
2644 };
2645
2646 /// Resolved data. \brief Resolved data.
2647 struct DiscordCoreAPI_Dll ResolvedData {
2648 std::unordered_map<Uint64, AttachmentData> attachments{};///< Map of Snowflakes to attachment objects the ids and attachment objects.
2649 std::unordered_map<Uint64, GuildMemberData> members{};///< Map full of GuildMemeberData.
2650 std::unordered_map<Uint64, MessageData> messages{};///< Map full of messageData->
2651 std::unordered_map<Uint64, ChannelData> channels{};///< Map full of ChannelData.
2652 std::unordered_map<Uint64, UserData> users{};///< Map full of UserData.
2653 std::unordered_map<Uint64, RoleData> roles{};///< Map full of RoleData.
2654
2655 ResolvedData() noexcept = default;
2656
2657 ResolvedData(simdjson::ondemand::value jsonObjectData);
2658 };
2659
2660 /// Represents a Sticker pack. \brief Represents a Sticker pack.
2661 struct DiscordCoreAPI_Dll StickerPackData {
2662 std::vector<StickerData> stickers{};///< Array of Sticker objects the stickers in the pack.
2663 String coverStickerId{};///< Id of a Sticker in the pack which is shown as the pack's icon.
2664 String bannerAssetId{};///< Id of the Sticker pack's banner image.
2665 String description{};///< Description of the Sticker pack.
2666 String skuId{};///< Id of the pack's SKU.
2667 String name{};///< Name of the Sticker pack.
2668 Snowflake Id{};///< Id of the Sticker pack.
2669
2670 StickerPackData() noexcept = default;
2671
2672 StickerPackData(simdjson::ondemand::value jsonObjectData);
2673
2674 virtual ~StickerPackData() noexcept = default;
2675 };
2676
2677 class DiscordCoreAPI_Dll StickerPackDataVector {
2678 public:
2679 StickerPackDataVector() noexcept = default;
2680
2681 operator std::vector<StickerPackData>();
2682
2683 StickerPackDataVector(simdjson::ondemand::value jsonObjectData);
2684
2685 virtual ~StickerPackDataVector() noexcept = default;
2686
2687 protected:
2688 std::vector<StickerPackData> theStickerPackDatas{};
2689 };
2690
2691 /// Connection visibility types. \brief Connection visibility types.
2692 enum class ConnectionVisibilityTypes : Uint8 {
2693 None = 0,///< None.
2694 Everyone = 1///< Everyone.
2695 };
2696
2697 /// Represents a single User Connection. \brief Represents a single User Connection.
2698 struct DiscordCoreAPI_Dll ConnectionData {
2699 std::vector<IntegrationData> integrations{};///< An array of partial server integrations.
2700 ConnectionVisibilityTypes visibility{};///< Visibility of this connection.
2701 Bool showActivity{ false };///< Whether activities related to this connection will be shown in presence updates.
2702 Bool friendSync{ false };///< Whether friend sync is enabled for this connection.
2703 Bool verified{ false };///< Whether the connection is verified.
2704 Bool revoked{ false };///< Whether the connection is revoked.
2705 String name{};///< The userName of the connection account.
2706 String type{};///< The service of the connection(twitch, youtube).
2707 Snowflake id{};///< Id of the connection account.
2708
2709 ConnectionData() noexcept = default;
2710
2711 ConnectionData(simdjson::ondemand::value jsonObjectData);
2712
2713 virtual ~ConnectionData() noexcept = default;
2714 };
2715
2716 class DiscordCoreAPI_Dll ConnectionDataVector {
2717 public:
2718 ConnectionDataVector() noexcept = default;
2719
2720 ConnectionDataVector(simdjson::ondemand::value jsonObjectData) noexcept;
2721
2722 operator std::vector<ConnectionData>();
2723
2724 virtual ~ConnectionDataVector() noexcept = default;
2725
2726 protected:
2727 std::vector<ConnectionData> theConnectionDatas{};
2728 };
2729
2730 /// ApplicationCommand Interaction data option. \brief ApplicationCommand Interaction data option.
2732 std::vector<ApplicationCommandInteractionDataOption> options{};///< ApplicationCommand Interaction data options.
2733 ApplicationCommandOptionType type{};///< The type of ApplicationCommand options.
2734 JsonStringValue value{};///< The value if it's an Int32.
2735 Bool focused{ false };///< True if this option is the currently focused option for autocomplete.
2736 String name{};///< The name of the current option.
2737
2738 ApplicationCommandInteractionDataOption() noexcept = default;
2739
2740 ApplicationCommandInteractionDataOption(simdjson::ondemand::value jsonObjectData);
2741
2742 virtual ~ApplicationCommandInteractionDataOption() noexcept = default;
2743 };
2744
2745 /// ApplicationCommand Interaction data. \brief ApplicationCommand Interaction data.
2746 class DiscordCoreAPI_Dll ApplicationCommandInteractionData : public DiscordEntity {
2747 public:
2748 std::vector<ApplicationCommandInteractionDataOption> options{};///< ApplicationCommand Interaction data options.
2749 ApplicationCommandType type{};///< The type of ApplicationCommand.
2750 ResolvedData resolved{};///< Resolved data.
2751 Snowflake guildId{};///< The guild that the command took place in.
2752 String name{};///< The name of the command.
2753
2754 ApplicationCommandInteractionData() noexcept = default;
2755
2756 ApplicationCommandInteractionData(simdjson::ondemand::value jsonObjectData);
2757
2758 virtual ~ApplicationCommandInteractionData() noexcept = default;
2759 };
2760
2761 /// Interaction data data. \brief Interaction data data.
2762 struct DiscordCoreAPI_Dll InteractionDataData {
2763 ApplicationCommandInteractionData applicationCommandData{};///< ApplicationCommand Interaction data.
2764 MessageCommandInteractionData messageInteractionData{};///< Message command Interaction data.
2765 UserCommandInteractionData userInteractionData{};///< User command Interaction data.
2766 ComponentInteractionData componentData{};///< Component Interaction data.
2767 ModalInteractionData modalData{};///< Modal Interaction data.
2768
2769 InteractionDataData() noexcept = default;
2770
2771 InteractionDataData(simdjson::ondemand::value jsonObjectData);
2772
2773 virtual ~InteractionDataData() noexcept = default;
2774 };
2775
2776 /// Interaction data. \brief Interaction data.
2777 class DiscordCoreAPI_Dll InteractionData : public DiscordEntity {
2778 public:
2779 Permissions appPermissions{};///< Bitwise set of permissions the app or bot has within the channel the interaction was sent from.
2780 InteractionDataData data{};///< The Interaction's data.
2781 String guildLocale{};///< The guild's preferred locale, if invoked in a guild.
2782 Snowflake applicationId{};///< The application's id.
2783 GuildMemberData member{};///< The data of the Guild member who sent the Interaction, if applicable.
2784 InteractionType type{};///< The type of Interaction.
2785 MessageData message{};///< The Message that the Interaction came through on, if applicable.
2786 Snowflake channelId{};///< The Channel the Interaction was sent in.
2787 Int32 version{ 0 };///< The Interaction version.
2788 String locale{};///< The selected language of the invoking user.
2789 String token{};///< The Interaction token.
2790 Snowflake guildId{};///< The Guild id of the Guild it was sent in.
2791 UserData user{};///< The User data of the sender of the Interaction.
2792
2793 InteractionData() noexcept = default;
2794
2795 InteractionData(simdjson::ondemand::value jsonObjectData);
2796
2797 virtual ~InteractionData() noexcept = default;
2798 };
2799
2800 /// Data from the SessionStart info. \brief Data from the SessionStart info.
2801 struct DiscordCoreAPI_Dll SessionStartData {
2802 Uint32 maxConcurrency{ 0 };///< The number of identify requests allowed per 5 seconds.
2803 Uint32 resetAfter{ 0 };///< The number of std::chrono::milliseconds after which the limit resets.
2804 Uint32 remaining{ 0 };///< The remaining number of session starts the current User is allowed.
2805 Uint32 total{ 0 };///< The total number of session starts the current User is allowed.
2806
2807 SessionStartData() noexcept = default;
2808
2809 SessionStartData(simdjson::ondemand::value jsonObjectData);
2810
2811 virtual ~SessionStartData() noexcept = default;
2812 };
2813
2814 /// Data from the GetGatewayBot endpoint. \brief Data from the GetGatewayBot endpoint.
2815 struct DiscordCoreAPI_Dll GatewayBotData {
2816 SessionStartData sessionStartLimit{};///< Information on the current session start limit.
2817 Uint32 shards{ 0 };///< The recommended number of shards to use when connecting.
2818 String url{};///< The WSS Url that can be used for connecting to the gateway.
2819
2820 GatewayBotData() noexcept = default;
2821
2822 GatewayBotData(simdjson::ondemand::value jsonObjectData);
2823
2824 virtual ~GatewayBotData() noexcept = default;
2825 };
2826
2827 /// Text input style for modals. \brief Text input style for modals.
2828 enum class TextInputStyle : Uint8 {
2829 Short = 1,///< A single-line input.
2830 Paragraph = 2///< A multi-line input.
2831 };
2832
2833 /// Data representing a Guild Emoji Update event. \brief Data representing a Guild Emoji Update event.
2834 struct DiscordCoreAPI_Dll GuildEmojisUpdateEventData {
2835 std::vector<EmojiData> emojis{};
2836 Snowflake guildId{};
2837
2838 GuildEmojisUpdateEventData() noexcept = default;
2839
2840 GuildEmojisUpdateEventData(simdjson::ondemand::value jsonObjectData);
2841
2842 virtual ~GuildEmojisUpdateEventData() noexcept = default;
2843 };
2844
2845 /// Data representing a Guild Sticker Update event. \brief Data representing a Guild Stickers Update event.
2846 struct DiscordCoreAPI_Dll GuildStickersUpdateEventData {
2847 std::vector<StickerData> stickers{};
2848 Snowflake guildId{};
2849
2850 GuildStickersUpdateEventData() noexcept = default;
2851
2852 GuildStickersUpdateEventData(simdjson::ondemand::value jsonObjectData);
2853
2854 virtual ~GuildStickersUpdateEventData() noexcept = default;
2855 };
2856
2857 struct DiscordCoreAPI_Dll GuildMembersChunkEventData {
2858 std::vector<PresenceUpdateData> presences{};
2859 std::vector<GuildMemberData> members{};
2860 std::vector<String> notFound{};
2861 Int32 chunkIndex{ 0 };
2862 Int32 chunkCount{ 0 };
2863 String nonce{};
2864 Snowflake guildId{};
2865
2866 GuildMembersChunkEventData() noexcept = default;
2867
2868 GuildMembersChunkEventData(simdjson::ondemand::value jsonObjectData);
2869
2870 virtual ~GuildMembersChunkEventData() noexcept = default;
2871 };
2872
2873 /// Data representing an input-event, which is any Message or Interaction that is coming into the bot as an input. \brief Data representing an input-event, which is any Message or Interaction that is coming into the bot as an input.
2874 class DiscordCoreAPI_Dll InputEventData {
2875 public:
2876 friend struct OnInteractionCreationData;
2877 friend struct BaseFunctionArguments;
2878
2879 friend class DiscordCoreInternal::WebSocketSSLShard;
2880 friend class DiscordCoreInternal::BaseSocketAgent;
2881 friend class RespondToInputEventData;
2882 friend class DiscordCoreClient;
2883 friend class CommandData;
2884 friend class InputEvents;
2885
2886 InputEventResponseType responseType{};///< The type of response that this input value represents.
2887
2888 InputEventData& operator=(InputEventData&& other) noexcept;
2889
2890 InputEventData(InputEventData&& other) noexcept;
2891
2892 InputEventData& operator=(const InputEventData& other) noexcept;
2893
2894 InputEventData(const InputEventData& other) noexcept;
2895
2896 InputEventData& operator=(const InteractionData& other) noexcept;
2897
2898 InputEventData(const InteractionData& interactionData) noexcept;
2899
2900 InputEventData() noexcept = default;
2901
2902 /// Returns the userName of the last User to trigger this input-event. \brief Returns the userName of the last User to trigger this input-event.
2903 /// \returns String A string containing the User name.
2904 String getUserName() const;
2905
2906 /// Gets the avatar Url of the last User to trigger this input-event. \brief Gets the avatar Url of the last User to trigger this input-event.
2907 /// \returns String A string containing the avatar Url.
2908 String getAvatarUrl() const;
2909
2910 /// Returns the Message embeds that are on the Message, if applicable. \brief Returns the Message embeds that are on the Message, if applicable.
2911 /// \returns std::vector A vector containing the EmbedData.
2912 std::vector<EmbedData> getEmbeds() const;
2913
2914 /// Returns the Message components that are on the Message, if applicable. \brief Returns the Message components that are on the Message, if applicable.
2915 /// \returns std::vector A vector containing ActionRowData.
2916 std::vector<ActionRowData> getComponents() const;
2917
2918 /// Returns the User id of the last requester of this input-event. \brief Returns the User id of the last requester of this input-event.
2919 /// \returns Snowflake A Snowflake containing the author's id.
2920 Snowflake getAuthorId() const;
2921
2922 /// Returns the Interaction id, if appplicable, of this input-event. \brief Returns the Interaction id, if appplicable, of this input-event.
2923 /// \returns Snowflake A Snowflake containing the Interaction id.
2924 Snowflake getInteractionId() const;
2925
2926 /// Returns the application id. \brief Returns the application id.
2927 /// \returns Snowflake A Snowflake containing the application id.
2928 Snowflake getApplicationId() const;
2929
2930 /// Returns the Channel id of this input-event. \brief Returns the Channel id of this input-event.
2931 /// \returns Snowflake A Snowflake containing the Channel id.
2932 Snowflake getChannelId() const;
2933
2934 /// Returns the Interaction token, if applicable, of this input-event. \brief Returns the Interaction token, if applicable, of this input-event.
2935 /// \returns String A string containing the Interaction token.
2936 String getInteractionToken() const;
2937
2938 /// Returns the Guild id, of this input-event. \brief Returns the Guild id, of this input-event.
2939 /// \returns Snowflake A Snowflake containing the Guild id.
2940 Snowflake getGuildId() const;
2941
2942 /// Returns the Message id, if applicable, of this input-event. \brief Returns the Message id, if applicable, of this input-event.
2943 /// \returns Snowflake A Snowflake containing the Message id.
2944 Snowflake getMessageId() const;
2945
2946 /// Returns the Interaction data, if applicable, of this input-event. \brief Returns the InteractionData, if applicable, of this input-event.
2947 /// \returns InteractionData An InteractionData structure.
2948 InteractionData getInteractionData() const;
2949
2950 /// Returns the Message data, if applicable, of this input-event. \brief Returns the Message data, if applicable, of this input-event.
2951 /// \returns MessageData A MessageData structure.
2952 MessageData getMessageData() const;
2953
2954 virtual ~InputEventData() noexcept = default;
2955
2956 protected:
2957 std::unique_ptr<InteractionData> interactionData{ std::make_unique<InteractionData>() };
2958 };
2959
2960 /// \brief Data for responding to an input-event.
2961 class DiscordCoreAPI_Dll RespondToInputEventData {
2962 public:
2963 friend struct DeleteInteractionResponseData;
2964 friend struct DeleteFollowUpMessageData;
2965 friend struct InteractionResponseData;
2966
2970 friend class CreateInteractionResponseData;
2971 friend class EditInteractionResponseData;
2972 friend class CreateFollowUpMessageData;
2973 friend class EditFollowUpMessageData;
2974 friend class CreateMessageData;
2975 friend class EditMessageData;
2976 friend class InputEvents;
2977 friend class SendDMData;
2978
2979 RespondToInputEventData& operator=(const InteractionData& dataPackage);
2980
2981 RespondToInputEventData(const InteractionData& dataPackage);
2982
2983 RespondToInputEventData& operator=(const InputEventData& dataPackage);
2984
2985 RespondToInputEventData(const InputEventData& dataPackage);
2986
2987 /// Adds a button to the response Message. \brief Adds a button to the response Message.
2988 /// \param disabled Whether the button is active or not.
2989 /// \param customIdNew A custom id to give for identifying the button.
2990 /// \param buttonLabel A visible label for the button.
2991 /// \param buttonStyle The style of the button.
2992 /// \param emojiName An emoji name, if desired.
2993 /// \param emojiId An emoji id, if desired.
2994 /// \param url A url, if applicable.
2995 /// \returns RespondToInputEventData& A reference to this data structure.
2996 RespondToInputEventData& addButton(Bool disabled, const String& customIdNew, const String& buttonLabel, ButtonStyle buttonStyle, const String& emojiName = "",
2997 Snowflake emojiId = Snowflake{ 0 }, const String& url = "");
2998
2999 /// Adds a select-menu to the response Message. \brief Adds a select-menu to the response Message.
3000 /// \param disabled Whether the select-menu is active or not.
3001 /// \param customIdNew A custom id to give for identifying the select-menu.
3002 /// \param options A vector of select-menu-options to offer.
3003 /// \param placeholder Custom placeholder text if nothing is selected, max 100 characters.
3004 /// \param maxValues Maximum number of selections that are possible.
3005 /// \param minValues Minimum required number of selections that are required.
3006 /// \returns RespondToInputEventData& A reference to this data structure.
3007 RespondToInputEventData& addSelectMenu(Bool disabled, const String& customIdNew, std::vector<SelectOptionData> options, const String& placeholder, Int32 maxValues,
3008 Int32 minValues);
3009
3010 /// Adds a modal to the response Message. \brief Adds a modal to the response Message.
3011 /// \param topTitleNew A title for the modal.
3012 /// \param topCustomIdNew A custom id to give for the modal.
3013 /// \param titleNew A title for the modal's individual input.
3014 /// \param customIdNew A custom id to give for the modal's individual input.
3015 /// \param required Is it a required response?
3016 /// \param minLength Minimum length.
3017 /// \param maxLength Maximum length.
3018 /// \param inputStyle The input style.
3019 /// \param label A label for the modal.
3020 /// \param placeholder A placeholder for the modal.
3021 /// \returns RespondToInputEventData& A reference to this data structure.
3022 RespondToInputEventData& addModal(const String& topTitleNew, const String& topCustomIdNew, const String& titleNew, const String& customIdNew, Bool required,
3023 Int32 minLength, Int32 maxLength, TextInputStyle inputStyle, const String& label = "", const String& placeholder = "");
3024
3025 /// Adds a file to the current collection of files for this message response. \brief Adds a file to the current collection of files for this message response.
3026 /// \param theFile The file to be added.
3027 /// \returns RespondToInputEventData& A reference to this data structure.
3028 RespondToInputEventData& addFile(File theFile);
3029
3030 /// For setting the allowable mentions in a response. \brief For setting the allowable mentions in a response.
3031 /// \param dataPackage An AllowedMentionsData structure.
3032 /// \returns RespondToInputEventData& A reference to this data structure.
3033 RespondToInputEventData& addAllowedMentions(AllowedMentionsData dataPackage);
3034
3035 /// For setting the type of response to make. \brief For setting the type of response to make.
3036 /// \param typeNew An InputEventResponseType.
3037 /// \returns RespondToInputEventData& A reference to this data structure.
3038 RespondToInputEventData& setResponseType(InputEventResponseType typeNew);
3039
3040 /// For setting the components in a response. \brief For setting the components in a response.
3041 /// \param dataPackage An ActionRowData structure.
3042 /// \returns RespondToInputEventData& A reference to this data structure.
3043 RespondToInputEventData& addComponentRow(ActionRowData dataPackage);
3044
3045 /// For setting the embeds in a response. \brief For setting the embeds in a response.
3046 /// \param dataPackage An EmbedData structure.
3047 /// \returns RespondToInputEventData& A reference to this data structure.
3048 RespondToInputEventData& addMessageEmbed(EmbedData dataPackage);
3049
3050 /// For setting the Message content in a response. \brief For setting the Message content in a response.
3051 /// \param dataPackage A string, containing the content.
3052 /// \returns RespondToInputEventData& A reference to this data structure.
3053 RespondToInputEventData& addContent(const String& dataPackage);
3054
3055 /// For setting the tts status of a response. \brief For setting the tts status of a response.
3056 /// \param enabledTTs A Bool.
3057 /// \returns RespondToInputEventData& A reference to this data structure.
3058 RespondToInputEventData& setTTSStatus(Bool enabledTTs);
3059
3060 /// For setting the choices of an autocomplete response. \brief For setting the choices of an autocomplete response.
3061 /// \param theValue An simdjson::ondemand::object value that is either a Float, Int32 or a string.
3062 /// \param theName A string for the name of the choice.
3063 /// \param theNameLocalizations A std::unordered_map<String, String> for the name localizations.
3064 /// \returns RespondToInputEventData& A reference to this data structure.
3065 RespondToInputEventData& setAutoCompleteChoice(simdjson::ondemand::object theValue, const String& theName, std::unordered_map<String, String> theNameLocalizations);
3066
3067 /// For setting the direct-Message User target of a response. \brief For setting the direct-Message User target of a response.
3068 /// \param targetUserIdNew A string, containing the target User's id.
3069 /// \returns RespondToInputEventData& A reference to this data structure.
3070 RespondToInputEventData& setTargetUserID(const Snowflake targetUserIdNew);
3071
3072 protected:
3073 std::vector<ApplicationCommandOptionChoiceData> choices{};
3074 std::vector<ActionRowData> components{};
3075 AllowedMentionsData allowedMentions{};
3076 std::vector<EmbedData> embeds{};
3077 String interactionToken{};
3078 InputEventResponseType type{};///< The type of response to make.
3079 InteractionType eventType{};
3080 std::vector<File> files{};
3081 Snowflake interactionId{};
3082 Snowflake applicationId{};
3083 Snowflake targetUserId{};
3084 String customId{};
3085 String content{};
3086 Snowflake channelId{};
3087 Snowflake messageId{};
3088 String title{};
3089 Int32 flags{ 0 };
3090 Bool tts{ false };
3091 };
3092
3093 /// Message response base, for responding to messages. \brief Message response base, for responding to messages.
3094 class DiscordCoreAPI_Dll MessageResponseBase {
3095 public:
3096 /// Adds a button to the response Message. \brief Adds a button to the response Message.
3097 /// \param disabled Whether the button is active or not.
3098 /// \param customIdNew A custom id to give for identifying the button.
3099 /// \param buttonLabel A visible label for the button.
3100 /// \param buttonStyle The style of the button.
3101 /// \param emojiName An emoji name, if desired.
3102 /// \param emojiId An emoji id, if desired.
3103 /// \param url A url, if applicable.
3104 /// \returns MessageResponseBase& A reference to this data structure.
3105 MessageResponseBase& addButton(Bool disabled, const String& customIdNew, const String& buttonLabel, ButtonStyle buttonStyle, const String& emojiName = "",
3106 Snowflake emojiId = Snowflake{ 0 }, const String& url = "");
3107
3108 /// Adds a select-menu to the response Message. \brief Adds a select-menu to the response Message.
3109 /// \param disabled Whether the select-menu is active or not.
3110 /// \param customIdNew A custom id to give for identifying the select-menu.
3111 /// \param options A vector of select-menu-options to offer.
3112 /// \param placeholder Custom placeholder text if nothing is selected, max 100 characters.
3113 /// \param maxValues Maximum number of selections that are possible.
3114 /// \param minValues Minimum required number of selections that are required.
3115 /// \returns MessageResponseBase& A reference to this data structure.
3116 MessageResponseBase& addSelectMenu(Bool disabled, const String& customIdNew, std::vector<SelectOptionData> options, const String& placeholder, Int32 maxValues,
3117 Int32 minValues);
3118
3119 /// Adds a modal to the response Message. \brief Adds a modal to the response Message.
3120 /// \param topTitleNew A title for the modal.
3121 /// \param topCustomIdNew A custom id to give for the modal.
3122 /// \param titleNew A title for the modal's individual input.
3123 /// \param customIdNew A custom id to give for the modal's individual input.
3124 /// \param required Is it a required response?
3125 /// \param minLength Minimum length.
3126 /// \param maxLength Maximum length.
3127 /// \param inputStyle The input style.
3128 /// \param label A label for the modal.
3129 /// \param placeholder A placeholder for the modal.
3130 /// \returns MessageResponseBase& A reference to this data structure.
3131 MessageResponseBase& addModal(const String& topTitleNew, const String& topCustomIdNew, const String& titleNew, const String& customIdNew, Bool required, Int32 minLength,
3132 Int32 maxLength, TextInputStyle inputStyle, const String& label = "", const String& placeholder = "");
3133
3134 /// Adds a file to the current collection of files for this message response. \brief Adds a file to the current collection of files for this message response.
3135 /// \param theFile The file to be added.
3136 /// \returns MessageResponseBase& A reference to this data structure.
3137 MessageResponseBase& addFile(File theFile);
3138
3139 /// For setting the allowable mentions in a response. \brief For setting the allowable mentions in a response.
3140 /// \param dataPackage An AllowedMentionsData structure.
3141 /// \returns MessageResponseBase& A reference to this data structure.
3142 MessageResponseBase& addAllowedMentions(AllowedMentionsData dataPackage);
3143
3144 /// For setting the components in a response. \brief For setting the components in a response.
3145 /// \param dataPackage An ActionRowData structure.
3146 /// \returns MessageResponseBase& A reference to this data structure.
3147 MessageResponseBase& addComponentRow(ActionRowData dataPackage);
3148
3149 /// For setting the embeds in a response. \brief For setting the embeds in a response.
3150 /// \param dataPackage An EmbedData structure.
3151 /// \returns MessageResponseBase& A reference to this data structure.
3152 MessageResponseBase& addMessageEmbed(EmbedData dataPackage);
3153
3154 /// For setting the Message content in a response. \brief For setting the Message content in a response.
3155 /// \param dataPackage A string, containing the content.
3156 /// \returns MessageResponseBase& A reference to this data structure.
3157 MessageResponseBase& addContent(const String& dataPackage);
3158
3159 /// For setting the tts status of a response. \brief For setting the tts status of a response.
3160 /// \param enabledTTs A Bool.
3161 /// \returns MessageResponseBase& A reference to this data structure.
3162 MessageResponseBase& setTTSStatus(Bool enabledTTs);
3163
3164 protected:
3165 std::vector<ActionRowData> components{};
3166 AllowedMentionsData allowedMentions{};
3167 std::vector<EmbedData> embeds{};
3168 std::vector<File> files{};
3169 String customId{};
3170 String content{};
3171 String title{};
3172 Int32 flags{ 0 };
3173 Bool tts{ false };
3174 };
3175
3176 /// Interaction response data. \brief Interaction response data.
3177 struct DiscordCoreAPI_Dll InteractionResponseData {
3178 InteractionResponseData& operator=(const RespondToInputEventData& other);
3179
3181
3182 InteractionResponseData() noexcept = default;
3183
3184 operator JsonObject();
3185
3186 InteractionCallbackData data{};///< Interaction ApplicationCommand callback data.
3187 InteractionCallbackType type{};///< Interaction callback type.
3188 };
3189
3190 /// Guild application command permissions data. \brief Guild application command permissions data.
3191 class DiscordCoreAPI_Dll GuildApplicationCommandPermissionData : public DiscordEntity {
3192 public:
3193 std::vector<ApplicationCommandPermissionData> permissions{};
3194 Snowflake applicationId{};
3195 Snowflake guildId{};
3196
3197 virtual ~GuildApplicationCommandPermissionData() noexcept = default;
3198 };
3199
3200 /**@}*/
3201
3202 /// Song types. \brief Song types.
3203 enum class SongType : Uint8 {
3204 YouTube = 0,///< YouTube.
3205 SoundCloud = 1///< SoundCloud.
3206 };
3207
3208 /// Represents a download Url. \brief Represents a download Url.
3209 struct DiscordCoreAPI_Dll DownloadUrl {
3210 Int32 contentSize{ 0 };
3211 String urlPath{};
3212 };
3213
3214 /**
3215 * \addtogroup voice_connection
3216 * @{
3217 */
3218
3219 struct DiscordCoreAPI_Dll MediaTranscoding {
3220 MediaTranscoding() noexcept = default;
3221 MediaTranscoding(simdjson::ondemand::value);
3222 String thePreset{};
3223 String theUrl{};
3224 };
3225
3226 /// A song from the various platforms. \brief A song from the various platforms.
3227 class DiscordCoreAPI_Dll Song {
3228 public:
3229 friend class DiscordCoreInternal::SoundCloudRequestBuilder;
3230 friend class DiscordCoreInternal::YouTubeRequestBuilder;
3231 friend class DiscordCoreInternal::SoundCloudAPI;
3232 friend class DiscordCoreInternal::YouTubeAPI;
3233 friend class SongAPI;
3234
3235 std::vector<DownloadUrl> finalDownloadUrls{};
3236 SongType type{ SongType::SoundCloud };///< The type of song.
3237 String secondDownloadUrl{};
3238 String firstDownloadUrl{};
3239 String html5PlayerFile{};
3240 String addedByUserName{};///< The User name of the individual who added this Song to the playlist.
3241 String thumbnailUrl{};///< The Url of the thumbnail image of this Song.
3242 Uint64 contentLength{ 0 };
3243 String html5Player{};
3244 String description{};///< A description of the Song.
3245 Snowflake addedByUserId{};///< The User id of the individual who added this Song to the playlist.
3246 String songTitle{};///< The title of the Song.
3247 String duration{};///< The duration of the Song.
3248 String viewUrl{};///< The url for listening to this Song through a browser.
3249 String songId{};
3250
3251 Song() noexcept = default;
3252
3253 Song(simdjson::ondemand::value jsonObjectData);
3254
3255 virtual ~Song() noexcept = default;
3256
3257 protected:
3258 String trackAuthorization{};
3259 Bool doWeGetSaved{ false };
3260 YouTubeFormat format{};
3261 };
3262
3263 /// Song completion event data. \brief Song completion event data.
3264 struct DiscordCoreAPI_Dll SongCompletionEventData {
3265 GuildMemberData guildMember{};///< The sending GuildMember.
3266 Bool wasItAFail{ false };///< Is this a replay? (Did a track recently fail to play?)
3267 Song previousSong{};///< The previously played Song.
3268 GuildData guild{};///< The sending Guild.
3269 };
3270
3271 /// Playlist of songs and other variables. \brief Playlist of songs and other variables.
3272 struct DiscordCoreAPI_Dll Playlist {
3273 Bool isLoopSongEnabled{ false };///< Is looping of Songs currently enabled?
3274 Bool isLoopAllEnabled{ false };///< Is looping of the entire Playlist currently enabled?
3275 std::vector<Song> songQueue{};///< The list of Songs that are stored to be played.
3276 Song currentSong{};///< The current Song that is playing.
3277 };
3278
3279 /**@}*/
3280
3281 /**
3282 * \addtogroup utilities
3283 * @{
3284 */
3285
3286 struct DiscordCoreAPI_Dll JsonObjectValue {
3287 std::unordered_map<String, JsonStringValue> theValues{};
3288 };
3289
3290 template<typename ReturnType> auto getArgument(JsonObjectValue& optionsArgs, StringView theArgName);
3291
3292 template<> inline auto getArgument<Int64>(JsonObjectValue& optionsArgs, StringView theArgName) {
3293 auto theValue = optionsArgs.theValues[theArgName.data()];
3294 switch (theValue.theType) {
3295 case ValueType::Int64: {
3296 return stoll(theValue.theValue);
3297 }
3298 }
3299 return 0ll;
3300 }
3301
3302 template<> inline auto getArgument<Int32>(JsonObjectValue& optionsArgs, StringView theArgName) {
3303 auto theValue = optionsArgs.theValues[theArgName.data()];
3304 switch (theValue.theType) {
3305 case ValueType::Int64: {
3306 return static_cast<Int32>(stoll(theValue.theValue));
3307 }
3308 }
3309 return 0;
3310 }
3311
3312 template<> inline auto getArgument<Int16>(JsonObjectValue& optionsArgs, StringView theArgName) {
3313 auto theValue = optionsArgs.theValues[theArgName.data()];
3314 switch (theValue.theType) {
3315 case ValueType::Int64: {
3316 return static_cast<Int16>(stoll(theValue.theValue));
3317 }
3318 }
3319 return static_cast<Int16>(0);
3320 }
3321
3322 template<> inline auto getArgument<Int8>(JsonObjectValue& optionsArgs, StringView theArgName) {
3323 auto theValue = optionsArgs.theValues[theArgName.data()];
3324 switch (theValue.theType) {
3325 case ValueType::Int64: {
3326 return static_cast<Int8>(stoll(theValue.theValue));
3327 }
3328 }
3329 return static_cast<Int8>(0);
3330 }
3331
3332 template<> inline auto getArgument<Uint64>(JsonObjectValue& optionsArgs, StringView theArgName) {
3333 auto theValue = optionsArgs.theValues[theArgName.data()];
3334 switch (theValue.theType) {
3335 case ValueType::Uint64: {
3336 return stoull(theValue.theValue);
3337 }
3338 }
3339 return 0ull;
3340 }
3341
3342 template<> inline auto getArgument<Uint32>(JsonObjectValue& optionsArgs, StringView theArgName) {
3343 auto theValue = optionsArgs.theValues[theArgName.data()];
3344 switch (theValue.theType) {
3345 case ValueType::Uint64: {
3346 return static_cast<Uint32>(stoull(theValue.theValue));
3347 }
3348 }
3349 return static_cast<Uint32>(0);
3350 }
3351
3352 template<> inline auto getArgument<Uint16>(JsonObjectValue& optionsArgs, StringView theArgName) {
3353 auto theValue = optionsArgs.theValues[theArgName.data()];
3354 switch (theValue.theType) {
3355 case ValueType::Uint64: {
3356 return static_cast<Uint16>(stoull(theValue.theValue));
3357 }
3358 }
3359 return static_cast<Uint16>(0);
3360 }
3361
3362 template<> inline auto getArgument<Uint8>(JsonObjectValue& optionsArgs, StringView theArgName) {
3363 auto theValue = optionsArgs.theValues[theArgName.data()];
3364 switch (theValue.theType) {
3365 case ValueType::Uint64: {
3366 return static_cast<Uint8>(stoull(theValue.theValue));
3367 }
3368 }
3369 return static_cast<Uint8>(0);
3370 }
3371
3372 template<> inline auto getArgument<Float>(JsonObjectValue& optionsArgs, StringView theArgName) {
3373 auto theValue = optionsArgs.theValues[theArgName.data()];
3374 switch (theValue.theType) {
3375 case ValueType::Float: {
3376 return stold(theValue.theValue);
3377 }
3378 }
3379 return 0.0l;
3380 }
3381
3382 template<> inline auto getArgument<Double>(JsonObjectValue& optionsArgs, StringView theArgName) {
3383 auto theValue = optionsArgs.theValues[theArgName.data()];
3384 switch (theValue.theType) {
3385 case ValueType::Float: {
3386 return stold(theValue.theValue);
3387 }
3388 }
3389 return 0.0L;
3390 }
3391
3392 template<> inline auto getArgument<String>(JsonObjectValue& optionsArgs, StringView theArgName) {
3393 auto theValue = optionsArgs.theValues[theArgName.data()];
3394 switch (theValue.theType) {
3395 case ValueType::String: {
3396 return theValue.theValue;
3397 }
3398 }
3399 return String{};
3400 }
3401
3402 template<> inline auto getArgument<Bool>(JsonObjectValue& optionsArgs, StringView theArgName) {
3403 auto theValue = optionsArgs.theValues[theArgName.data()];
3404 switch (theValue.theType) {
3405 case ValueType::Bool: {
3406 return static_cast<Bool>(stoull(theValue.theValue));
3407 }
3408 }
3409 return false;
3410 }
3411
3412 /// Command data, for functions executed by the CommandController. \brief Command data, for functions executed by the CommandController.
3413 class DiscordCoreAPI_Dll CommandData {
3414 public:
3415 String subCommandGroupName{};
3416 String subCommandName{};
3417 InputEventData eventData{};
3418 String commandName{};
3419 JsonObjectValue optionsArgs{};
3420
3421 CommandData() noexcept = default;
3422
3423 CommandData(InputEventData inputEventData);
3424
3425 CommandData(simdjson::ondemand::value jsonObjectData);
3426
3427 virtual ~CommandData() noexcept = default;
3428 };
3429
3430 /// Base arguments for the command classes. \brief Base arguments for the command classes.
3431 struct DiscordCoreAPI_Dll BaseFunctionArguments : public CommandData {
3432 DiscordCoreClient* discordCoreClient{ nullptr };///< A pointer to the instance of DiscordCoreClient.
3433
3434 BaseFunctionArguments() noexcept = default;
3435
3436 BaseFunctionArguments(CommandData commandData, DiscordCoreClient* discordCoreClientNew);
3437
3438 virtual ~BaseFunctionArguments() noexcept = default;
3439 };
3440
3441 /// Base class for the command classes. \brief Base class for the command classes.
3442 struct DiscordCoreAPI_Dll BaseFunction {
3443 String helpDescription{};///< Description of the command for the Help command.
3444 String commandName{};///< Name of the command for calling purposes.
3445 EmbedData helpEmbed{};///< A Message embed for displaying the command via the Help command.
3446
3447 BaseFunction() noexcept = default;
3448
3449 /// The base function for the command's execute function. \brief The base function for the command's execute function.
3450 /// \param args A reference to an instance of BaseFunctionArguments.
3451 virtual void execute(BaseFunctionArguments& args) = 0;
3452 virtual std::unique_ptr<BaseFunction> create() = 0;
3453 virtual ~BaseFunction() noexcept = default;
3454 };
3455
3456 struct DiscordCoreAPI_Dll MoveThroughMessagePagesData {
3457 InputEventData inputEventData{};
3458 Uint32 currentPageIndex{};
3459 String buttonId{};
3460 };
3461
3462 DiscordCoreAPI_Dll MoveThroughMessagePagesData moveThroughMessagePages(const String& userID, InputEventData originalEvent, Uint32 currentPageIndex,
3463 const std::vector<EmbedData>& messageEmbeds, Bool deleteAfter, Uint32 waitForMaxMs, Bool returnResult = false);
3464
3465 /**@}*/
3466
3467};// namespace DiscordCoreAPI
3468
3469namespace DiscordCoreInternal {
3470
3471 struct DiscordCoreAPI_Dll ReadyData {
3472 ReadyData(simdjson::ondemand::value);
3473 ReadyData() noexcept = default;
3474 DiscordCoreAPI::ApplicationData application{};
3476 String resumeGatewayUrl{};
3477 String sessionId{};
3478 Uint32 shard[2]{};
3479 Int32 v{};
3480 };
3481}
3482
3483template<> struct DiscordCoreAPI_Dll std::hash<DiscordCoreAPI::DiscordEntity> {
3484 DiscordCoreAPI::Uint64 operator()(DiscordCoreAPI::DiscordEntity const& object) const noexcept {
3485 return static_cast<DiscordCoreAPI::Snowflake>(object.id);
3486 }
3487};
3488
3489template<> struct DiscordCoreAPI_Dll std::hash<DiscordCoreAPI::ChannelData> {
3490 DiscordCoreAPI::Uint64 operator()(DiscordCoreAPI::ChannelData const& object) const noexcept {
3491 return static_cast<DiscordCoreAPI::Snowflake>(object.id);
3492 }
3493};
3494
3495template<> struct DiscordCoreAPI_Dll std::hash<DiscordCoreAPI::GuildData> {
3496 DiscordCoreAPI::Uint64 operator()(DiscordCoreAPI::GuildData const& object) const noexcept {
3497 return static_cast<DiscordCoreAPI::Snowflake>(object.id);
3498 }
3499};
3500
3501template<> struct DiscordCoreAPI_Dll std::hash<DiscordCoreAPI::RoleData> {
3502 DiscordCoreAPI::Uint64 operator()(DiscordCoreAPI::RoleData const& object) const noexcept {
3503 return static_cast<DiscordCoreAPI::Snowflake>(object.id);
3504 }
3505};
3506
3507template<> struct DiscordCoreAPI_Dll std::hash<DiscordCoreAPI::UserData> {
3508 DiscordCoreAPI::Uint64 operator()(DiscordCoreAPI::UserData const& object) const noexcept {
3509 return static_cast<DiscordCoreAPI::Snowflake>(object.id);
3510 }
3511};
3512
3513template<> struct DiscordCoreAPI_Dll std::hash<DiscordCoreAPI::GuildMemberData> {
3514 DiscordCoreAPI::Uint64 operator()(DiscordCoreAPI::GuildMemberData const& object) const noexcept {
3515 return static_cast<DiscordCoreAPI::Snowflake>(object.guildId) ^ (static_cast<DiscordCoreAPI::Snowflake>(object.id) << 1);
3516 }
3517};
3518
3519#endif
TimeFormat
Time formatting methods.
Definition: Utilities.hpp:902
WebHookType
WebHook types.
ApplicationFlags
Application flags, for the ApplicationData structure.
TriggerType
Trigger types for auto-moderation.
AuditLogEvent
Audit log events.
InteractionType
Interaction types.
StageInstancePrivacyLevel
Stage instance privacy levels.
ButtonStyle
Button styles.
DefaultMessageNotificationLevel
Default Message notification levels.
InviteTargetTypes
Invite target types.
ChannelType
Channel types.
EventType
Event types for auto-moderation.
WidgetStyleOptions
Widget style options.
GuildScheduledEventStatus
GuildScheduledEventStatus.
StickerType
Sticker types.
ConnectionVisibilityTypes
Connection visibility types.
InteractionCallbackType
Interaction callback types.
ActivityType
Activity types.
ComponentType
Component types.
StickerItemType
Sticker item types.
GuildScheduledEventPrivacyLevel
Guild scheduled event privacy levels.
AfkTimeOutDurations
Afk timeout durations.
PremiumTier
Premium tier levels.
TextInputStyle
Text input style for modals.
TimeoutDurations
Timeout durations for the timeout command.
ApplicationCommandPermissionType
Application command permission-types.
GuildScheduledEventEntityType
Guild scheduled event entity types.
ThreadType
Thread types.
GuildNSFWLevel
Guild NSFW level.
PremiumType
Premium types denote the level of premium a user has.
MessageType
Message types.
ExplicitContentFilterLevel
Explicit content filter levels.
StreamType
For selecting the type of streamer that the given bot is, one must be one server and one of client pe...
Definition: Utilities.hpp:379
VerificationLevel
Verification levels.
ThreadAutoArchiveDuration
Automatic Thread archiving durations.
MessageFlags
Message flags.
ApplicationCommandType
Application command types.
ApplicationCommandOptionType
Application command-option types.
PermissionOverwritesType
PermissionTypes overwrites types.
MessageActivityType
Message activity types.
StickerFormatType
Sticker format types.
SystemChannelFlags
System channel flags.
ActionType
Action types for auto-moderation.
InputEventResponseType
Input event response types.
Definition: Utilities.hpp:552
KeywordPresetType
Keyword preset types for auto-moderation.
@ Channel_Follower
Channel follower.
@ WidgetEnabled
Widget enabled.
@ Premium_Progress_Bar_Enabled
Premium progress bar enabled.
@ Embedded
Indicates if an app is embedded within the Discord client (currently unavailable publicly)
@ Verificatino_Pending_Guild_Limit
Indicates unusual growth of an app that prevents verification.
@ Gateway_Guild_Members
Intent required for bots in 100 or more servers to receive member-related events like guild_member_ad...
@ Gateway_Message_Content_Limited
Intent required for bots in under 100 servers to receive message content, found in Bot Settings};.
@ Gateway_Guild_Members_Limited
Intent required for bots in under 100 servers to receive member-related events like guild_member_add,...
@ Gateway_Presence_Limited
Intent required for bots in under 100 servers to receive presence_update events, found in Bot Setting...
@ Gateway_Message_Content
Intent required for bots in 100 or more servers to receive message content.
@ Gateway_Presence
Intent required for bots in 100 or more servers to receive presence_update events.
@ Harmful_Link
Check if content contains any harmful links.
@ Keyword
Check if content contains words from a user defined list of keywords.
@ Keyword_Preset
Check if content contains words from internal pre-defined wordsets.
@ Spam
Check if content represents generic spam.
@ Webhook_Delete
Webhook delete.
@ Channel_Overwrite_Update
Channel overwrite update.
@ Message_Delete
Message delete.
@ Sticker_Update
Sticker update.
@ Webhook_Update
Webhook update.
@ Channel_Overwrite_Create
Channel overwrite create.
@ Channel_Update
Channel update.
@ Message_Bulk_Delete
Message bulk delete.
@ Channel_Overwrite_Delete
Channel overwrite delete.
@ Auto_Moderation_Rule_Update
Auto Moderation rule was updated.
@ Application_Command_Permission_Update
Permissions were updated for a command.
@ Integration_Delete
Integration delete.
@ Guild_Scheduled_Event_Create
Guild-scheduled-event create.
@ Stage_Instance_Update
Stage-Instance update.
@ Guild_Scheduled_Event_Update
Guild-scheduled-event update.
@ Member_Ban_Add
Member ban add.
@ Sticker_Delete
Sticker delete.
@ Integration_Create
Integration create.
@ Channel_Create
Channel create.
@ Member_Role_Update
Member role update.
@ Stage_Instance_Create
Stage-Instance create.
@ Auto_Moderation_Block_Message
Message was blocked by AutoMod (according to a rule).
@ Member_Disconnect
Member disconnect.
@ Guild_Scheduled_Event_Delete
Guild-scheduled-event delete.
@ Member_Ban_Remove
Member ban remove.
@ Stage_Instance_Delete
Stage-Instance delete.
@ Webhook_Create
Webhook create.
@ Sticker_Create
Sticker create.
@ Auto_Moderation_Rule_Delete
Auto Moderation rule was deleted.
@ Auto_Moderation_Rule_Create
Auto Moderation rule was created.
@ Integration_Update
Integration update.
@ Channel_Delete
Channel delete.
@ Message_Component
Message component.
@ Application_Command_Autocomplete
Application command autocomplete.
@ Application_Command
Application command.
@ Modal_Submit
Modal submission.
@ Embedded_Application
Embedded application.
@ Guild_News_Thread
Guild news Thread.
@ Guild_Public_Thread
Guild public Thread.
@ Guild_Private_Thread
Guild private Thread.
@ Guild_Stage_Voice
Guild stage-voice.
@ Guild_Category
Guild category.
@ Guild_Directory
The channel in a hub containing the listed servers.
@ Guild_Forum
A channel that can only contain threads.
@ Message_Send
When a member sends or edits a message in the guild.
@ Deferred_Channel_Message_With_Source
ACK an interaction and edit a response later, the user sees a loading state.
@ Channel_Message_With_Source
Respond to an interaction with a message.
@ Deferred_Update_Message
For components, ACK an interaction and edit the original message later; the user does not see a loadi...
@ Modal
Respond to an interaction with a popup modal.
@ Application_Command_Autocomplete_Result
Respond to an autocomplete interaction with suggested choices.
@ Update_Message
For components, edit the message the component was attached to.
@ ActionRow
A container for other components.
@ TextInput
A text input object.
@ SelectMenu
A select menu for picking from choices.
@ Paragraph
A multi-line input.
@ None
None - remove timeout.
@ Ten_Minutes
10 Minute timeout.
@ Five_Minutes
5 Minute timeout.
@ Age_Restricted
Age restricted.
@ Bot_Http_Interactions
Bot uses only HTTP interactions and is shown in the online member list.
@ Bug_Hunter_Level_1
Bug Hunter Level 1.
@ Verified
Is it verified?
@ Bug_Hunter_Level_2
Bug Hunter Level 2.
@ Premium_Early_Suppoerter
Early Nitro Supporter.
@ Hypesquad
HypeSquad Events Member.
@ Partner
Partnered Server Owner.
@ Verified_Developer
Early Verified Bot Developer.
@ Staff
Discord Employee.
@ Hypesquad_Online_House_1
House Bravery Member.
@ Hypesquad_Online_House_2
House Brilliance Member.
@ System
Is it a system integration?
@ Team_Pseudo_User
User is a team.
@ Certified_Moderator
Discord Certified Moderator.
@ MFAEnabled
Is MFA enabled?
@ Verified_Bot
Verified Bot.
@ Hypesquad_Online_House_3
House Balance Member.
@ Nitro_Classic
Nitro classic.
@ Guild_Discovery_Grace_Period_Final_Warning
Guild discovery grade period final warning.
@ User_Premium_Guild_Subscription
User premium Guild subscription.
@ Guild_Discovery_Grace_Period_Initial_Warning
Guild discovery grade period initial warning.
@ User_Premium_Guild_Subscription_Tier_3
User premium Guild subscription tier 3.
@ Guild_Member_Join
Guild memeber join.
@ Context_Menu_Command
Context menu command.
@ Recipient_Add
Recipient add.
@ User_Premium_Guild_Subscription_Tier_2
User premium Guild subscription tier 2.
@ Channel_Icon_Change
Channel icon change.
@ Channel_Follow_Add
Channel follow add.
@ Thread_Created
Thread created.
@ Guild_Discovery_Requalified
Guild discovery requalified.
@ Channel_Pinned_Message
Channel pinned Message.
@ Recipient_Remove
Recipient remove.
@ Channel_Name_Change
Channel name change.
@ Thread_Starter_Message
Thread starter Message.
@ Guild_Invite_Reminder
Guild invite reminder.
@ Chat_Input_Command
Chat input command.
@ Guild_Discovery_Disqualified
Guild discovery disqualified.
@ User_Premium_Guild_Subscription_Tier_1
User premium Guild subscription tier 1.
@ Members_Without_Roles
Members without roles.
@ Guilds
Intent for receipt of Guild information.
@ Source_Message_Deleted
Source Message deleted.
@ Suppress_Embeds
Supress embeds.
@ Suppress_Join_Notification_Replies
Hide member join sticker reply buttons.
@ Suppress_Guild_Reminder_Notifications
Suppress server setup tips.
@ Suppress_Join_Notifications
Suppress member join notifications.
@ Suppress_Premium_Subscriptions
Suppress server boost notifications.
@ Block_Message
Blocks the content of a message according to the rule.
@ Timeout
Timeout user for a specified duration.
@ Send_Alert_Message
Logs user content to a specified channel.
@ Sexual_Content
Words that refer to sexually explicit behavior or activity.
@ Profanity
Words that may be considered forms of swearing or cursing.
@ Slurs
Personal insults or words that may be considered hate speech.
The main namespace for this library.
DiscordCoreClient - The main class for this library.
Data that is received as part of an Interaction creation event.
Base class for all Discord entities.
Data structure representing a single User.
Data representing a file to be sent via multipart-form data.
Meta data for a Thread type of Channel.
Data for a single member of a Thread.
Data structure representing a single Role.
Data structure representing a single emoji.
Data structure representing a single GuildMember. Data structure representing a single Guild.
A PermissionTypes overwrite, for a given Channel.
Data structure representing a single Channel.
Data representing an active Thread.
Data representing an archived Thread.
Action metadata for auto-moderation-rules.
Trigger metadata for auto-moderation-rules.
For representing a single auto-moderation-rule-action.
Represents an auto-moderation-rule.
Permissions data for an ApplicationCommand.
Represents the Permissions for accessing an ApplicationCommand from within a Guild.
For updating/modifying a given Channel's properties.
Data structure representing a single reaction.
Structure representing Voice Region Data.
For updating the current voice state.
Install params data, for application data.
AuthorizationInfoData() noexcept=default
The User who has authorized, if the User has authorized with the identify scope.
Data representing a single Sticker.
Data representing a single Guild preview.
Data structure representing a single Guild.
Guild scheduled event entity metadata.
Data representing a Guild Scheduled Event.
Data representing a single GuildScheduledEventUser.
Represents a Guild Template.
For storing Interaction-related values.
For storing Message-related values.
Data structure representing an ApplicationCommand's option choice.
Data structure representing an ApplicationCommand's option.
Representing "TypingStart" data.
Modal interaction data, for inputs from text modals.
Allowable mentions for a Message.
Represents a single selection from a select-menu.
Represents a single Message-component.
Action row data of Message components.
Interaction ApplicationCommand callback data.
Data structure representing an ApplicationCommand.
Data for when some Channel pins are updated.
Data for when threads are synced.
Represents a Thread-members-update.
Represents a forum thread message.
The core of a Message's data structure.
Data structure representing a single Message.
Represents a single User Connection.
ApplicationCommand Interaction data option.
Data from the SessionStart info.
Data from the GetGatewayBot endpoint.
Data representing a Guild Emoji Update event.
Data representing a Guild Sticker Update event.
Data representing an input-event, which is any Message or Interaction that is coming into the bot as ...
Data for responding to an input-event.
Message response base, for responding to messages.
Guild application command permissions data.
Represents a download Url.
A song from the various platforms.
Playlist of songs and other variables.
Command data, for functions executed by the CommandController.
Base arguments for the command classes.
Base class for the command classes.
A discord Guild. Used to connect to/disconnect from voice.
For handling User input - Messages or Interactions.
Definition: InputEvents.hpp:42
For creating an ephemeral Interaction response.
For creating a deferred Interaction response.
For creating an Interaction response.
For editing an Interaction response.
For deleting an Interaction response.
For creating an ephemeral follow up Message.
For editing a follow up Message.
For sending a direct-message.
A class representing the Song APIs.
Definition: SongAPI.hpp:43
A single User.
For connecting two bots to stream the VC contents between the two.
Definition: Utilities.hpp:382
Class for representing a timestamp, as well as working with time-related values.
Definition: Utilities.hpp:976
Permissions class, for representing and manipulating Permission values.
Definition: Utilities.hpp:1330
VoiceConnection class - represents the connection to a given voice Channel.