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