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