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 Jsonifier::Serializer();
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 Jsonifier::Serializer();
56 };
57
58 struct DiscordCoreAPI_Dll VoiceSocketProtocolPayloadData {
59 std::string voiceEncryptionMode{};
60 std::string externalIp{};
61 uint16_t voicePort{};
62
63 operator Jsonifier::Serializer();
64 };
65
66 struct DiscordCoreAPI_Dll VoiceIdentifyData {
68 VoiceConnectionData connectionData{};
69
70 operator Jsonifier::Serializer();
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 Jsonifier::Serializer();
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& operator=(const HttpsWorkloadData& other) noexcept = delete;
288
289 HttpsWorkloadData(const HttpsWorkloadData& other) noexcept = delete;
290
291 HttpsWorkloadData& operator=(HttpsWorkloadType type) noexcept;
292
293 HttpsWorkloadData(HttpsWorkloadType type) noexcept;
294
295 protected:
296 static int64_t incrementAndGetWorkloadId(HttpsWorkloadType workloadType) noexcept;
297
298 HttpsWorkloadType workloadType{};
299 };
300
301 struct DiscordCoreAPI_Dll HelloData {
302 HelloData(DiscordCoreAPI::Value);
303 int32_t heartbeatInterval{};
304 };
305
306 struct DiscordCoreAPI_Dll WebSocketMessage {
307 int64_t op{ -1 };
308 std::string t{};
309 int64_t s{};
310
311 WebSocketMessage() noexcept = default;
312
313 WebSocketMessage(DiscordCoreAPI::Value);
314
315 template<typename RTy> RTy processJsonMessage(DiscordCoreAPI::Value jsonData, const char* dataName) {
316 DiscordCoreAPI::Value object{};
317 if (jsonData[dataName].get(object) != DiscordCoreAPI::ErrorCode::Success) {
318 throw DiscordCoreAPI::DCAException{ std::string{ "Failed to collect the " } + dataName };
319 } else {
320 return RTy{ object };
321 }
322 }
323 };
324
325 struct DiscordCoreAPI_Dll InvalidSessionData {
326 InvalidSessionData(DiscordCoreAPI::Value);
327 bool d{};
328 };
329}
330
331/// \brief The main namespace for this
332/// library.
333namespace DiscordCoreAPI {
334
335 /**
336 * \addtogroup foundation_entities
337 * @{
338 */
339
340 struct DiscordCoreAPI_Dll ConnectionPackage {
341 int32_t currentReconnectTries{};
342 uint32_t currentShard{};
343 bool areWeResuming{};
344 };
345
346 /// \brief Timeout durations for the timeout command.
347 enum class TimeoutDurations : uint16_t {
348 None = 0,///< None - remove timeout.
349 Minute = 1,///< 1 Minute timeout.
350 Five_Minutes = 5,///< 5 Minute timeout.
351 Ten_Minutes = 10,///< 10 Minute timeout.
352 Hour = 60,///< 1 Hour timeout.
353 Day = 1440,///< 1 Day timeout.
354 Week = 10080///< 1 Week timeout.
355 };
356
357 /// \brief Base class for all Discord entities.
358 class DiscordCoreAPI_Dll DiscordEntity {
359 public:
360 Snowflake id{};///< The identifier "snowflake" of the given entity.
361 /// \brief Converts the
362 /// snowflake-id into a time and date stamp. \returns std::string A
363 /// std::string containing the timeStamp.
364 std::string getCreatedAtTimestamp(TimeFormat timeFormat);
365
366 virtual ~DiscordEntity() noexcept = default;
367 };
368
369 /// \brief Role tags data.
370 struct DiscordCoreAPI_Dll RoleTagsData {
371 std::string premiumSubscriber{};///< Are they a premium subscriber?
372 std::string integrationId{};///< What is the integration id?
373 std::string botId{};///< What is the bot id?
374
375 RoleTagsData() noexcept = default;
376
377 RoleTagsData(Value);
378
379 virtual ~RoleTagsData() noexcept = default;
380 };
381
382 /// \brief User flags.
383 enum class UserFlags : uint32_t {
384 Staff = 1 << 0,///< Discord Employee.
385 Partner = 1 << 1,///< Partnered Server Owner.
386 Hypesquad = 1 << 2,///< HypeSquad Events Member.
387 Bug_Hunter_Level_1 = 1 << 3,///< Bug Hunter Level 1.
388 Hypesquad_Online_House_1 = 1 << 6,///< House Bravery Member.
389 Hypesquad_Online_House_2 = 1 << 7,///< House Brilliance Member.
390 Hypesquad_Online_House_3 = 1 << 8,///< House Balance Member.
391 Premium_Early_Suppoerter = 1 << 9,///< Early Nitro Supporter.
392 Team_Pseudo_User = 1 << 10,///< User is a team.
393 Bug_Hunter_Level_2 = 1 << 14,///< Bug Hunter Level 2.
394 Verified_Bot = 1 << 16,///< Verified Bot.
395 Verified_Developer = 1 << 17,///< Early Verified Bot Developer.
396 Certified_Moderator = 1 << 18,///< Discord Certified Moderator.
397 Bot_Https_Interactions = 1 << 19,///< Bot uses only HTTPS interactions and is shown in the online member list.
398 Bot = 1 << 20,///< Is it a bot?
399 MFAEnabled = 1 << 21,///< Is MFA enabled?
400 System = 1 << 22,///< Is it a system integration?
401 Verified = 1 << 23///< Is it verified?
402 };
403
404 /// \brief Premium types denote the level of premium a user has.
405 enum class PremiumType : uint8_t {
406 None = 0,///< None.
407 Nitro_Classic = 1,///< Nitro classic.
408 Nitro = 2///< Nitro.
409 };
410
411 /// \brief Data structure representing a single User.
412 class DiscordCoreAPI_Dll UserData : public DiscordEntity {
413 public:
414 friend class GuildData;
415
416 StringWrapper discriminator{};///< The user's 4-digit discord-tag identify.
417 StringWrapper userName{};///< The user's userName, not unique across the platform identify.
418 IconHash avatar{};///< The user's avatar hash.
419 UserFlags flags{};///< The public flags on a user' s account.
420
421 UserData() noexcept = default;
422
423 UserData& operator=(UserData&&) noexcept = default;
424
425 UserData(UserData&&) noexcept = default;
426
427 UserData& operator=(const UserData&) noexcept = default;
428
429 UserData(const UserData&) noexcept = default;
430
431 UserData(Value jsonData);
432
433 template<IsEnum ETy> bool getFlagValue(ETy theEnum) {
434 return getBool(this->flags, theEnum);
435 }
436
437 std::string getAvatarUrl();
438
439 virtual ~UserData() noexcept = default;
440 };
441
442 /// \brief Attachment data.
443 class DiscordCoreAPI_Dll AttachmentData : public DiscordEntity {
444 public:
445 std::string contentType{};///< Type of content for the attachment.
446 std::string description{};///< A description of the attachment.
447 std::string filename{};///< The file name of the attachment.
448 std::string proxyUrl{};///< The proxy url for the attachment.
449 std::string url{};///< The url for the attachment.
450 bool ephemeral{};///< Whether it was an ephemeral response.
451 int32_t height{};///< The height of the attachment.
452 int32_t width{};///< The width of the attachment.
453 int32_t size{};///< The size of the attachment.
454
455
456 operator Serializer();
457
458 AttachmentData() noexcept = default;
459
460 AttachmentData(Value);
461
462 virtual ~AttachmentData() noexcept = default;
463 };
464
465 /// \brief Sticker format types.
466 enum class StickerFormatType : uint8_t {
467 Png = 1,///< Png.
468 Apng = 2,///< Apng.
469 Lottie = 3///< Lottie
470 };
471
472 /// \brief Embed footer data.
473 struct DiscordCoreAPI_Dll EmbedFooterData {
474 std::string proxyIconUrl{};///< Proxy icon url.
475 std::string iconUrl{};///< Icon url.
476 std::string text{};///< Footer text.
477
478 EmbedFooterData() noexcept = default;
479
480 EmbedFooterData(Value jsonData);
481
482 virtual ~EmbedFooterData() noexcept = default;
483 };
484
485 /// \brief Embed image data.
486 struct DiscordCoreAPI_Dll EmbedImageData {
487 std::string proxyUrl{};///< Proxy url.
488 std::string url{};///< Image url.
489 int32_t height{};///< Image height.
490 int32_t width{};///< Image width.
491
492 EmbedImageData() noexcept = default;
493
494 EmbedImageData(Value jsonData);
495
496 virtual ~EmbedImageData() noexcept = default;
497 };
498
499 /// \brief Embed thumbnail data.
500 struct DiscordCoreAPI_Dll EmbedThumbnailData {
501 std::string proxyUrl{};///< Proxy url.
502 std::string url{};///< Image url.
503 int32_t height{};///< Image height.
504 int32_t width{};///< Image width.
505
506 EmbedThumbnailData() noexcept = default;
507
508 EmbedThumbnailData(Value jsonData);
509
510 virtual ~EmbedThumbnailData() noexcept = default;
511 };
512
513 /// \brief Embed video data.
514 struct DiscordCoreAPI_Dll EmbedVideoData {
515 std::string proxyUrl{};///< Proxy url.
516 std::string url{};///< Image url.
517 int32_t height{};///< Image height.
518 int32_t width{};///< Image width.
519
520 EmbedVideoData() noexcept = default;
521
522 EmbedVideoData(Value jsonData);
523
524 virtual ~EmbedVideoData() noexcept = default;
525 };
526
527 /// \brief Embed provider data.
528 struct DiscordCoreAPI_Dll EmbedProviderData {
529 std::string name{};///< Name.
530 std::string url{};///< Url.
531
532 EmbedProviderData() noexcept = default;
533
534 EmbedProviderData(Value jsonData);
535
536 virtual ~EmbedProviderData() noexcept = default;
537 };
538
539 /// \brief Embed author data.
540 struct DiscordCoreAPI_Dll EmbedAuthorData {
541 std::string proxyIconUrl{};///< Proxy icon url.
542 std::string iconUrl{};///< Icon url.
543 std::string name{};///< Name.
544 std::string url{};///< Url.
545
546 EmbedAuthorData() noexcept = default;
547
548 EmbedAuthorData(Value jsonData);
549
550 virtual ~EmbedAuthorData() noexcept = default;
551 };
552
553 /// \brief Embed field data.
554 struct DiscordCoreAPI_Dll EmbedFieldData {
555 std::string value{};///< The text on the field.
556 std::string name{};///< The title of the field.
557 bool Inline{};///< Is the field inline with the rest of them?
558
559 EmbedFieldData() noexcept = default;
560
561 EmbedFieldData(Value jsonData);
562
563 operator Serializer();
564
565 virtual ~EmbedFieldData() noexcept = default;
566 };
567
568 /// \brief Embed types.
569 enum class EmbedType : uint8_t {
570 Rich = 0,///< Rich.
571 Image = 1,///< Image.
572 Video = 2,///< Video.
573 Gifv = 3,///< Gifv.
574 Article = 4,///< Article.
575 link = 5///< Link.
576 };
577
578 /// \brief Embed data.
579 class DiscordCoreAPI_Dll EmbedData {
580 public:
581 std::vector<EmbedFieldData> fields{};///< Array of embed fields.
582 EmbedThumbnailData thumbnail{};///< Embed thumbnail data.
583 ColorValue hexColorValue{ 0 };///< Hex color value of the embed.
584 EmbedProviderData provider{};///< Embed provider data.
585 std::string description{};///< Description of the embed.
586 EmbedFooterData footer{};///< Embed footer data.
587 EmbedAuthorData author{};///< Embed author data.
588 std::string timeStamp{};///< Timestamp to be placed on the embed.
589 EmbedImageData image{};///< Embed image data.
590 EmbedVideoData video{};///< Embed video data.
591 std::string title{};///< Title of the embed.
592 std::string type{};///< Type of the embed.
593 std::string url{};///< Url for the embed.
594
595 EmbedData() noexcept = default;
596
597 operator Serializer();
598
599 /// \brief Sets the author's name and avatar for the embed.
600 /// \param authorName The author's name.
601 /// \param authorAvatarUrl The url to their avatar.
602 /// \returns EmbedData& A reference to this embed.
603 EmbedData& setAuthor(const std::string& authorName, const std::string& authorAvatarUrl = "");
604
605 /// \brief Sets the footer's values for the embed.
606 /// \param footerText The footer's text.
607 /// \param footerIconUrlText Url to the footer's icon.
608 /// \returns EmbedData& A reference to this embed.
609 EmbedData& setFooter(const std::string& footerText, const std::string& footerIconUrlText = "");
610
611 /// \brief Sets the timeStamp on the embed.
612 /// \param timeStamp The timeStamp to be set.
613 /// \returns EmbedData& A reference to this embed.
614 EmbedData& setTimeStamp(const std::string& timeStamp);
615
616 /// \brief Adds a field to the embed.
617 /// \param name The title of the embed field.
618 /// \param value The contents of the embed field.
619 /// \param Inline Is it inline with the rest of the fields on the embed?
620 /// \returns EmbedData& A reference to this embed.
621 EmbedData& addField(const std::string& name, const std::string& value, bool Inline = true);
622
623 /// \brief Sets the description (the main contents) of the embed.
624 /// \param descriptionNew The contents of the description to set.
625 /// \returns EmbedData& A reference to this embed.
626 EmbedData& setDescription(const std::string& descriptionNew);
627
628 /// \brief Sets the color of the embed, by applying a hex-color value.
629 /// \param hexColorValueNew A string containing a hex-number value (Between 0x00 0xFFFFFF).
630 /// \returns EmbedData& A reference to this embed.
631 EmbedData& setColor(const std::string& hexColorValueNew);
632
633 /// \brief Sets the thumbnail of the embed.
634 /// \param thumbnailUrl The url to the thumbnail to be used.
635 /// \returns EmbedData& A reference to this embed.
636 EmbedData& setThumbnail(const std::string& thumbnailUrl);
637
638 /// \brief Sets the title of the embed.
639 /// \param titleNew A string containing the desired title.
640 /// \returns EmbedData& A reference to this embed.
641 EmbedData& setTitle(const std::string& titleNew);
642
643 /// \brief Sets the image of the embed.
644 /// \param imageUrl The url of the image to be set on the embed.
645 /// \returns EmbedData& A reference to this embed.
646 EmbedData& setImage(const std::string& imageUrl);
647
648 EmbedData(Value jsonData);
649
650 virtual ~EmbedData() noexcept = default;
651 };
652
653 /// \brief Message reference data.
654 struct DiscordCoreAPI_Dll MessageReferenceData {
655 bool failIfNotExists{};///< Fail if the Message doesn't exist?
656 Snowflake messageId{};///< Id of the Message to reference.
657 Snowflake channelId{};///< Id of the Channel that the referenced Message was sent in.
658 Snowflake guildId{};///< Id of the Guild that the referenced Message was sent in.
659
660 MessageReferenceData() noexcept = default;
661
662 MessageReferenceData(Value jsonData);
663
664 operator Serializer();
665
666 virtual ~MessageReferenceData() noexcept = default;
667 };
668
669 enum class MediaType : uint8_t { png = 0, gif = 1, jpeg = 2, mpeg = 3, mp3 = 4 };
670
671 /// \brief Data representing a file to be sent via multipart-form data.
672 struct DiscordCoreAPI_Dll File {
673 std::string fileName{};///< The name of the file.
674 std::string data{};///< The data of the file.
675 };
676
677 /// \brief The sorting order, for Guild Forum channels.
678 enum class SortOrderTypes {
679 Latest_Activity = 0,///< Sort forum posts by activity.
680 Creation_Date = 1///< Sort forum posts by creation time(from most recent to oldest).
681 };
682
683 /// \brief Channel types.
684 enum class ChannelType : uint8_t {
685 Guild_Text = 0,///< A text channel within a server.
686 DM = 1,///< A direct message between users.
687 Guild_Voice = 2,///< A voice channel within a server.
688 Group_DM = 3,///< A direct message between multiple users.
689 Guild_Category = 4,///< An organizational category that contains up to 50 channels.
690 Guild_Announcement = 5,///< A channel that users can follow and crosspost into their own server (formerly news channels).
691 Announcement_Thread = 10,///< A temporary sub-channel within a GUILD_ANNOUNCEMENT channel.
692 Public_Thread = 11,///< A temporary sub-channel within a GUILD_TEXT or GUILD_FORUM channel.
694 12,///< A temporary sub-channel within a GUILD_TEXT channel that is only viewable by those invited and those with the MANAGE_THREADS permission.
695 Guild_Stage_Voice = 13,///< A voice channel for hosting events with an audience.
696 Guild_Directory = 14,///< The channel in a hub containing the listed servers.
697 Guild_Forum = 15///< Channel that can only contain threads.
698 };
699
700 /// \brief Meta data for a Thread type of Channel.
701 struct DiscordCoreAPI_Dll ThreadMetadataData {
702 int32_t autoArchiveDuration{};///< How int64_t before archiving this Thread.
703 TimeStamp archiveTimestamp{};///< (Where applicable) the time at which this Thread was archived.
704 bool invitable{};///< The id of the individual who archived this Thread.
705 bool archived{};///< Whether or not this Thread is currently archived.
706 bool locked{};///< Whether or not this Thread is currently locked.
707
708 ThreadMetadataData() noexcept = default;
709
710 ThreadMetadataData(Value);
711
712 virtual ~ThreadMetadataData() noexcept = default;
713 };
714
715 /// \brief Data for a single member of a Thread.
716 class DiscordCoreAPI_Dll ThreadMemberData : public DiscordEntity {
717 public:
718 TimeStamp joinTimestamp{};///< The time at which the member joined this Thread.
719 Snowflake userId{};///< The User's id.
720 int32_t flags{};///< Flags.
721
722 ThreadMemberData() noexcept = default;
723
724 ThreadMemberData(Value);
725
726 virtual ~ThreadMemberData() noexcept = default;
727 };
728
729 class DiscordCoreAPI_Dll ThreadMemberDataVector {
730 public:
731 ThreadMemberDataVector() noexcept = default;
732
733 operator std::vector<ThreadMemberData>();
734
735 ThreadMemberDataVector(Value);
736
737 virtual ~ThreadMemberDataVector() noexcept = default;
738
739 protected:
740 std::vector<ThreadMemberData> threadMembers{};
741 };
742
743 /// \brief Thread types.
744 enum class ThreadType : uint8_t {
745 Guild_News_Thread = 10,///< Guild news Thread.
746 Guild_Public_Thread = 11,///< Guild public Thread.
747 Guild_Private_Thread = 12///< Guild private Thread.
748 };
749
750 /// \brief Voice state data.
751 struct DiscordCoreAPI_Dll VoiceStateDataLight {
752 Snowflake channelId{};///< The Channel id this User is connected to.
753 Snowflake guildId{};///< The Guild id this voice state is for.
754 Snowflake userId{};///< The User id this voice state is for.
755
756 VoiceStateDataLight() noexcept = default;
757
758 VoiceStateDataLight(Value jsonData);
759
760 virtual ~VoiceStateDataLight() noexcept = default;
761 };
762
763 /// \brief Voice state data.
764 struct DiscordCoreAPI_Dll VoiceStateData : public VoiceStateDataLight {
765 TimeStamp requestToSpeakTimestamp{};///< The time at which the User requested to speak.
766 std::string sessionId{};///< The session id for this voice state.
767 bool selfStream{};///< Whether this User is streaming using "Go Live".
768 bool selfVideo{};///< Whether this User's camera is enabled.
769 bool selfDeaf{};///< Whether this User is locally deafened.
770 bool selfMute{};///< Whether this User is locally muted.
771 bool suppress{};///< Whether this User is muted by the current User.
772 bool deaf{};///< Whether this User is deafened by the server.
773 bool mute{};///< Whether this User is muted by the server.
774
775 VoiceStateData() noexcept = default;
776
777 VoiceStateData(Value jsonData);
778
779 virtual ~VoiceStateData() noexcept = default;
780 };
781
782 /// \brief Automatic Thread archiving durations.
783 enum class ThreadAutoArchiveDuration : uint16_t {
784 Shortest = 60,///< Shortest.
785 Short = 1440,///< Short.
786 Long = 4320,///< Long.
787 Longest = 10080///< Longest.
788 };
789
790 enum class RoleFlags : uint8_t { Mentionable = 1 << 0, Managed = 1 << 1, Hoist = 1 << 2 };
791
792 /// \brief Data structure representing a single Role.
793 class DiscordCoreAPI_Dll RoleData : public DiscordEntity {
794 public:
795 friend class GuildData;
796
797 StringWrapper unicodeEmoji{};///< Emoji representing the Role.
798 Permissions permissions{};///< The Role's base Guild Permissions.
799 ColorValue color{ 0 };///< The Role's color.
800 StringWrapper name{};///< The Role's name.
801 Snowflake guildId{};///< The id of the Guild that this Role is from.
802 int16_t position{};///< Its position amongst the rest of the Guild's roles.
803 RoleFlags flags{};///< Role flags.
804
805
806 RoleData() noexcept = default;
807
808 RoleData& operator=(RoleData&&) noexcept = default;
809
810 RoleData(RoleData&&) noexcept = default;
811
812 RoleData& operator=(const RoleData&) noexcept = default;
813
814 RoleData(const RoleData&) noexcept = default;
815
816 RoleData(Value jsonData);
817
818 template<IsEnum ETy> bool getFlagValue(ETy theEnum) {
819 return getBool(this->flags, theEnum);
820 }
821
822 virtual ~RoleData() noexcept = default;
823 };
824
825 /// \brief Data structure representing a single emoji.
826 class DiscordCoreAPI_Dll EmojiData : public DiscordEntity {
827 public:
828 std::wstring unicodeName{ L"" };///< What is its unicode name?
829 std::vector<RoleData> roles{};///< Roles that are allowed to use this emoji.
830 bool available{ true };///< Is it available to be used?
831 bool requireColons{};///< Require colons to render it?
832 StringWrapper name{};///< What is its name?
833 UserData user{};///< User that created this emoji.
834 bool animated{};///< Is it animated?
835 bool managed{};///< Is it managed?
836
837 EmojiData() noexcept = default;
838
839 EmojiData(Value jsonData);
840
841 virtual ~EmojiData() noexcept = default;
842 };
843
844 /// \brief Activity types.
845 enum class ActivityType : uint8_t {
846 Game = 0,///< Game.
847 Streaming = 1,///< Streaming.
848 Listening = 2,///< Listening.
849 Watching = 3,///< Watching.
850 Custom = 4,///< Custom.
851 Competing = 5///< Competing.
852 };
853
854 /// \brief Activity data.
855 struct DiscordCoreAPI_Dll ActivityData {
856 StringWrapper name{};///< Name of the activity.
857 ActivityType type{};///< Activity data.
858 StringWrapper url{};///< Url associated with the activity.
859
860 ActivityData() noexcept = default;
861
862 virtual ~ActivityData() noexcept = default;
863 };
864
865 enum class PresenceUpdateFlags : uint8_t {
866 Desktop_Online = 0b00000001,
867 Desktop_Idle = 0b00000010,
868 Desktop_Dnd = 0b000000011,
869 Mobile_Online = 0b00000010,
870 Mobile_Idle = 0b00000100,
871 Mobile_Dnd = 0b00000110,
872 Web_Online = 0b00000100,
873 Web_Idle = 0b00001000,
874 Web_Dnd = 0b00001100,
875 Status_Online = 0b00001000,
876 Status_Idle = 0b00010000,
877 Status_Dnd = 0b00011000
878 };
879
880 void parseObject(Value jsonData, PresenceUpdateFlags& data);
881
882 /// \brief Presence update data.
883 struct DiscordCoreAPI_Dll PresenceUpdateData {
884 PresenceUpdateFlags theStatus{};///< Current client status.
885 Snowflake guildId{};///< Guild id for the current presence.
886 Snowflake userId{};///< User id for the current presence.
887
888 PresenceUpdateData() noexcept = default;
889
890 PresenceUpdateData(Value jsonData);
891
892 virtual ~PresenceUpdateData() noexcept = default;
893 };
894
895 enum class GuildMemberFlags : uint8_t { Pending = 1 << 0, Deaf = 1 << 1, Mute = 1 << 2 };
896
897 /// \brief Data structure representing a single GuildMember.
898 /// \brief Data structure representing a single Guild.
899 class DiscordCoreAPI_Dll GuildMemberData : public DiscordEntity {
900 public:
901 friend class GuildData;
902 std::vector<Snowflake> roles{};///< The Guild roles that they have.
903 Permissions permissions{};///< Their base-level Permissions in the Guild.
904 GuildMemberFlags flags{};///< GuildMember flags.
905 TimeStamp joinedAt{};///< When they joined the Guild.
906 StringWrapper nick{};///< Their nick/display name.
907 Snowflake guildId{};///< The current Guild's id.
908 IconHash avatar{};///< This GuildMember's Guild Avatar.
909
910 GuildMemberData() noexcept = default;
911
912 GuildMemberData& operator=(GuildMemberData&&) noexcept;
913
914 GuildMemberData& operator=(const GuildMemberData&) noexcept = default;
915
916 GuildMemberData(const GuildMemberData&) noexcept = default;
917
918 GuildMemberData& operator=(Value);
919
920 template<IsEnum ETy> bool getFlagValue(ETy theEnum) {
921 return getBool(this->flags, theEnum);
922 }
923
924 GuildMemberData(Value);
925
926 VoiceStateDataLight getVoiceStateData();
927
928 std::string getAvatarUrl();
929
930 UserData getUserData();
931
932 virtual ~GuildMemberData() noexcept = default;
933 };
934
935 /// \brief PermissionTypes overwrites types.
936 enum class PermissionOverwritesType : uint8_t {
937 Role = 0,///< Role.
938 User = 1///< User.
939 };
940
941 /// \brief A PermissionTypes overwrite, for a given Channel.
942 class DiscordCoreAPI_Dll OverWriteData : public DiscordEntity {
943 public:
944 PermissionOverwritesType type{};///< Role or User type.
945 uint64_t allow{};///< Collection of Permissions to allow.
946 uint64_t deny{};///< Collection of Permissions to deny.
947
948 OverWriteData() noexcept = default;
949
950 OverWriteData(Value jsonData);
951
952 virtual ~OverWriteData() noexcept = default;
953 };
954
955 enum class ChannelFlags : uint8_t { NSFW = 1 << 0 };
956
957 struct DiscordCoreAPI_Dll DefaultReactionData {
958 std::string emojiName{};///< The unicode character of the emoji.
959 Snowflake emojiId{};///< The id of a guild's custom emoji.
960
961 DefaultReactionData() noexcept = default;
962
963 DefaultReactionData(Value jsonData);
964 };
965
966 struct DiscordCoreAPI_Dll ForumTagData {
967 std::string emojiName{};///< The unicode character of the emoji.
968 Snowflake emojiId{};///< The id of a guild's custom emoji.
969 std::string name{};///< The name of the tag(0 - 20 characters).
970 bool moderated{};///< Whether this tag can only be added to or removed from threads by a member with the MANAGE_THREADS permission.
971 Snowflake id{};///< Id of the tag.
972
973 ForumTagData() noexcept = default;
974
975 ForumTagData(Value jsonData);
976
977 virtual ~ForumTagData() noexcept = default;
978 };
979
980 /// \brief Data structure representing a single Channel.
981 class DiscordCoreAPI_Dll ChannelData : public DiscordEntity {
982 public:
983 friend class GuildData;
984
985 std::vector<OverWriteData> permissionOverwrites{};///< Permission overwrites.
986 ChannelType type{ ChannelType::DM };///< The type of the Channel.
987 SortOrderTypes defaultSortOrder{};///< Default sorting order for a forum thread.
988 uint32_t memberCount{};///< Count of members active in the Channel.
989 StringWrapper topic{};///< Channel topic.
990 Snowflake parentId{};///< Id of the Channel's parent Channel/category.
991 StringWrapper name{};///< Name of the Channel.
992 ChannelFlags flags{};///< Flags combined as a bitmask.
993 uint16_t position{};///< The position of the Channel, in the Guild's Channel list.
994 Snowflake ownerId{};///< Id of the Channel's owner.
995 Snowflake guildId{};///< Id of the Channel's Guild, if applicable.
996
997 ChannelData() noexcept = default;
998
999 ChannelData& operator=(ChannelData&&) noexcept = default;
1000
1001 ChannelData(ChannelData&&) noexcept = default;
1002
1003 ChannelData& operator=(const ChannelData&) noexcept = default;
1004
1005 ChannelData(const ChannelData&) noexcept = default;
1006
1007 ChannelData(Value);
1008
1009 template<IsEnum ETy> bool getFlagValue(ETy theEnum) {
1010 return getBool(this->flags, theEnum);
1011 }
1012
1013 virtual ~ChannelData() noexcept = default;
1014 };
1015
1016 /// \brief Data representing an active Thread.
1017 struct DiscordCoreAPI_Dll ActiveThreadsData {
1018 std::vector<ThreadMemberData> members{};
1019 std::vector<ChannelData> threads{};
1020 bool hasMore{};
1021
1022 ActiveThreadsData() noexcept = default;
1023
1024 ActiveThreadsData(Value jsonData);
1025
1026 virtual ~ActiveThreadsData() noexcept = default;
1027 };
1028
1029 /// \brief Data representing an archived Thread.
1030 struct DiscordCoreAPI_Dll ArchivedThreadsData {
1031 std::vector<ThreadMemberData> members{};
1032 std::vector<ChannelData> threads{};
1033 bool hasMore{};
1034
1035 ArchivedThreadsData() noexcept = default;
1036
1037 ArchivedThreadsData(Value jsonData);
1038
1039 virtual ~ArchivedThreadsData() noexcept = default;
1040 };
1041
1042 /// \brief Application command-option types.
1043 enum class ApplicationCommandOptionType : uint8_t {
1044 Sub_Command = 1,///< Sub-command.
1045 Sub_Command_Group = 2,///< Sub-command group.
1046 String = 3,///< std::string.
1047 Integer = 4,///< Integer.
1048 Boolean = 5,///< Boolean.
1049 User = 6,///< User.
1050 Channel = 7,///< Channel.
1051 Role = 8,///< Role.
1052 Mentionable = 9,///< Mentionable.
1053 Number = 10,///< Number.
1054 Attachment = 11///< Attachment.
1055 };
1056
1057 /// \brief Application command permission-types.
1059 Role = 1,///< Role.
1060 User = 2,///< User.
1061 Channel = 3///< Channel.
1062 };
1063
1064 /// \brief Event types for auto-moderation.
1065 enum class EventType : uint8_t {
1066 Message_Send = 1,///< When a member sends or edits a message in the guild.
1067 };
1068
1069 /// \brief Trigger types for auto-moderation.
1070 enum class TriggerType : uint8_t {
1071 Keyword = 1,///< Check if content contains words from a user defined list of keywords.
1072 Spam = 3,///< Check if content represents generic spam.
1073 Keyword_Preset = 4,///< Check if content contains words from internal pre-defined wordsets.
1074 Mention_Spam = 5///< Check if content contains more unique mentions than allowed.
1075 };
1076
1077 /// \brief Keyword preset types for auto-moderation.
1078 enum class KeywordPresetType : uint8_t {
1079 Profanity = 1,///< Words that may be considered forms of swearing or cursing.
1080 Sexual_Content = 2,///< Words that refer to sexually explicit behavior or activity
1081 Slurs = 3///< Personal insults or words that may be considered hate speech.
1082 };
1083
1084 /// \brief Action types for auto-moderation.
1085 enum class ActionType : uint8_t {
1086 Block_Message = 1,///< Blocks the content of a message according to the rule.
1087 Send_Alert_Message = 2,///< Logs user content to a specified channel.
1088 Timeout = 3///< Timeout user for a specified duration.
1089 };
1090
1091 /// \brief Action metadata for auto-moderation-rules.
1092 struct DiscordCoreAPI_Dll ActionMetaData {
1093 int64_t durationSeconds{};///< Timeout duration in seconds.
1094 Snowflake channelId{};///< Channel to which user content should be logged.
1095
1096 ActionMetaData() noexcept = default;
1097
1098 ActionMetaData(Value jsonData);
1099
1100 virtual ~ActionMetaData() noexcept = default;
1101 };
1102
1103 /// \brief Trigger metadata for auto-moderation-rules.
1104 struct DiscordCoreAPI_Dll TriggerMetaData {
1105 std::vector<KeywordPresetType> presets{};///< The internally pre-defined wordsets which will be searched for in content.
1106 std::vector<std::string> keywordFilter{};///< Substrings which will be searched for in content.keyword_filter array of strings.
1107 std::vector<std::string> allowList{};///< Substrings which will be exempt from triggering the preset trigger type.
1108 int32_t mentionTotalLimit{};///< Total number of unique role and user mentions allowed per message (Maximum of 50).
1109
1110 TriggerMetaData() noexcept = default;
1111
1112 TriggerMetaData(Value jsonData);
1113
1114 virtual ~TriggerMetaData() noexcept = default;
1115 };
1116
1117 /// \brief For representing a single auto-moderation-rule-action.
1118 struct DiscordCoreAPI_Dll ActionData {
1119 ActionMetaData metadata{};///< Additional metadata needed during execution for this specific action type.
1120 ActionType type{};///< The type of action.
1121
1122 ActionData() noexcept = default;
1123
1124 ActionData(Value jsonData);
1125
1126 virtual ~ActionData() noexcept = default;
1127 };
1128
1129 /// \brief Represents an auto-moderation-rule.
1130 class DiscordCoreAPI_Dll AutoModerationRuleData : public DiscordEntity {
1131 public:
1132 std::vector<Snowflake> exemptChannels{};///< The channel ids that should not be affected by the rule(Maximum of 50).
1133 std::vector<Snowflake> exemptRoles{};///< The role ids that should not be affected by the rule(Maximum of 20).
1134 TriggerMetaData triggerMetaData{};///< The rule trigger metadata actions array of action objects the.
1135 std::vector<ActionData> actions{};///< Actions which will execute when the rule is triggered.
1136 TriggerType triggerType{};///< The rule trigger type.
1137 EventType eventType{};///< The rule event type.
1138 Snowflake creatorId{};///< The user which first created this rule.
1139 Snowflake guildId{};///< The guild which this rule belongs to.
1140 std::string name{};///< The rule name.
1141 bool enabled{};///< Whether the rule is enabled.
1142
1143 AutoModerationRuleData() noexcept = default;
1144
1145 AutoModerationRuleData(Value jsonData);
1146
1147 virtual ~AutoModerationRuleData() noexcept = default;
1148 };
1149
1150 /// \brief Permissions data for an ApplicationCommand.
1151 class DiscordCoreAPI_Dll ApplicationCommandPermissionData : public DiscordEntity {
1152 public:
1153 ApplicationCommandPermissionType type{ ApplicationCommandPermissionType::Role };///< The type of PermissionTypes.
1154 bool permission{};///< Whether the PermissionTypes is active or not.
1155
1156 ApplicationCommandPermissionData() noexcept = default;
1157
1158 ApplicationCommandPermissionData(Value jsonData);
1159
1160 virtual ~ApplicationCommandPermissionData() noexcept = default;
1161 };
1162
1163 /// \brief Represents the Permissions for accessing an ApplicationCommand from within a Guild.
1164 class DiscordCoreAPI_Dll GuildApplicationCommandPermissionsData : public DiscordEntity {
1165 public:
1166 std::vector<ApplicationCommandPermissionData> permissions{};///< The Permissions.
1167 Snowflake applicationId{};///< The application's id.
1168 Snowflake guildId{};///< The Guild's id.
1169
1170 GuildApplicationCommandPermissionsData() noexcept = default;
1171
1173
1174 virtual ~GuildApplicationCommandPermissionsData() noexcept = default;
1175 };
1176
1177 class DiscordCoreAPI_Dll GuildApplicationCommandPermissionsDataVector {
1178 public:
1179 GuildApplicationCommandPermissionsDataVector() noexcept = default;
1180
1181 operator std::vector<GuildApplicationCommandPermissionsData>();
1182
1183 GuildApplicationCommandPermissionsDataVector(Value jsonData);
1184
1185 virtual ~GuildApplicationCommandPermissionsDataVector() noexcept = default;
1186
1187 protected:
1188 std::vector<GuildApplicationCommandPermissionsData> guildApplicationCommandPermissionss{};
1189 };
1190
1191 class DiscordCoreAPI_Dll EmojiDataVector {
1192 public:
1193 EmojiDataVector() noexcept = default;
1194
1195 EmojiDataVector(Value jsonData);
1196
1197 virtual ~EmojiDataVector() noexcept = default;
1198
1199 protected:
1200 std::vector<EmojiData> theEmojis{};
1201 };
1202
1203 /// \brief For updating/modifying a given Channel's properties.
1204 struct DiscordCoreAPI_Dll UpdateChannelData {
1205 std::vector<OverWriteData> permissionOverwrites{};
1206 int32_t defaultAutoArchiveDuration{ 10080 };
1207 int32_t videoQualityMode{ 1 };
1208 int32_t rateLimitPerUser{};
1209 int32_t bitrate{ 48000 };
1210 std::string parentId{};
1211 std::string rtcRgion{};
1212 int32_t userLimit{};
1213 std::string topic{};
1214 int32_t position{};
1215 ChannelType type{};
1216 std::string name{};
1217 bool nsfw{};
1218 };
1219
1220 /// \brief/// Data structure representing a single reaction.
1221 class DiscordCoreAPI_Dll ReactionData : public DiscordEntity {
1222 public:
1223 GuildMemberData member{};///< The GuildMember who placed the reaction.
1224 Snowflake channelId{};///< The id of the Channel where it was placed.
1225 Snowflake messageId{};///< The id of the Message upon which it was placed.
1226 Snowflake guildId{};///< The id of the Guild where it was placed.
1227 Snowflake userId{};///< The id of the User who placed the reaction.
1228 EmojiData emoji{};///< The emoji that was placed as a reaction.
1229 int32_t count{};///< The number of times this particular emoji was placed as a reaction to the given Message.
1230 bool me{};///< Whether or not I (The bot) placed it.
1231
1232 ReactionData() noexcept = default;
1233
1234 ReactionData(Value jsonData);
1235
1236 virtual ~ReactionData() noexcept = default;
1237 };
1238
1239 /// \brief Structure representing Voice Region Data.
1240 struct DiscordCoreAPI_Dll VoiceRegionData {
1241 std::string name{};///< Name of the region.
1242 bool deprecated{};///< Whether this is a deprecated voice region(avoid switching to these).
1243 Snowflake id{};///< Unique ID for the region.
1244 bool optimal{};///< True for a single server that is closest to the current User's client.
1245 bool custom{};///< Whether this is a custom voice region(used for events / etc).
1246
1247 VoiceRegionData() noexcept = default;
1248
1249 VoiceRegionData(Value jsonData);
1250
1251 virtual ~VoiceRegionData() noexcept = default;
1252 };
1253
1254 class DiscordCoreAPI_Dll VoiceRegionDataVector {
1255 public:
1256 VoiceRegionDataVector() noexcept = default;
1257
1258 operator std::vector<VoiceRegionData>();
1259
1260 VoiceRegionDataVector(Value jsonData);
1261
1262 virtual ~VoiceRegionDataVector() noexcept = default;
1263
1264 protected:
1265 std::vector<VoiceRegionData> voiceRegions{};
1266 };
1267
1268 /// \brief Message activity types.
1269 enum class MessageActivityType : uint8_t {
1270 Join = 1,///< Join.
1271 Spectate = 2,///< Spectate.
1272 Listen = 3,///< Listen.
1273 Join_Request = 5///< Join-request.
1274 };
1275
1276 /// \brief Message activity data.
1277 struct DiscordCoreAPI_Dll MessageActivityData {
1278 MessageActivityType type{ MessageActivityType::Join };///< Message activity type.
1279 std::string partyId{};///< Party id.
1280
1281 MessageActivityData() noexcept = default;
1282
1283 MessageActivityData(Value jsonData);
1284
1285 virtual ~MessageActivityData() noexcept = default;
1286 };
1287
1288 /// \brief Ban data.
1289 struct DiscordCoreAPI_Dll BanData {
1290 bool failedDueToPerms{};///< Failed due to perms?
1291 std::string reason{};///< Reason for the ban.
1292 UserData user{};///< User that was banned.
1293
1294 BanData() noexcept = default;
1295
1296 BanData(Value jsonData);
1297
1298 virtual ~BanData() noexcept = default;
1299 };
1300
1301 class DiscordCoreAPI_Dll BanDataVector {
1302 public:
1303 BanDataVector() noexcept = default;
1304
1305 operator std::vector<BanData>();
1306
1307 BanDataVector(Value jsonData);
1308
1309 virtual ~BanDataVector() noexcept = default;
1310
1311 protected:
1312 std::vector<BanData> bans{};
1313 };
1314
1315 /// \brief Team members object data.
1316 struct DiscordCoreAPI_Dll TeamMembersObjectData {
1317 std::vector<Permissions> permissions{};///< Permissions for the team.
1318 int32_t membershipState{};///< Current state.
1319 Snowflake teamId{};///< Id of the current team.
1320 UserData user{};///< User data of the current User.
1321
1322 TeamMembersObjectData() noexcept = default;
1323
1324 TeamMembersObjectData(Value jsonData);
1325
1326 virtual ~TeamMembersObjectData() noexcept = default;
1327 };
1328
1329 /// \brief For updating the current voice state.
1330 struct DiscordCoreAPI_Dll UpdateVoiceStateData {
1331 Snowflake channelId{};///< Id of the desired voice Channel. Leave blank to disconnect.
1332 Snowflake guildId{};///< The id of the Guild fo which we would like to establish a voice connection.
1333 bool selfMute{};///< Whether or not we self-mute ourselves.
1334 bool selfDeaf{};///< Whether or not we self-deafen ourselves.
1335
1336 operator Serializer();
1337 };
1338
1339 /// \brief Team object data.
1340 class DiscordCoreAPI_Dll TeamObjectData : public DiscordEntity {
1341 public:
1342 std::vector<TeamMembersObjectData> members{};///< Array of team members object data.
1343 Snowflake ownerUserId{};///< User id of the team owner.
1344 std::string icon{};///< Icon for the team.
1345
1346 TeamObjectData() noexcept = default;
1347
1348 TeamObjectData(Value jsonData);
1349
1350 virtual ~TeamObjectData() noexcept = default;
1351 };
1352
1353 /// Application flags, for the ApplicationData structure.
1354 enum class ApplicationFlags : uint32_t {
1355 Gateway_Presence = 1 << 12,///< Intent required for bots in 100 or more servers to receive presence_update events.
1357 1 << 13,///< Intent required for bots in under 100 servers to receive presence_update events, found in Bot Settings.
1359 1 << 14,///< Intent required for bots in 100 or more servers to receive member-related events like guild_member_add.
1361 << 15,///< Intent required for bots in under 100 servers to receive member-related events like guild_member_add, found in Bot Settings.
1362 Verificatino_Pending_Guild_Limit = 1 << 16,///< Indicates unusual growth of an app that prevents verification
1363 Embedded = 1 << 17,///< Indicates if an app is embedded within the Discord client (currently unavailable publicly)
1364 Gateway_Message_Content = 1 << 18,///< Intent required for bots in 100 or more servers to receive message content
1366 1 << 19///< Intent required for bots in under 100 servers to receive message content, found in Bot Settings};
1367 };
1368
1369 /// \brief Install params data, for application data.
1370 struct DiscordCoreAPI_Dll InstallParamsData {
1371 std::vector<std::string> scopes{};///< The scopes to add the application to the server with.
1372 Permissions permissions{};///< The permissions to request for the bot role.
1373
1374 InstallParamsData() noexcept = default;
1375
1376 InstallParamsData(Value jsonData);
1377
1378 virtual ~InstallParamsData() noexcept = default;
1379 };
1380
1381 /// \brief Application data.
1382 class DiscordCoreAPI_Dll ApplicationData : public DiscordEntity {
1383 public:
1384 std::vector<std::string> rpcOrigins{};///< Array of RPC origin strings.
1385 std::vector<std::string> tags{};///< Up to 5 tags describing the content and functionality of the application install_params.
1386 std::string termsOfServiceUrl{};///< Terms of service Url.
1387 std::string privacyPolicyUrl{};///< Privacy policy Url.
1388 std::string customInstallUrl{};
1389 std::string primarySkuId{};///< Primary SKU Id.
1390 InstallParamsData params{};///< Settings for the application's default in-app authorization link, if enabled.
1391 bool botRequireCodeGrant{};///< Does the bot require a code grant?
1392 std::string description{};///< Description of the application.
1393 std::string coverImage{};///< The cover image.
1394 ApplicationFlags flags{};///< Application flags.
1395 std::string verifyKey{};///< The verification key.
1396 TeamObjectData team{};///< Team object data.
1397 std::string summary{};///< Summary of the application.
1398 Snowflake guildId{};///< Guild id.
1399 std::string slug{};///< Sluhg.
1400 std::string name{};///< Application's name.
1401 std::string icon{};///< Application's icon.
1402 bool botPublic{};///< Is the bot public?
1403 UserData owner{};///< Application's owner.
1404
1405 ApplicationData() noexcept = default;
1406
1407 ApplicationData(Value jsonData);
1408
1409 virtual ~ApplicationData() noexcept = default;
1410 };
1411
1412 /// \brief Authorization info structure.
1413 struct DiscordCoreAPI_Dll AuthorizationInfoData {
1414 std::vector<std::string> scopes{};///< Array of strings - the scopes the User has authorized the application for.
1415 ApplicationData application{};///< Partial application object the current application.
1416 std::string expires{};///< When the access token expires.
1417 UserData user{};/// The User who has authorized, if the User has authorized with the identify scope.
1418
1419 AuthorizationInfoData() noexcept = default;
1420
1421 AuthorizationInfoData(Value jsonData);
1422
1423 virtual ~AuthorizationInfoData() noexcept = default;
1424 };
1425
1426 /// \brief Account data.
1427 class DiscordCoreAPI_Dll AccountData : public DiscordEntity {
1428 public:
1429 std::string name{};///< Name of the account.
1430
1431 AccountData() noexcept = default;
1432
1433 AccountData(Value jsonData);
1434
1435 virtual ~AccountData() noexcept = default;
1436 };
1437
1438 /// \brief Guild Widget Data.
1439 struct DiscordCoreAPI_Dll GuildWidgetData {
1440 Snowflake channelId{};///< The widget Channel id.
1441 bool enabled{};///< Whether the widget is enabled.
1442
1443 GuildWidgetData() noexcept = default;
1444
1445 GuildWidgetData(Value jsonData);
1446
1447 virtual ~GuildWidgetData() noexcept = default;
1448 };
1449
1450 /// \brief Get Guild Widget Data.
1451 struct DiscordCoreAPI_Dll GetGuildWidgetObjectData : public DiscordEntity {
1452 std::vector<ChannelData> channels{};///< Voice and stage channels which are accessible by everyone.
1453 std::vector<UserData> members{};///< Special widget user objects that includes users presence (Limit 100).
1454 std::string instantInvite{};///< Instant invite for the guilds specified widget invite channel.
1455 int32_t presence_count{};///< Number of online members in this guild.
1456 std::string name{};///< Guild name (2-100 characters).
1457 };
1458
1459 /// \brief Widget style options.
1460 enum class WidgetStyleOptions : uint8_t {
1461 Shield = 0,///< Shield
1462 Banner1 = 1,///< Banner1
1463 Banner2 = 2,///< Banner2
1464 Banner3 = 3,///< Banner3
1465 Banner4 = 4///< Banner4
1466 };
1467
1468 /// \brief Guild widget image data.
1469 struct DiscordCoreAPI_Dll GuildWidgetImageData {
1470 std::string url{};
1471
1472 GuildWidgetImageData() noexcept = default;
1473
1474 GuildWidgetImageData(Value jsonData);
1475
1476 virtual ~GuildWidgetImageData() noexcept = default;
1477 };
1478
1479 /// \brief Integration data.
1480 class DiscordCoreAPI_Dll IntegrationData : public DiscordEntity {
1481 public:
1482 ApplicationData application{};///< Application data.
1483 bool enableEmoticons{ true };///< Emoticons enabled?
1484 int32_t expireGracePeriod{};///< How int64_t before the integration expires.
1485 int32_t subscriberCount{};///< Number of current subscribers.
1486 int32_t expireBehavior{};///< What to do upon expiry.
1487 AccountData account{};///< Account data.
1488 TimeStamp syncedAt{};///< Time it was last synced at.
1489 Snowflake roleId{};///< Role Id.
1490 std::string name{};///< Name of the integration.
1491 std::string type{};///< Type of integration.
1492 UserData user{};///< User data for the integration.
1493 bool revoked{};///< Has it been revoked?
1494 bool enabled{};///< Enabled?
1495 bool syncing{};///< Is it syncing?
1496
1497 IntegrationData() noexcept = default;
1498
1499 IntegrationData(Value jsonData);
1500
1501 virtual ~IntegrationData() noexcept = default;
1502 };
1503
1504 class DiscordCoreAPI_Dll IntegrationDataVector {
1505 public:
1506 IntegrationDataVector() noexcept = default;
1507
1508 operator std::vector<IntegrationData>();
1509
1510 IntegrationDataVector(Value jsonData);
1511
1512 virtual ~IntegrationDataVector() noexcept = default;
1513
1514 protected:
1515 std::vector<IntegrationData> integeregrations{};
1516 };
1517
1518 /// \brief Audit log events.
1519 enum class AuditLogEvent : uint8_t {
1520 Guild_Update = 1,///< Guild update.
1521 Channel_Create = 10,///< Channel create.
1522 Channel_Update = 11,///< Channel update.
1523 Channel_Delete = 12,///< Channel delete.
1524 Channel_Overwrite_Create = 13,///< Channel overwrite create.
1525 Channel_Overwrite_Update = 14,///< Channel overwrite update.
1526 Channel_Overwrite_Delete = 15,///< Channel overwrite delete.
1527 Member_Kick = 20,///< Member kick.
1528 Member_Prune = 21,///< Member prune.
1529 Member_Ban_Add = 22,///< Member ban add.
1530 Member_Ban_Remove = 23,///< Member ban remove.
1531 Member_Update = 24,///< Member update.
1532 Member_Role_Update = 25,///< Member role update.
1533 Member_Move = 26,///< Member move.
1534 Member_Disconnect = 27,///< Member disconnect.
1535 Bot_Add = 28,///< Bot add.
1536 Role_Create = 30,///< Role create.
1537 Role_Update = 31,///< Role update.
1538 Role_Delete = 32,///< Role delete.
1539 Invite_Create = 40,///< Invite create.
1540 Invite_Update = 41,///< Invite update.
1541 Invite_Delete = 42,///< Invite delete.
1542 Webhook_Create = 50,///< Webhook create.
1543 Webhook_Update = 51,///< Webhook update.
1544 Webhook_Delete = 52,///< Webhook delete.
1545 Emoji_Create = 60,///< Emoji create.
1546 Emoji_Update = 61,///< Emoji update.
1547 Emoji_Delete = 62,///< Emoji delete.
1548 Message_Delete = 72,///< Message delete.
1549 Message_Bulk_Delete = 73,///< Message bulk delete.
1550 Message_Pin = 74,///< Message pin.
1551 Message_Unpin = 75,///< Message unpin.
1552 Integration_Create = 80,///< Integration create.
1553 Integration_Update = 81,///< Integration update.
1554 Integration_Delete = 82,///< Integration delete.
1555 Stage_Instance_Create = 83,///< Stage-Instance create.
1556 Stage_Instance_Update = 84,///< Stage-Instance update.
1557 Stage_Instance_Delete = 85,///< Stage-Instance delete.
1558 Sticker_Create = 90,///< Sticker create.
1559 Sticker_Update = 91,///< Sticker update.
1560 Sticker_Delete = 92,///< Sticker delete.
1561 Guild_Scheduled_Event_Create = 100,///< Guild-scheduled-event create.
1562 Guild_Scheduled_Event_Update = 101,///< Guild-scheduled-event update.
1563 Guild_Scheduled_Event_Delete = 102,///< Guild-scheduled-event delete.
1564 Thread_Create = 110,///< Thread create.
1565 Thread_Update = 111,///< Thread update.
1566 Thread_Delete = 112,///< Thread delete.
1567 Application_Command_Permission_Update = 121,///< Permissions were updated for a command.
1568 Auto_Moderation_Rule_Create = 140,///< Auto Moderation rule was created.
1569 Auto_Moderation_Rule_Update = 141,///< Auto Moderation rule was updated.
1570 Auto_Moderation_Rule_Delete = 142,///< Auto Moderation rule was deleted.
1571 Auto_Moderation_Block_Message = 143///< Message was blocked by AutoMod (according to a rule).
1572 };
1573
1574 /// Audit log entry info data \brief Audit log entry info data.
1575 class DiscordCoreAPI_Dll OptionalAuditEntryInfoData : public DiscordEntity {
1576 public:
1577 std::string deleteMemberDays{};///< Number of days for which the member's Messages were deleted.
1578 std::string membersRemoved{};///< Number of members that were removed upon a prune.
1579 Snowflake applicationId{};///< ID of the app whose permissions were targeted APPLICATION_COMMAND_PERMISSION_UPDATE.
1580 std::string roleName{};///< Role name.
1581 Snowflake channelId{};///< Channel Id.
1582 Snowflake messageId{};///< Message Id.
1583 std::string count{};///< Count.
1584 std::string type{};///< Type.
1585
1586 OptionalAuditEntryInfoData() noexcept = default;
1587
1588 OptionalAuditEntryInfoData(Value jsonData);
1589
1590 virtual ~OptionalAuditEntryInfoData() noexcept = default;
1591 };
1592
1593 /// \brief Audit log change data.
1594 struct DiscordCoreAPI_Dll AuditLogChangeData {
1595 JsonStringValue newValue{};///< New value.
1596 JsonStringValue oldValue{};///< Old value.
1597 std::string key{};///< The key of the audit log change.
1598
1599 AuditLogChangeData() noexcept = default;
1600
1601 AuditLogChangeData(Value jsonData);
1602
1603 virtual ~AuditLogChangeData() noexcept = default;
1604 };
1605
1606 /// \brief Guild prune count data.
1607 struct DiscordCoreAPI_Dll GuildPruneCountData {
1608 int32_t count{};
1609
1610 GuildPruneCountData() noexcept = default;
1611
1612 GuildPruneCountData(Value jsonData);
1613
1614 virtual ~GuildPruneCountData() noexcept = default;
1615 };
1616
1617 /// \brief Audit log entry data.
1618 class DiscordCoreAPI_Dll AuditLogEntryData : public DiscordEntity {
1619 public:
1620 std::vector<AuditLogChangeData> changes{};///< Array of audit log change data.
1621 OptionalAuditEntryInfoData options{};///< Audit log entry info data.
1622 TimeStamp createdTimeStamp{};///< Time at which this entry was created.
1623 AuditLogEvent actionType{};///< Audit log action type.
1624 std::string reason{};///< The reason that was entered for the given change.
1625 Snowflake targetId{};///< Id of the target User.
1626 Snowflake userId{};///< Id of the executing User.
1627
1628 AuditLogEntryData() noexcept = default;
1629
1630 AuditLogEntryData(Value jsonData);
1631
1632 virtual ~AuditLogEntryData() noexcept = default;
1633 };
1634
1635 /// \brief Premium tier levels.
1636 enum class PremiumTier : uint8_t {
1637 None = 0,///< None.
1638 Tier_1 = 1,///< Tier 1.
1639 Tier_2 = 2,///< Tier 2.
1640 Tier_3 = 3///< Tier 3.
1641 };
1642
1643 /// \brief Default Message notification
1644 /// levels.
1645 enum class DefaultMessageNotificationLevel : uint8_t {
1646 All_Messages = 0,///< All messages.
1647 Only_Mentions = 1///< Only mentions.
1648 };
1649
1650 /// \brief Explicit content filter levels.
1651 enum class ExplicitContentFilterLevel : uint8_t {
1652 Disabled = 0,///< Disabled.
1653 Members_Without_Roles = 1,///< Members without roles.
1654 All_Members = 2///< All members.
1655 };
1656
1657 /// \brief MFA levels.
1658 enum class MFALevel : uint8_t {
1659 None = 0,///< None.
1660 Elevated = 1///< Elevated.
1661 };
1662
1663 /// \brief/// Verification levels.
1664 enum class VerificationLevel : uint8_t {
1665 None = 0,///< None.
1666 Low = 1,///< Low.
1667 Medium = 2,///< Medium.
1668 High = 3,///< High.
1669 Very_High = 4///< Very high.
1670 };
1671
1672 /// \brief Welcome screen Channel data.
1673 struct DiscordCoreAPI_Dll WelcomeScreenChannelData {
1674 std::string description{};///< Description of the welcome Channel.
1675 std::string emojiName{};///< Emoji name for the Channel.
1676 Snowflake channelId{};///< Id of the welcome Channel.
1677 Snowflake emojiId{};///< Emoji id for the Channel.
1678
1679 WelcomeScreenChannelData() noexcept = default;
1680
1681 WelcomeScreenChannelData(Value jsonData);
1682
1683 virtual ~WelcomeScreenChannelData() noexcept = default;
1684 };
1685
1686 /// \brief Welcome screen data.
1687 struct DiscordCoreAPI_Dll WelcomeScreenData {
1688 std::vector<WelcomeScreenChannelData> welcomeChannels{};///< Welcome screen Channel data.
1689 std::string description{};///< Description of the welcome screen.
1690
1691 WelcomeScreenData() noexcept = default;
1692
1693 WelcomeScreenData(Value jsonData);
1694
1695 virtual ~WelcomeScreenData() noexcept = default;
1696 };
1697
1698 /// \brief Stage instance privacy levels.
1699 enum class StageInstancePrivacyLevel : uint8_t {
1700 Public = 1,///< Public.
1701 Guild_Only = 2///< Guild only.
1702 };
1703
1704 /// \brief Stage instance data.
1705 class DiscordCoreAPI_Dll StageInstanceData : public DiscordEntity {
1706 public:
1707 StageInstancePrivacyLevel privacyLevel{};///< Privacy level of the Channel.
1708 bool discoverableDisabled{};///< Is it discoverable?
1709 Snowflake channelId{};///< The Channel's id.
1710 Snowflake guildId{};///< The Guild id for which the Channel exists in.
1711 std::string topic{};///< The topic of the StageInstance.
1712
1713 StageInstanceData() noexcept = default;
1714
1715 StageInstanceData(Value jsonData);
1716
1717 virtual ~StageInstanceData() noexcept = default;
1718 };
1719
1720 /// \brief Sticker types.
1721 enum class StickerType : uint8_t {
1722 Standard = 1,///< Standard.
1723 Guild = 2///< Guild.
1724 };
1725
1726 enum class StickerFlags : uint8_t { Available = 1 << 0 };
1727
1728 /// \brief Data representing a single Sticker.
1729 class DiscordCoreAPI_Dll StickerData : public DiscordEntity {
1730 public:
1731 StickerFormatType formatType{};///< Format type.
1732 std::string description{};///< Description of the Sticker.
1733 StickerFlags flags{};///< Sticker flags.
1734 std::string packId{};///< Pack id of the Sticker.
1735 int32_t nsfwLevel{};///< NSFW warning level.
1736 int32_t sortValue{};///< Where in the stack of stickers it resides.
1737 Snowflake guildId{};///< The Guild id for which the Sticker exists in.
1738 std::string asset{};///< Asset value for the Sticker
1739 StickerType type{};///< The type of Sticker.
1740 std::string name{};///< The Sticker's name.
1741 std::string tags{};///< Tags for the Sticker to use.
1742
1743 UserData user{};///< The User that uploaded the Guild Sticker.
1744
1745 StickerData() noexcept = default;
1746
1747 StickerData(Value jsonData);
1748
1749 virtual ~StickerData() noexcept = default;
1750 };
1751
1752 /// \brief Data representing a single Guild preview.
1753 struct DiscordCoreAPI_Dll GuildPreviewData {
1754 std::vector<StickerData> stickers{};
1755 std::vector<std::string> features{};
1756 int32_t approximatePresenceCount{};
1757 int32_t approximateMemberCount{};
1758 std::vector<EmojiData> emojis{};
1759 std::string discoverySplash{};
1760 std::string description{};
1761 std::string splash{};
1762 std::string name{};
1763 std::string icon{};
1764 Snowflake id{};
1765
1766 GuildPreviewData() noexcept = default;
1767
1768 GuildPreviewData(Value jsonData);
1769
1770 virtual ~GuildPreviewData() noexcept = default;
1771 };
1772
1773 /// \brief Afk timeout durations.
1774 enum class AfkTimeOutDurations : uint16_t {
1775 Shortest = 60,///< Shortest.
1776 Short = 300,///< Short.
1777 Medium = 900,///< Medium.
1778 Long = 1800,///< Long.
1779 Longest = 3600///< Longest.
1780 };
1781
1782 /// \brief Guild NSFW level.
1783 enum class GuildNSFWLevel : uint8_t {
1784 Default = 0,///< Default.
1785 Explicit = 1,///< Explicit.
1786 Safe = 2,///< Safe.
1787 Age_Restricted = 3///< Age restricted.
1788 };
1789
1790 /// \brief System channel flags.
1791 enum class SystemChannelFlags : uint8_t {
1792 Suppress_Join_Notifications = 1 << 0,///< Suppress member join notifications.
1793 Suppress_Premium_Subscriptions = 1 << 1,///< Suppress server boost notifications.
1794 Suppress_Guild_Reminder_Notifications = 1 << 2,///< Suppress server setup tips.
1795 Suppress_Join_Notification_Replies = 1 << 3///< Hide member join sticker reply buttons.
1796 };
1797
1798 /// \brief Guild flags.
1799 enum class GuildFlags : uint8_t {
1800 WidgetEnabled = 1 << 0,///< Widget enabled.
1801 Unavailable = 1 << 1,///< Unavailable.
1802 Owner = 1 << 2,///< Owner.
1803 Large = 1 << 3,///< Large.
1804 Premium_Progress_Bar_Enabled = 1 << 4///< Premium progress bar enabled
1805 };
1806
1807 /// \brief Data structure representing a single Guild.
1808 class DiscordCoreAPI_Dll GuildData : public DiscordEntity {
1809 public:
1810 DiscordCoreClient* discordCoreClient{ nullptr };///< A pointer to the DiscordCoreClient.
1811 VoiceConnection* voiceConnectionPtr{ nullptr };///< A pointer to the VoiceConnection, if present.
1812 std::vector<Snowflake> guildScheduledEvents{};///< Array of Guild channels.
1813 std::vector<PresenceUpdateData> presences{};///< Presence states for each of the GuildMembers..
1814 std::vector<Snowflake> stageInstances{};///< Array of Guild channels.
1815 std::vector<Snowflake> stickers{};///< Array of Guild channels.
1816 std::vector<Snowflake> channels{};///< Array of Guild channels.
1817 std::vector<Snowflake> threads{};///< Array of Guild channels.
1818 std::vector<Snowflake> members{};///< Array of GuildMembers.
1819 std::vector<Snowflake> roles{};///< Array of Guild roles.
1820 std::vector<Snowflake> emoji{};///< Array of Guild channels.
1821 uint32_t memberCount{};///< Member count.
1822 TimeStamp joinedAt{};///< When the bot joined this Guild.
1823 StringWrapper name{};///< The Guild's name.
1824 Snowflake ownerId{};///< User id of the Guild's owner.
1825 GuildFlags flags{};///< Guild flags.
1826 IconHash icon{};///< Url to the Guild's icon.
1827
1828 GuildData() noexcept = default;
1829
1830 GuildData& operator=(GuildData&&) noexcept = default;
1831
1832 GuildData(GuildData&&) noexcept = default;
1833
1834 GuildData& operator=(const GuildData&) noexcept = default;
1835
1836 GuildData(const GuildData&) noexcept = default;
1837
1838 GuildData(Value jsonData);
1839
1840 /// \brief For connecting to an individual voice channel.
1841 /// \param guildMemberId An id of the guild member who's current voice channel to connect to.
1842 /// \param channelId An id of the voice channel to connect to.
1843 /// \param selfDeaf Whether or not to self-deafen the bot.
1844 /// \param selfMute Whether or not to self-mute the bot.
1845 /// \param streamInfo For usage with the Vc-to-Vc audio streaming option.
1846 /// \returns VoiceConnection* A pointer to the currently held voice connection, or nullptr if it failed to connect.
1847 VoiceConnection* connectToVoice(const Snowflake guildMemberId, const Snowflake channelId = Snowflake{}, bool selfDeaf = false,
1848 bool selfMute = false, StreamInfo streamInfo = StreamInfo{});
1849
1850 template<IsEnum ETy> bool getFlagValue(ETy theEnum) {
1851 return getBool(this->flags, theEnum);
1852 }
1853
1854 std::string getBannerUrl() noexcept;
1855
1856 std::string getIconUrl() noexcept;
1857
1858 bool areWeConnected();
1859
1860 void disconnect();
1861
1862 virtual ~GuildData() noexcept = default;
1863 };
1864
1865 class DiscordCoreAPI_Dll GuildDataVector {
1866 public:
1867 friend class Guilds;
1868
1869 GuildDataVector() noexcept = default;
1870
1871 operator std::vector<GuildData>();
1872
1873 GuildDataVector(Value jsonData);
1874
1875 virtual ~GuildDataVector() noexcept = default;
1876
1877 protected:
1878 std::vector<GuildData> guilds{};
1879 };
1880
1881 /// \brief Guild scheduled event privacy levels.
1882 enum class GuildScheduledEventPrivacyLevel : uint8_t {
1883 Public = 1,///< Public.
1884 Guild_Only = 2///< Guild only.
1885 };
1886
1887 /// \brief GuildScheduledEventStatus.
1888 enum class GuildScheduledEventStatus : uint8_t {
1889 Scheduled = 1,///< Scheduled.
1890 Active = 2,///< Active.
1891 Completed = 3,///< Completed.
1892 Canceled = 4///< Cancelled.
1893 };
1894
1895 /// \brief Guild scheduled event entity types.
1896 enum class GuildScheduledEventEntityType : uint8_t {
1897 None = 0,///< None.
1898 State_Instance = 1,///< Stage instance.
1899 Voice = 2,///< Voice.
1900 External = 3///< External.
1901 };
1902
1903 /// \brief Guild scheduled event entity metadata.
1904 struct DiscordCoreAPI_Dll GuildScheduledEventMetadata {
1905 std::string location{};
1906
1907 GuildScheduledEventMetadata() noexcept = default;
1908
1909 GuildScheduledEventMetadata(Value jsonData);
1910
1911 virtual ~GuildScheduledEventMetadata() noexcept = default;
1912 };
1913
1914 /// \brief Data representing a Guild Scheduled Event.
1915 class DiscordCoreAPI_Dll GuildScheduledEventData : public DiscordEntity {
1916 public:
1917 GuildScheduledEventPrivacyLevel privacyLevel{};///< The privacy level of the scheduled event.
1918 GuildScheduledEventMetadata entityMetadata{};///< Additional metadata for the Guild scheduled event.
1919 GuildScheduledEventEntityType entityType{};///< The type of the scheduled event.
1920 GuildScheduledEventStatus status{};///< The status of the scheduled event.
1921 std::string scheduledStartTime{};///< The time the scheduled event will start.
1922 std::string scheduledEndTime{};///< The time the scheduled event will end, required if entity_type is External.
1923 std::string description{};///< The description of the scheduled event(1 - 1000 characters.
1924 Snowflake creatorId{};///< The id of the User that created the scheduled event *.
1925 Snowflake channelId{};///< The Channel id in which the scheduled event will be hosted, or null if scheduled entity type is External.
1926 Snowflake entityId{};///< The id of an entity associated with a Guild scheduled event.
1927 uint32_t userCount{};///< The number of users subscribed to the scheduled event.
1928 Snowflake guildId{};///< The Guild id which the scheduled event belongs to.
1929 UserData creator{};///< The User that created the scheduled event.
1930 std::string name{};///< The name of the scheduled event(1 - 100 characters).
1931
1932 GuildScheduledEventData() noexcept = default;
1933
1934 GuildScheduledEventData(Value jsonData);
1935
1936 virtual ~GuildScheduledEventData() noexcept = default;
1937 };
1938
1939 /// \brief Data representing a single GuildScheduledEventUser.
1940 struct DiscordCoreAPI_Dll GuildScheduledEventUserData {
1941 Snowflake guildScheduledEventId{};///< The scheduled event id which the User subscribed to/
1942 GuildMemberData member{};///< Guild member data for this User for the Guild which this event belongs to, if any.
1943 UserData user{};///< User which subscribed to an event.
1944
1945 GuildScheduledEventUserData() noexcept = default;
1946
1947 GuildScheduledEventUserData(Value jsonData);
1948
1949 virtual ~GuildScheduledEventUserData() noexcept = default;
1950 };
1951
1952 class DiscordCoreAPI_Dll GuildScheduledEventUserDataVector {
1953 public:
1954 GuildScheduledEventUserDataVector() noexcept = default;
1955
1956 operator std::vector<GuildScheduledEventUserData>();
1957
1958 GuildScheduledEventUserDataVector(Value jsonData);
1959
1960 virtual ~GuildScheduledEventUserDataVector() noexcept = default;
1961
1962 protected:
1963 std::vector<GuildScheduledEventUserData> guildScheduledEventUsers{};
1964 };
1965
1966 class DiscordCoreAPI_Dll GuildScheduledEventDataVector {
1967 public:
1968 GuildScheduledEventDataVector() noexcept = default;
1969
1970 operator std::vector<GuildScheduledEventData>();
1971
1972 GuildScheduledEventDataVector(Value jsonData);
1973
1974 virtual ~GuildScheduledEventDataVector() noexcept = default;
1975
1976 protected:
1977 std::vector<GuildScheduledEventData> guildScheduledEvents{};
1978 };
1979
1980 /// \brief Invite data.
1981 struct DiscordCoreAPI_Dll InviteData {
1982 GuildScheduledEventData guildScheduledEvent{};///< Scheduled Guild event.
1983 ApplicationData targetApplication{};///< Application data.
1984 int32_t approximatePresenceCount{};///< Approximate presence count.
1985 StageInstanceData stageInstance{};///< Stage instance data.
1986 int32_t approximateMemberCount{};///< Approximate member count.
1987 UserData targetUser{};///< Target User of the invite.
1988 ChannelData channel{};///< Channel data of the Channel that the invite is for.
1989 TimeStamp expiresAt{};///< When the invite expires.
1990 TimeStamp createdAt{};///< Time it was created at.
1991 int32_t targetType{};///< Target type.
1992 Snowflake guildId{};///< The Guild this invite is for.
1993 UserData inviter{};///< The User who created the invite.
1994 std::string code{};///< Unique invite code.
1995 GuildData guild{};///< Guild data of the Channel that the invite is for.
1996 int32_t maxUses{};///< Max number of uses.
1997 int32_t maxAge{};///< Maximum age of the invite.
1998 bool temporary{};///< Is it temporary?
1999 int32_t uses{};///< The current number of uses.
2000
2001 InviteData() noexcept = default;
2002
2003 InviteData(Value jsonData);
2004
2005 virtual ~InviteData() noexcept = default;
2006 };
2007
2008 class DiscordCoreAPI_Dll InviteDataVector {
2009 public:
2010 InviteDataVector() noexcept = default;
2011
2012 operator std::vector<InviteData>();
2013
2014 InviteDataVector(Value jsonData);
2015
2016 virtual ~InviteDataVector() noexcept = default;
2017
2018 protected:
2019 std::vector<InviteData> invites{};
2020 };
2021
2022 /// \brief Represents a Guild Template.
2023 struct DiscordCoreAPI_Dll GuildTemplateData {
2024 GuildData serializedSourceGuild{};///< The Guild snapshot this template contains.
2025 std::string sourceGuildId{};///< The ID of the Guild this template is based on.
2026 std::string description{};///< The description for the template.
2027 std::string creatorId{};///< The ID of the User who created the template.
2028 std::string createdAt{};///< When this template was created.
2029 std::string updatedAt{};///< When this template was last synced to the source Guild.
2030 uint32_t usageCount{};///< Number of times this template has been used.
2031 UserData creator{};///< The User who created the template.
2032 std::string code{};///< The template code(unique ID).
2033 std::string name{};///< Template name.
2034 bool isDirty{};///< Whether the template has unsynced changes.
2035
2036 GuildTemplateData() noexcept = default;
2037
2038 GuildTemplateData(Value jsonData);
2039
2040 virtual ~GuildTemplateData() noexcept = default;
2041 };
2042
2043 class DiscordCoreAPI_Dll GuildTemplateDataVector {
2044 public:
2045 GuildTemplateDataVector() noexcept = default;
2046
2047 operator std::vector<GuildTemplateData>();
2048
2049 GuildTemplateDataVector(Value jsonData);
2050
2051 virtual ~GuildTemplateDataVector() noexcept = default;
2052
2053 protected:
2054 std::vector<GuildTemplateData> guildTemplates{};
2055 };
2056
2057 /// \brief Invite target types.
2058 enum class InviteTargetTypes : uint8_t {
2059 Stream = 1,///< Stream.
2060 Embedded_Application = 2///< Embedded application.
2061 };
2062
2063 /// \brief WebHook types.
2064 enum class WebHookType : uint8_t {
2065 Incoming = 1,///< Incoming.
2066 Channel_Follower = 2,///< Channel follower.
2067 Application = 3///< Application.
2068 };
2069
2070 /// \brief WebHook data.
2071 class DiscordCoreAPI_Dll WebHookData : public DiscordEntity {
2072 public:
2073 ChannelData sourceChannel{};///< Channel for which th WebHook was issued.
2074 Snowflake applicationId{};///< Application id.
2075 GuildData sourceGuild{};///< Source Guild id.
2076 Snowflake channelId{};///< Channel id for which the WebHook was issued.
2077 std::string avatar{};///< Avatar of the WebHook.
2078 Snowflake guildId{};///< Guild id for which the WebHook was issued.
2079 std::string token{};///< Token of the WebHook.
2080 WebHookType type{};///< Type of WebHook.
2081 std::string name{};///< Name of the WebHook.
2082 std::string url{};///< Url of the WebHook.
2083 UserData user{};///< User which create the WebHook.
2084
2085 WebHookData() noexcept = default;
2086
2087 WebHookData(Value jsonData);
2088
2089 virtual ~WebHookData() noexcept = default;
2090 };
2091
2092 class DiscordCoreAPI_Dll WebHookDataVector {
2093 public:
2094 WebHookDataVector() noexcept = default;
2095
2096 operator std::vector<WebHookData>();
2097
2098 WebHookDataVector(Value jsonData);
2099
2100 virtual ~WebHookDataVector() noexcept = default;
2101
2102 protected:
2103 std::vector<WebHookData> webHooks{};
2104 };
2105
2106 /// \brief Audit log data.
2107 class DiscordCoreAPI_Dll AuditLogData {
2108 public:
2109 std::vector<GuildScheduledEventData> guildScheduledEvents{};///< Array of guild scheduled event objects.
2110 std::vector<AutoModerationRuleData> autoModerationRules{};///< List of auto moderation rules referenced in the audit log.
2111 std::vector<AuditLogEntryData> auditLogEntries{};///< Array of audit log entry objects.
2112 std::vector<IntegrationData> integrations{};///< Array of partial integration objects.
2113 std::vector<WebHookData> webhooks{};///< Array of webhook objects.
2114 std::vector<ChannelData> threads{};///< Array of thread-specific channel objects.
2115 std::vector<UserData> users{};///< Array of user objects.
2116
2117 auto getAuditLogData(const Snowflake userIdOfChanger, AuditLogEvent auditLogType);
2118
2119 auto getAuditLogData(AuditLogEvent auditLogType, const Snowflake userIdOfTarget);
2120
2121 AuditLogData() noexcept = default;
2122
2123 AuditLogData(Value jsonData);
2124
2125 virtual ~AuditLogData() noexcept = default;
2126 };
2127
2128 /// \brief For removing a reaction.
2129 struct DiscordCoreAPI_Dll ReactionRemoveData {
2130 Snowflake channelId{};
2131 Snowflake messageId{};
2132 Snowflake guildId{};
2133 Snowflake userId{};
2134 EmojiData emoji{};
2135
2136 ReactionRemoveData() noexcept = default;
2137
2138 ReactionRemoveData(Value jsonData);
2139
2140 virtual ~ReactionRemoveData() noexcept = default;
2141 };
2142
2143 /// \brief For storing Interaction-related values.
2144 struct DiscordCoreAPI_Dll InteractionPackageData {
2145 std::string interactionToken{};
2146 Snowflake applicationId{};
2147 Snowflake interactionId{};
2148 };
2149
2150 /// \brief For storing Message-related values.
2151 struct DiscordCoreAPI_Dll MessagePackageData {
2152 Snowflake channelId{};
2153 Snowflake messageId{};
2154 };
2155
2156 /// \brief Data structure representing an ApplicationCommand's option choice.
2157 class DiscordCoreAPI_Dll ApplicationCommandOptionChoiceData {
2158 public:
2159 std::unordered_map<std::string, std::string>
2160 nameLocalizations{};///< Dictionary with keys in available locales Localization dictionary for the name field.
2161 std::string value{};///< The value of the option.
2162 std::string name{};///< The name of the current choice.
2163 JsonType type{};///< The type of the option.
2164
2165 ApplicationCommandOptionChoiceData() noexcept = default;
2166
2169
2170 ApplicationCommandOptionChoiceData& operator=(const ApplicationCommandOptionChoiceData&) noexcept = default;
2172
2173 operator Serializer();
2174
2175 ApplicationCommandOptionChoiceData(Value jsonData);
2176
2177 friend bool operator==(const ApplicationCommandOptionChoiceData&, const ApplicationCommandOptionChoiceData&);
2178
2179 virtual ~ApplicationCommandOptionChoiceData() noexcept = default;
2180 };
2181
2182 /// \brief Data structure representing an ApplicationCommand's option.
2183 struct DiscordCoreAPI_Dll ApplicationCommandOptionData {
2184 std::unordered_map<std::string, std::string> descriptionLocalizations{};///< Dictionary for the description localizations field.
2185 std::unordered_map<std::string, std::string> nameLocalizations{};///< Dictionary for the name localizations field.
2186 std::vector<ApplicationCommandOptionChoiceData>
2187 choices{};///< A vector of possible choices for the current ApplicationCommand option.
2188 std::vector<ApplicationCommandOptionData> options{};///< A vector of possible options for the current ApplicationCommand option.
2189 std::vector<ChannelType> channelTypes{};///< Set when the ApplicationCommand option type is set to Channel.
2190 ApplicationCommandOptionType type{};///< The type of command option.
2191 std::string description{};///< A description of the current ApplicationCommand option.
2192 bool autocomplete{};///< If autocomplete interactions are enabled for this STRING, INTEGER, or NUMBER type option.
2193 int32_t minValue{};///< If the option is an INTEGER or NUMBER type, the minimum value permitted.
2194 int32_t maxValue{};///< If the option is an INTEGER or NUMBER type, the maximum value permitted.
2195 std::string name{};///< Name of the current ApplicationCommand option.
2196 bool required{};///< If the parameter is required or optional-- default false.
2197
2198 ApplicationCommandOptionData() noexcept = default;
2199
2200 operator Serializer();
2201
2202 friend bool operator==(const ApplicationCommandOptionData&, const ApplicationCommandOptionData&);
2203
2204 ApplicationCommandOptionData(Value jsonData);
2205
2206 virtual ~ApplicationCommandOptionData() noexcept = default;
2207 };
2208
2209 /// \brief Representing "TypingStart" data.
2210 struct DiscordCoreAPI_Dll TypingStartData {
2211 GuildMemberData member{};
2212 Snowflake channelId{};
2213 Snowflake guildId{};
2214 int32_t timeStamp{};
2215 Snowflake userId{};
2216
2217
2218 TypingStartData() noexcept = default;
2219
2220 TypingStartData(Value jsonData);
2221
2222 virtual ~TypingStartData() noexcept = default;
2223 };
2224
2225 struct DiscordCoreAPI_Dll YouTubeFormat {
2226 std::string signatureCipher{};
2227 std::string audioSampleRate{};
2228 std::string audioQuality{};
2229 std::string downloadUrl{};
2230 int32_t averageBitrate{};
2231 int64_t contentLength{};
2232 std::string signature{};
2233 std::string mimeType{};
2234 std::string quality{};
2235 std::string codecs{};
2236 std::string aitags{};
2237 int32_t bitrate{};
2238 int32_t height{};
2239 int32_t width{};
2240 int32_t itag{};
2241 int32_t fps{};
2242
2243 YouTubeFormat() noexcept = default;
2244
2245 YouTubeFormat(Value);
2246 };
2247
2248 /// \brief YouTube format data.
2249 class DiscordCoreAPI_Dll YouTubeFormatVector {
2250 public:
2251 YouTubeFormatVector() noexcept = default;
2252
2253 operator std::vector<YouTubeFormat>();
2254
2255 YouTubeFormatVector(Value jsonData);
2256
2257 virtual ~YouTubeFormatVector() noexcept = default;
2258
2259 protected:
2260 std::vector<YouTubeFormat> formats{};
2261 };
2262
2263 /// \brief Application command types.
2264 enum class ApplicationCommandType : uint8_t {
2265 Chat_Input = 1,///< Chat input.
2266 User = 2,///< User.
2267 Message = 3///< Message.
2268 };
2269
2270 /// \brief User command Interaction data.
2271 struct DiscordCoreAPI_Dll UserCommandInteractionData {
2272 Snowflake targetId{};///< The target User's id.
2273
2274 UserCommandInteractionData() noexcept = default;
2275
2276 UserCommandInteractionData(Value jsonData);
2277
2278 virtual ~UserCommandInteractionData() noexcept = default;
2279 };
2280
2281 /// \brief Message command interacction data.
2282 struct DiscordCoreAPI_Dll MessageCommandInteractionData {
2283 Snowflake targetId{};///< The target Message's id.
2284
2285 MessageCommandInteractionData() noexcept = default;
2286
2287 MessageCommandInteractionData(Value jsonData);
2288
2289 virtual ~MessageCommandInteractionData() noexcept = default;
2290 };
2291
2292 /// \brief Component types.
2293 enum class ComponentType : uint8_t {
2294 Action_Row = 1,///< Container for other components.
2295 Button = 2,///< Button object.
2296 String_Select = 3,///< Select menu for picking from defined text options.
2297 Text_Input = 4,///< Text input object.
2298 User_Select = 5,///< Select menu for users.
2299 Role_Select = 6,///< Select menu for roles.
2300 Mentionable_Select = 7,///< Select menu for mentionables (users and roles).
2301 Channel_Select = 8,///< Select menu for channels.
2302 };
2303
2304 enum class SelectMenuType : uint8_t { String_Select = 3, User_Select = 5, Role_Select = 6, Mentionable_Select = 7, Channel_Select = 8 };
2305
2306 /// \brief Component Interaction data.
2307 struct DiscordCoreAPI_Dll ComponentInteractionData {
2308 std::vector<std::string> values{};///< The values of the components.
2309 ComponentType componentType{};///< The type of component.
2310 std::string customId{};///< The custom id of the Interaction entity.
2311
2312 ComponentInteractionData() noexcept = default;
2313
2314 ComponentInteractionData(Value jsonData);
2315
2316 virtual ~ComponentInteractionData() noexcept = default;
2317 };
2318
2319 /// \brief Modal interaction data, for inputs from text modals.
2320 struct DiscordCoreAPI_Dll ModalInteractionData {
2321 std::string customIdSmall{};///< The custom id of a particular modal input.
2322 std::string customId{};///< The custom id of the Interaction entity.
2323 std::string value{};///< The input value of the modal.
2324
2325 ModalInteractionData() noexcept = default;
2326
2327 ModalInteractionData(Value jsonData);
2328
2329 virtual ~ModalInteractionData() noexcept = default;
2330 };
2331
2332 /// \brief Allowable mentions for a Message.
2333 class DiscordCoreAPI_Dll AllowedMentionsData {
2334 public:
2335 bool repliedUser{};///< For replies, whether to mention the author of the Message being replied to (default false).
2336 std::vector<std::string> parse{};///< A vector of allowed mention types to parse from the content.
2337 std::vector<std::string> roles{};///< Array of role_ids to mention (Max size of 100)
2338 std::vector<std::string> users{};///< Array of user_ids to mention (Max size of 100)
2339
2340 AllowedMentionsData() noexcept = default;
2341
2342 AllowedMentionsData(Value jsonData);
2343
2344 operator Serializer();
2345
2346 virtual ~AllowedMentionsData() noexcept = default;
2347 };
2348
2349 /// \brief Interaction types.
2350 enum class InteractionType : uint8_t {
2351 Ping = 1,///< Ping.
2352 Application_Command = 2,///< Application command.
2353 Message_Component = 3,///< Message component.
2354 Application_Command_Autocomplete = 4,///< Application command autocomplete.
2355 Modal_Submit = 5///< Modal submission.
2356 };
2357
2358 /// \brief Represents a single selection from a select-menu.
2359 class DiscordCoreAPI_Dll SelectOptionData {
2360 public:
2361 std::string description{};///< Description of the select-menu-option.
2362 std::string label{};///< A visible label for the select-menu-option.
2363 std::string value{};///< A value for identifying the option.
2364 EmojiData emoji{};///< An optional emoji to put on it.
2365 bool _default{};///< Is it the default option?
2366
2367 SelectOptionData() noexcept = default;
2368
2369 SelectOptionData(Value jsonData);
2370
2371 virtual ~SelectOptionData() noexcept = default;
2372 };
2373
2374 /// \brief Button styles.
2375 enum class ButtonStyle : uint8_t {
2376 Primary = 1,///< Primary.
2377 Success = 3,///< Success.
2378 Secondary = 2,///< Secondary.
2379 Danger = 4,///< Danger.
2380 Link = 5///< Link.
2381 };
2382
2383 /// \brief Represents a single Message-component.
2384 struct DiscordCoreAPI_Dll ComponentData {
2385 std::vector<SelectOptionData> options{};///< Aray of select options the choices in the select, max 25.
2386 std::vector<ChannelType>
2387 channelTypes{};///< Array of channel types List of channel types to include in the channel select component (type 8).
2388 std::string placeholder{};///< Custom placeholder text if nothing is selected, max 100 characters.
2389 std::string customId{};///< A developer-defined identifier for the component, max 100 characters.
2390 ComponentType type{};///< Integer component type.
2391 int32_t minValues{};///< The minimum number of items that must be chosen; default 1, min 0, max 25.
2392 int32_t maxValues{};///< The maximum number of items that can be chosen; default 1, max 25.
2393 int32_t minLength{};///< The minimum input length for a text input.
2394 int32_t maxLength{};///< The maximum input length for a text input.
2395 std::string label{};///< The label for this component.
2396 std::string value{};///< A pre-filled value for this component.
2397 std::string title{};///< Url, for url types.
2398 EmojiData emoji{};///< Emoji name, id, and animated.
2399 std::string url{};///< Url, for url types.
2400 bool required{};///< Whether this component is required to be filled.
2401 bool disabled{};///< Whether the component is disabled, default false.
2402 int32_t style{};///< One of ButtonStyle, or TextInputStyle.
2403
2404 ComponentData() noexcept = default;
2405
2406 ComponentData(Value);
2407 };
2408
2409 /// \brief Action row data of Message components.
2410 class DiscordCoreAPI_Dll ActionRowData {
2411 public:
2412 std::vector<ComponentData> components{};///< Array of components to make up the action-row.
2413
2414 ActionRowData() noexcept = default;
2415
2416 operator Serializer();
2417
2418 ActionRowData(Value jsonData);
2419
2420 virtual ~ActionRowData() noexcept = default;
2421 };
2422
2423 /// \brief Interaction callback types.
2424 enum class InteractionCallbackType : uint8_t {
2425 Pong = 1,///< ACK a Ping.
2426 Channel_Message_With_Source = 4,///< Respond to an interaction with a message.
2427 Deferred_Channel_Message_With_Source = 5,///< ACK an interaction and edit a response later, the user sees a loading state.
2429 6,///< For components, ACK an interaction and edit the original message later; the user does not see a loading state.
2430 Update_Message = 7,///< For components, edit the message the component was attached to.
2431 Application_Command_Autocomplete_Result = 8,///< Respond to an autocomplete interaction with suggested choices.
2432 Modal = 9///< Respond to an interaction with a popup modal.
2433 };
2434
2435 /// \brief Interaction ApplicationCommand callback data.
2436 struct DiscordCoreAPI_Dll InteractionCallbackData {
2437 std::vector<ApplicationCommandOptionChoiceData> choices{};///< Autocomplete choices(max of 25 choices).
2438 std::vector<AttachmentData> attachments{};///< Array of partial attachment objects attachment objects with filename and description.
2439 std::vector<ActionRowData> components{};///< Message components.
2440 AllowedMentionsData allowedMentions{};///< Allowed mentions data.
2441 std::vector<EmbedData> embeds{};///< Message embeds.
2442 std::vector<File> files{};///< Files for uploading.
2443 std::string customId{};///< A developer-defined identifier for the component, max 100 characters.
2444 std::string content{};///< Message content.
2445 std::string title{};///< The title of the popup modal.
2446 int32_t flags{};///< Flags.
2447 bool tts{};///< Is it TTS?
2448 };
2449
2450 struct DiscordCoreAPI_Dll CreateApplicationCommandData;
2451
2452 /// \brief Data structure representing an ApplicationCommand.
2453 class DiscordCoreAPI_Dll ApplicationCommandData : public DiscordEntity {
2454 public:
2455 std::unordered_map<std::string, std::string> descriptionLocalizations{};///< Dictionary with keys in available locales.
2456 std::unordered_map<std::string, std::string> nameLocalizations{};///< Dictionary with keys in available locales.
2457 std::vector<ApplicationCommandOptionData> options{};///< A vector of possible options for the current ApplicationCommand.
2458 Permissions defaultMemberPermissions{};///< Set of permissions represented as a bit set all
2459 ApplicationCommandType type{};///< The type of ApplicationCommand.
2460 Snowflake applicationId{};///< The current application id.
2461 std::string description{};///< A description of the current ApplicationCommand.
2462 std::string version{};///< An autoincremented version.
2463 bool dmPermission{};///< Indicates whether the command is available in DMs with the app, only for globally - scoped commands.
2464 Snowflake guildId{};///< (Where applicable) a Guild id for which guild to assign this ApplicationCommand to.
2465 std::string name{};///< Name of the current ApplicationCommand.
2466
2467 ApplicationCommandData() noexcept = default;
2468
2469 ApplicationCommandData(Value jsonData);
2470
2471 friend bool operator==(const ApplicationCommandData&, const ApplicationCommandData&);
2472
2473 virtual ~ApplicationCommandData() noexcept = default;
2474 };
2475
2476 /// \brief Channel mention data.
2477 class DiscordCoreAPI_Dll ChannelMentionData : public DiscordEntity {
2478 public:
2479 Snowflake guildId{};///< The id of the Guild where it took place.
2480 std::string name{};///< The name of the Channel that was mentioned.
2481 ChannelType type{};///< The type of Channel that was mentioned.
2482
2483 ChannelMentionData() noexcept = default;
2484
2485 ChannelMentionData(Value jsonData);
2486
2487 virtual ~ChannelMentionData() noexcept = default;
2488 };
2489
2490 /// \brief Data for when some Channel pins are updated.
2491 struct DiscordCoreAPI_Dll ChannelPinsUpdateEventData {
2492 TimeStamp lastPinTimeStamp{};///< The time of the last pinned Message.
2493 Snowflake channelId{};///< The id of the Channel within which the Message was pinned.
2494 Snowflake guildId{};///< The id of the Guild within which the Message was pinned.
2495
2496 ChannelPinsUpdateEventData() noexcept = default;
2497
2498 ChannelPinsUpdateEventData(Value jsonData);
2499
2500 virtual ~ChannelPinsUpdateEventData() noexcept = default;
2501 };
2502
2503 /// \brief Data for when threads are synced.
2504 struct DiscordCoreAPI_Dll ThreadListSyncData {
2505 std::vector<ThreadMemberData> members{};///< Array of members that are a part of the Thread.
2506 std::vector<std::string> channelIds{};///< The parent Channel ids whose threads are being synced.
2507 std::vector<ChannelData> threads{};///< All active threads in the given channels that the current User can access.
2508 Snowflake guildId{};///< The id of the Guild for which the threads are being synced.
2509
2510 ThreadListSyncData() noexcept = default;
2511
2512 ThreadListSyncData(Value jsonData);
2513
2514 virtual ~ThreadListSyncData() noexcept = default;
2515 };
2516
2517 /// \brief Represents a Thread-members-update.
2518 class DiscordCoreAPI_Dll ThreadMembersUpdateData : public DiscordEntity {
2519 public:
2520 std::vector<ThreadMemberData> addedMembers{};///< New members added to the Thread.
2521 std::vector<std::string> removedMemberIds{};///< Members who have been removed.
2522 uint32_t memberCount{};///< Number of Guild-members in the Thread.
2523 Snowflake guildId{};///< Guild id of the Thread.
2524
2525 ThreadMembersUpdateData() noexcept = default;
2526
2527 ThreadMembersUpdateData(Value jsonData);
2528
2529 virtual ~ThreadMembersUpdateData() noexcept = default;
2530 };
2531
2532 /// \brief Message Interaction data.
2533 class DiscordCoreAPI_Dll MessageInteractionData : public DiscordEntity {
2534 public:
2535 GuildMemberData member{};
2536 InteractionType type{};
2537 std::string name{};
2538 UserData user{};
2539
2540 MessageInteractionData() noexcept = default;
2541
2542 MessageInteractionData(Value jsonData);
2543
2544 virtual ~MessageInteractionData() noexcept = default;
2545 };
2546
2547 /// \brief Message types.
2548 enum class MessageType : uint8_t {
2549 Default = 0,///< Default.
2550 Recipient_Add = 1,///< Recipient add.
2551 Recipient_Remove = 2,///< Recipient remove.
2552 Call = 3,///< Call.
2553 Channel_Name_Change = 4,///< Channel name change.
2554 Channel_Icon_Change = 5,///< Channel icon change.
2555 Channel_Pinned_Message = 6,///< Channel pinned Message.
2556 Guild_Member_Join = 7,///< Guild memeber join.
2557 User_Premium_Guild_Subscription = 8,///< User premium Guild subscription.
2558 User_Premium_Guild_Subscription_Tier_1 = 9,///< User premium Guild subscription tier 1.
2559 User_Premium_Guild_Subscription_Tier_2 = 10,///< User premium Guild subscription tier 2.
2560 User_Premium_Guild_Subscription_Tier_3 = 11,///< User premium Guild subscription tier 3.
2561 Channel_Follow_Add = 12,///< Channel follow add.
2562 Guild_Discovery_Disqualified = 14,///< Guild discovery disqualified.
2563 Guild_Discovery_Requalified = 15,///< Guild discovery requalified.
2564 Guild_Discovery_Grace_Period_Initial_Warning = 16,///< Guild discovery grade period initial warning.
2565 Guild_Discovery_Grace_Period_Final_Warning = 17,///< Guild discovery grade period final warning.
2566 Thread_Created = 18,///< Thread created.
2567 Reply = 19,///< Reply.
2568 Chat_Input_Command = 20,///< Chat input command.
2569 Thread_Starter_Message = 21,///< Thread starter Message.
2570 Guild_Invite_Reminder = 22,///< Guild invite reminder.
2571 Context_Menu_Command = 23///< Context menu command.
2572 };
2573
2574 /// \brief Message flags.
2575 enum class MessageFlags : uint8_t {
2576 Crossposted = 1 << 0,///< Crossposted.
2577 Is_Crosspost = 1 << 1,///< Is crosspost.
2578 Suppress_Embeds = 1 << 2,///< Supress embeds.
2579 Source_Message_Deleted = 1 << 3,///< Source Message deleted.
2580 Urgent = 1 << 4,///< Urgent.
2581 Has_Thread = 1 << 5,///< Has Thread.
2582 Ephemeral = 1 << 6,///< Ephemeral.
2583 Loading = 1 << 7///< Loading.
2584 };
2585
2586 /// \brief Sticker item types.
2587 enum class StickerItemType : uint8_t {
2588 Png = 1,///< Png.
2589 Apng = 2,///< Apng.
2590 Lottie = 3///< Lottie.
2591 };
2592
2593 /// \brief Represents a forum thread message.
2594 struct DiscordCoreAPI_Dll ForumThreadMessageData {
2595 std::vector<AttachmentData> attachments{};///< Array of partial attachment objects attachment objects with filename.
2596 std::vector<ActionRowData> components{};///< Array of message component objects the components to include with the message.
2597 AllowedMentionsData allowedMentions{};///< Allowed mention object allowed mentions for the message.
2598 std::vector<std::string> stickerIds{};///< Array of snowflakes IDs of up to 3 stickers in the server to send in the message.
2599 std::vector<EmbedData> embeds{};///< Array of embed objects embedded rich content (up to 6000 characters).
2600 std::vector<File> files{};///< File contents the contents of the file being sent one of content, file, embed(s), sticker_ids.
2601 std::string content{};///< The message contents (up to 2000 characters).
2602 int32_t flags{};///< Flags to be set for the message.
2603 };
2604
2605 /// \brief Message Sticker item data.
2606 class DiscordCoreAPI_Dll StickerItemData : public DiscordEntity {
2607 public:
2608 StickerItemType formatType{};///< Message Sticker item type.
2609 std::string name{};///< The name of the Sticker.
2610
2611 StickerItemData() noexcept = default;
2612
2613 StickerItemData(Value jsonData);
2614
2615 virtual ~StickerItemData() noexcept = default;
2616 };
2617
2618 /// \brief The core of a Message's data structure.
2619 class DiscordCoreAPI_Dll MessageDataOld : public DiscordEntity {
2620 public:
2621 std::vector<ChannelMentionData> mentionChannels{};///< array of Channel mention data.
2622 std::vector<StickerItemData> stickerItems{};///< Array of Message Sticker item data.
2623 std::vector<AttachmentData> attachments{};///< Array of attachment data.
2624 MessageReferenceData messageReference{};///< Message reference data.
2625 std::vector<ActionRowData> components{};///< Array of action row data.
2626 std::vector<std::string> mentionRoles{};///< std::vector of "mention roles" ids.
2627 std::vector<ReactionData> reactions{};//< Array of reaction data.
2628 MessageInteractionData interaction{};///< Message Interaction data.
2629 std::vector<StickerData> stickers{};///< Array of Message Sticker data.
2630 std::vector<UserData> mentions{};///< Array of User data, for individual's that were mentioned.
2631 std::vector<EmbedData> embeds{};///< Array of Message embeds.
2632 MessageActivityData activity{};///< Message activity data.
2633 ApplicationData application{};///< Application data.
2634 TimeStamp editedTimestamp{};///< The time at which it was edited.
2635 Snowflake applicationId{};///< Application id.
2636 GuildMemberData member{};///< The author's Guild member data.
2637 bool mentionEveryone{};///< Does the Message mention everyone?
2638 TimeStamp timeStamp{};///< The timeStamp of when the Message was created.
2639 std::string content{};///< The Message's content.
2640 Snowflake channelId{};///< The Channel it was sent in.
2641 Snowflake webHookId{};///< WebHook id of the Message, if applicable.
2642 ChannelData thread{};///< The Thread that the Message was sent in, if applicable.
2643 Snowflake guildId{};///< The id of the Guild the Message was sent in.
2644 std::string nonce{};///< Nonce.
2645 MessageType type{};///< Message type.
2646 UserData author{};///< The author's User data.
2647 int32_t flags{};///< Flags.
2648 bool pinned{};///< Is it pinned?
2649 bool tts{};///< Is it a text-to-speech Message?
2650
2651 MessageDataOld() noexcept = default;
2652
2653 MessageDataOld(Value jsonData);
2654
2655 virtual ~MessageDataOld() noexcept = default;
2656 };
2657
2658 /// \brief Data structure representing a single Message.
2659 class DiscordCoreAPI_Dll MessageData : public MessageDataOld {
2660 public:
2661 std::unique_ptr<MessageDataOld> referencedMessage{ std::make_unique<MessageDataOld>() };///< The referenced Message, to reply to.
2662
2663 MessageData& operator=(const MessageData& other);
2664
2665 MessageData(const MessageData& other);
2666
2667 MessageData() noexcept = default;
2668
2669 MessageData(Value jsonData);
2670
2671 virtual ~MessageData() noexcept = default;
2672 };
2673
2674 /// \brief Resolved data.
2675 struct DiscordCoreAPI_Dll ResolvedData {
2676 std::unordered_map<uint64_t, AttachmentData>
2677 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(Value jsonData);
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(Value jsonData);
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(Value jsonData);
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(Value jsonData);
2741
2742 virtual ~ConnectionData() noexcept = default;
2743 };
2744
2745 class DiscordCoreAPI_Dll ConnectionDataVector {
2746 public:
2747 ConnectionDataVector() noexcept = default;
2748
2749 ConnectionDataVector(Value jsonData) 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
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(Value jsonData);
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(Value jsonData);
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(Value jsonData);
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(Value jsonData);
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(Value jsonData);
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(Value jsonData);
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(Value jsonData);
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(Value jsonData);
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,
2998 ButtonStyle buttonStyle, 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 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(Serializer 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,
3112 ButtonStyle buttonStyle, 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 Serializer();
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(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(Value jsonData);
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(Value jsonData);
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(DiscordCoreAPI::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:877
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:455
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:443
For connecting to a voice-channel. "streamInfo" is used when a socket is created to connect this bot ...
Definition: Utilities.hpp:859
Permissions class, for representing and manipulating Permission values.
Definition: Utilities.hpp:1008
Class for representing a timeStamp, as well as working with time-related values.
Definition: Utilities.hpp:1125
VoiceConnection class - represents the connection to a given voice Channel.