40namespace DiscordCoreInternal {
42 WebSocketResumeData::operator Jsonifier::Serializer() {
43 Jsonifier::Serializer data{};
45 data[
"d"][
"seq"] = this->lastNumberReceived;
46 data[
"d"][
"session_id"] = this->sessionId;
47 data[
"d"][
"token"] = this->botToken;
51 WebSocketIdentifyData::operator Jsonifier::Serializer() {
52 Jsonifier::Serializer serializer{};
53 serializer[
"d"][
"intents"] = this->intents;
54 serializer[
"d"][
"large_threshold"] = 250;
55 for (
auto& value: this->presence.activities) {
56 Jsonifier::Serializer serializer01{};
57 if (value.url !=
"") {
58 serializer01[
"url"] = value.url;
60 serializer01[
"name"] = value.name;
61 serializer01[
"type"] = value.type;
62 serializer[
"d"][
"presence"][
"activities"].emplaceBack(serializer01);
64 serializer[
"d"][
"presence"][
"afk"] = this->presence.afk;
65 if (this->presence.since != 0) {
66 serializer[
"d"][
"presence"][
"since"] = this->presence.since;
68 switch (this->presence.status) {
70 serializer[
"d"][
"presence"][
"status"] =
"online";
74 serializer[
"d"][
"presence"][
"status"] =
"dnd";
78 serializer[
"d"][
"presence"][
"status"] =
"invisible";
82 serializer[
"d"][
"presence"][
"status"] =
"offline";
86 serializer[
"d"][
"presence"][
"status"] =
"idle";
90 serializer[
"d"][
"properties"][
"browser"] =
"DiscordCoreAPI";
91 serializer[
"d"][
"properties"][
"device"] =
"DiscordCoreAPI";
93 serializer[
"d"][
"properties"][
"os"] =
"Windows";
95 serializer[
"d"][
"properties"][
"os"] =
"Linux";
97 serializer[
"d"][
"shard"].emplaceBack(this->currentShard);
98 serializer[
"d"][
"shard"].emplaceBack(this->numberOfShards);
99 serializer[
"d"][
"token"] = this->botToken;
100 serializer[
"op"] = 2;
104 VoiceSocketProtocolPayloadData::operator Jsonifier::Serializer() {
105 Jsonifier::Serializer data{};
107 data[
"d"][
"protocol"] =
"udp";
108 data[
"d"][
"data"][
"port"] = this->voicePort;
109 data[
"d"][
"data"][
"mode"] = this->voiceEncryptionMode;
110 std::string externalIpReal{};
111 for (
auto& value: this->externalIp) {
112 externalIpReal.push_back(value);
114 data[
"d"][
"data"][
"address"] = externalIpReal;
118 VoiceIdentifyData::operator Jsonifier::Serializer() {
119 Jsonifier::Serializer data{};
121 data[
"d"][
"session_id"] = this->connectionData.sessionId;
122 data[
"d"][
"token"] = this->connectionData.token;
123 data[
"d"][
"server_id"] = this->connectInitData.guildId;
124 data[
"d"][
"user_id"] = this->connectInitData.userId;
128 SendSpeakingData::operator Jsonifier::Serializer() {
129 Jsonifier::Serializer data{};
131 data[
"d"][
"speaking"] =
static_cast<int32_t
>(this->type);
132 data[
"d"][
"delay"] = this->delay;
133 data[
"d"][
"ssrc"] = this->ssrc;
137 HttpsWorkloadData& HttpsWorkloadData::operator=(HttpsWorkloadData&& other)
noexcept {
138 if (
this != &other) {
139 this->headersToInsert = std::move(other.headersToInsert);
140 this->thisWorkerId.store(this->thisWorkerId.load());
141 this->relativePath = std::move(other.relativePath);
142 this->callStack = std::move(other.callStack);
143 this->workloadClass = other.workloadClass;
144 this->baseUrl = std::move(other.baseUrl);
145 this->content = std::move(other.content);
146 this->workloadType = other.workloadType;
147 this->payloadType = other.payloadType;
152 HttpsWorkloadData& HttpsWorkloadData::operator=(HttpsWorkloadType type)
noexcept {
153 if (!HttpsWorkloadData::workloadIdsExternal.contains(type)) {
154 std::unique_ptr<std::atomic_int64_t> integer{ std::make_unique<std::atomic_int64_t>() };
155 std::unique_ptr<std::atomic_int64_t> integer02{ std::make_unique<std::atomic_int64_t>() };
156 HttpsWorkloadData::workloadIdsExternal[type] = std::move(integer);
157 HttpsWorkloadData::workloadIdsInternal[type] = std::move(integer02);
159 this->thisWorkerId.store(HttpsWorkloadData::incrementAndGetWorkloadId(type));
160 this->workloadType = type;
164 HttpsWorkloadData::HttpsWorkloadData(HttpsWorkloadType type)
noexcept {
168 int64_t HttpsWorkloadData::incrementAndGetWorkloadId(HttpsWorkloadType workloadType)
noexcept {
169 int64_t value{ HttpsWorkloadData::workloadIdsExternal[workloadType]->load() };
170 HttpsWorkloadData::workloadIdsExternal[workloadType]->store(value + 1);
174 std::unordered_map<HttpsWorkloadType, std::unique_ptr<std::atomic_int64_t>> HttpsWorkloadData::workloadIdsExternal{};
175 std::unordered_map<HttpsWorkloadType, std::unique_ptr<std::atomic_int64_t>> HttpsWorkloadData::workloadIdsInternal{};
177 HelloData::HelloData(Jsonifier::Value jsonData) {
178 this->heartbeatInterval = DiscordCoreAPI::getUint64(jsonData,
"heartbeat_interval");
181 WebSocketMessage::WebSocketMessage(Jsonifier::Value jsonData) {
182 this->op = DiscordCoreAPI::getInt32(jsonData,
"op");
184 this->s = DiscordCoreAPI::getInt32(jsonData,
"s");
186 this->t = DiscordCoreAPI::getString(jsonData,
"t");
189 InvalidSessionData::InvalidSessionData(Jsonifier::Value jsonData) {
190 this->d = DiscordCoreAPI::getBool(jsonData,
"d");
193 ReadyData::ReadyData(Jsonifier::Value jsonData) {
194 this->resumeGatewayUrl = DiscordCoreAPI::getString(jsonData,
"resume_gateway_url");
195 this->resumeGatewayUrl = this->resumeGatewayUrl.substr(this->resumeGatewayUrl.find(
"wss://") + std::string{
"wss://" }.size());
196 this->resumeGatewayUrl = this->resumeGatewayUrl.substr(0, this->resumeGatewayUrl.find(
"/"));
198 this->sessionId = DiscordCoreAPI::getString(jsonData,
"session_id");
200 this->v = DiscordCoreAPI::getUint32(jsonData,
"v");
202 Jsonifier::Value user{};
203 if (jsonData[
"user"].get(user) == Jsonifier::ErrorCode::Success) {
211 UpdatePresenceData::operator Serializer() {
214 for (
auto& value: this->activities) {
215 Serializer dataNew{};
216 if (value.url !=
"") {
217 dataNew[
"url"] = std::string{ value.url };
219 dataNew[
"name"] = std::string{ value.name };
220 dataNew[
"type"] = value.type;
221 data[
"d"][
"activities"].emplaceBack(dataNew);
223 switch (this->status) {
225 data[
"status"] =
"online";
229 data[
"status"] =
"dnd";
233 data[
"status"] =
"invisible";
237 data[
"status"] =
"offline";
241 data[
"status"] =
"idle";
245 if (this->since != 0) {
246 data[
"since"] = this->since;
248 data[
"afk"] = this->afk;
253 TimeStamp timeStamp{ (this->
id.operator size_t() >> 22) + 1420070400000, timeFormat };
254 return timeStamp.operator std::string();
257 RoleTagsData::RoleTagsData(Value jsonData) {
258 this->
botId = getString(jsonData,
"bot_id");
263 UserData::UserData(Value jsonData) {
264 this->
id = getId(jsonData,
"id");
276 newFlags = setBool(newFlags,
UserFlags::Bot, getBool(jsonData,
"bot"));
278 newFlags += getUint32(jsonData,
"public_flags");
280 newFlags = setBool(newFlags, this->
flags,
true);
284 this->
userName = getString(jsonData,
"username");
286 this->
avatar = getString(jsonData,
"avatar");
291 std::string UserData::getAvatarUrl() {
292 std::string stringNew{
"https://cdn.discordapp.com/" };
293 stringNew +=
"avatars/" + this->
id +
"/" + this->
avatar.getIconHash();
297 AttachmentData ::AttachmentData(Value jsonData) {
298 this->
id = getId(jsonData,
"id");
300 this->filename = getString(jsonData,
"filename");
302 this->contentType = getString(jsonData,
"content_type");
304 this->ephemeral = getBool(jsonData,
"ephemeral");
306 this->description = getString(jsonData,
"description");
308 this->size = getUint32(jsonData,
"size");
310 this->url = getString(jsonData,
"url");
312 this->proxyUrl = getString(jsonData,
"proxy_url");
314 this->width = getUint32(jsonData,
"width");
316 this->height = getUint32(jsonData,
"height");
319 EmbedFooterData::EmbedFooterData(Value jsonData) {
320 this->
text = getString(jsonData,
"text");
322 this->
iconUrl = getString(jsonData,
"icon_url");
324 this->
proxyIconUrl = getString(jsonData,
"proxy_icon_url");
327 EmbedImageData::EmbedImageData(Value jsonData) {
328 this->
url = getString(jsonData,
"url");
330 this->
proxyUrl = getString(jsonData,
"proxy_url");
332 this->
width = getUint32(jsonData,
"width");
334 this->
height = getUint32(jsonData,
"height");
337 EmbedThumbnailData::EmbedThumbnailData(Value jsonData) {
338 this->
url = getString(jsonData,
"url");
340 this->
proxyUrl = getString(jsonData,
"proxy_url");
342 this->
width = getUint32(jsonData,
"width");
344 this->
height = getUint32(jsonData,
"height");
347 EmbedVideoData::EmbedVideoData(Value jsonData) {
348 this->
url = getString(jsonData,
"url");
350 this->
proxyUrl = getString(jsonData,
"proxy_url");
352 this->
width = getUint32(jsonData,
"width");
354 this->
height = getUint32(jsonData,
"height");
357 EmbedProviderData::EmbedProviderData(Value jsonData) {
358 this->
url = getString(jsonData,
"url");
360 this->
name = getString(jsonData,
"name");
363 EmbedAuthorData::EmbedAuthorData(Value jsonData) {
364 this->
url = getString(jsonData,
"url");
366 this->
proxyIconUrl = getString(jsonData,
"proxy_icon_url");
368 this->
name = getString(jsonData,
"name");
370 this->
iconUrl = getString(jsonData,
"icon_url");
373 EmbedFieldData::EmbedFieldData(Value jsonData) {
374 this->
Inline = getBool(jsonData,
"inline");
376 this->
name = getString(jsonData,
"name");
378 this->
value = getString(jsonData,
"value");
381 EmbedData::EmbedData(Value jsonData) {
382 this->
title = getString(jsonData,
"title");
384 this->
type = getString(jsonData,
"type");
386 this->
description = getString(jsonData,
"description");
388 this->
url = getString(jsonData,
"url");
390 this->
timeStamp = getString(jsonData,
"timestamp");
395 if (!getObject(
object,
"footer", jsonData)) {
396 EmbedFooterData data{
object };
397 this->
footer = std::move(data);
400 if (!getObject(
object,
"image", jsonData)) {
401 EmbedImageData data{
object };
402 this->
image = std::move(data);
405 if (!getObject(
object,
"provider", jsonData)) {
406 EmbedProviderData data{
object };
410 if (!getObject(
object,
"thumbnail", jsonData)) {
411 EmbedThumbnailData data{
object };
415 if (!getObject(
object,
"video", jsonData)) {
416 EmbedVideoData data{
object };
417 this->
video = std::move(data);
420 if (!getObject(
object,
"author", jsonData)) {
421 EmbedAuthorData data{
object };
422 this->
author = std::move(data);
425 Jsonifier::Array arrayValue{};
426 if (!getArray(arrayValue,
"fields", jsonData)) {
428 for (JsonifierResult<Value> value: arrayValue) {
429 EmbedFieldData newData{ value.value() };
430 this->
fields.emplace_back(std::move(newData));
435 MessageReferenceData::MessageReferenceData(Value jsonData) {
436 this->
messageId = getId(jsonData,
"message_id");
438 this->
channelId = getId(jsonData,
"channel_id");
440 this->
guildId = getId(jsonData,
"guild_id");
445 ThreadMetadataData::ThreadMetadataData(Value jsonData) {
446 this->
archived = getBool(jsonData,
"archived");
448 this->
invitable = getBool(jsonData,
"invitable");
454 this->
locked = getBool(jsonData,
"locked");
457 ThreadMemberData::ThreadMemberData(Value jsonData) {
458 this->
id = getId(jsonData,
"id");
460 this->
userId = getId(jsonData,
"user_id");
464 this->
flags = getUint32(jsonData,
"flags");
467 ThreadMemberDataVector::ThreadMemberDataVector(Value jsonData) {
468 if (jsonData.type() != Jsonifier::JsonType::Null) {
469 Jsonifier::Array arrayValue{};
470 if (!getArray(arrayValue, jsonData)) {
471 for (JsonifierResult<Value> value: arrayValue) {
472 ThreadMemberData newData{ value.value() };
473 this->threadMembers.emplace_back(std::move(newData));
479 VoiceStateDataLight::VoiceStateDataLight(Value jsonData) {
480 this->
channelId = getId(jsonData,
"channel_id");
482 this->
guildId = getId(jsonData,
"guild_id");
484 this->
userId = getId(jsonData,
"user_id");
487 VoiceStateData::VoiceStateData(Value jsonData) {
490 this->
channelId = getId(jsonData,
"channel_id");
492 this->
guildId = getId(jsonData,
"guild_id");
494 this->
selfStream = getBool(jsonData,
"self_stream");
496 this->
userId = getId(jsonData,
"user_id");
498 this->
selfVideo = getBool(jsonData,
"self_video");
500 this->
sessionId = getString(jsonData,
"session_id");
502 this->
selfDeaf = getBool(jsonData,
"self_deaf");
504 this->
selfMute = getBool(jsonData,
"self_mute");
506 this->
suppress = getBool(jsonData,
"suppress");
508 this->
deaf = getBool(jsonData,
"deaf");
510 this->
mute = getBool(jsonData,
"mute");
513 RoleData::RoleData(Value jsonData) {
514 this->
id = getId(jsonData,
"id");
516 this->
name = getString(jsonData,
"name");
518 std::stringstream stream{};
519 stream << getString(jsonData,
"unicode_emoji");
520 for (
auto& value: stream.str()) {
527 this->
guildId = getId(jsonData,
"guild_id");
529 this->
color = getUint32(jsonData,
"color");
532 newFlags = setBool(newFlags, RoleFlags::Hoist, getBool(jsonData,
"hoist"));
534 newFlags = setBool(newFlags, RoleFlags::Managed, getBool(jsonData,
"managed"));
536 newFlags = setBool(newFlags, RoleFlags::Mentionable, getBool(jsonData,
"mentionable"));
538 this->
flags =
static_cast<RoleFlags
>(newFlags);
540 this->
position = getUint32(jsonData,
"position");
542 this->
permissions = getString(jsonData,
"permissions");
545 EmojiData::EmojiData(Value jsonData) {
546 this->
id = getId(jsonData,
"id");
548 this->
name = getString(jsonData,
"name");
550 Jsonifier::Array arrayValue{};
551 if (!getArray(arrayValue,
"roles", jsonData)) {
552 for (JsonifierResult<Value> value: arrayValue) {
553 RoleData newData{ value.value() };
554 this->
roles.emplace_back(std::move(newData));
559 if (!getObject(
object,
"user", jsonData)) {
560 this->
user = UserData{
object };
565 this->
managed = getBool(jsonData,
"managed");
567 this->
animated = getBool(jsonData,
"animated");
569 this->
available = getBool(jsonData,
"available");
572 PresenceUpdateData::PresenceUpdateData(Value jsonData) {
573 this->
guildId = getId(jsonData,
"guild_id");
575 auto stringNew = getString(jsonData,
"status");
577 if (stringNew ==
"online") {
578 uint8_t newFlags = setBool(uint8_t{}, PresenceUpdateFlags::Status_Online,
true);
579 this->
theStatus =
static_cast<PresenceUpdateFlags
>(newFlags);
580 }
else if (stringNew ==
"idle") {
581 uint8_t newFlags = setBool(uint8_t{}, PresenceUpdateFlags::Status_Idle,
true);
582 this->
theStatus =
static_cast<PresenceUpdateFlags
>(newFlags);
583 }
else if (stringNew ==
"dnd") {
584 uint8_t newFlags = setBool(uint8_t{}, PresenceUpdateFlags::Status_Dnd,
true);
585 this->
theStatus =
static_cast<PresenceUpdateFlags
>(newFlags);
591 GuildMemberData& GuildMemberData::operator=(GuildMemberData&& other)
noexcept {
592 if (
this != &other) {
593 this->permissions = std::move(other.permissions);
594 this->joinedAt = std::move(other.joinedAt);
595 this->avatar = std::move(other.avatar);
596 this->roles = std::move(other.roles);
597 this->flags = std::move(other.flags);
598 this->nick = std::move(other.nick);
599 this->guildId = other.guildId;
605 GuildMemberData& GuildMemberData::operator=(Value jsonData) {
607 newFlags = setBool(newFlags, GuildMemberFlags::Pending, getBool(jsonData,
"pending"));
609 newFlags = setBool(newFlags, GuildMemberFlags::Mute, getBool(jsonData,
"mute"));
611 newFlags = setBool(newFlags, GuildMemberFlags::Deaf, getBool(jsonData,
"deaf"));
613 this->
flags =
static_cast<GuildMemberFlags
>(newFlags);
615 this->
joinedAt = getString(jsonData,
"joined_at");
617 this->
guildId = getId(jsonData,
"guild_id");
619 Jsonifier::Array arrayValue{};
620 if (!getArray(arrayValue,
"roles", jsonData)) {
622 for (JsonifierResult<Value> value: arrayValue) {
623 this->
roles.emplace_back(getId(value.value()));
627 this->
permissions = getString(jsonData,
"permissions");
630 if (!getObject(
object,
"user", jsonData)) {
631 UserData user{
object };
633 Users::insertUser(std::move(user));
636 this->
avatar = getString(jsonData,
"avatar");
638 newFlags += getUint8(jsonData,
"flags");
640 this->
flags =
static_cast<GuildMemberFlags
>(newFlags);
642 this->
nick = getString(jsonData,
"nick");
646 GuildMemberData::GuildMemberData(Value jsonData) {
650 VoiceStateDataLight GuildMemberData::getVoiceStateData() {
651 VoiceStateDataLight dataToGet{};
652 dataToGet.guildId = this->
guildId;
653 dataToGet.userId = this->
id;
654 if (GuildMembers::getVsCache().contains(dataToGet)) {
655 return GuildMembers::getVsCache()[dataToGet];
661 std::string GuildMemberData::getAvatarUrl() {
662 if (this->
avatar.getIconHash() !=
"") {
663 std::string stringNew{
"https://cdn.discordapp.com/" };
664 stringNew +=
"guilds/" + this->
guildId +
"/users/" + this->
id +
"/avatars/" + this->
avatar.getIconHash();
667 return this->getUserData().getAvatarUrl();
671 UserData GuildMemberData::getUserData() {
672 if (this->
id.
operator size_t() != 0) {
679 OverWriteData::OverWriteData(Value jsonData) {
680 this->
id = getId(jsonData,
"id");
682 this->
allow = getUint64(jsonData,
"allow");
684 this->
deny = getUint64(jsonData,
"deny");
689 DefaultReactionData::DefaultReactionData(Value jsonData) {
690 this->emojiId = getId(jsonData,
"emoji_id");
692 this->emojiName = getString(jsonData,
"emoji_name");
695 ForumTagData::ForumTagData(Value jsonData) {
696 this->emojiId = getId(jsonData,
"emoji_id");
698 this->emojiName = getString(jsonData,
"emoji_name");
700 this->
id = getId(jsonData,
"id");
702 this->moderated = getBool(jsonData,
"moderated");
704 this->name = getString(jsonData,
"name");
707 ChannelData::ChannelData(Value jsonData) {
709 newFlags = setBool(newFlags, ChannelFlags::NSFW, getBool(jsonData,
"nsfw"));
715 this->
memberCount = getUint32(jsonData,
"member_count");
717 this->
ownerId = getId(jsonData,
"owner_id");
719 this->
id = getId(jsonData,
"id");
721 newFlags += getUint8(jsonData,
"flags");
723 this->
flags =
static_cast<ChannelFlags
>(newFlags);
725 this->
parentId = getId(jsonData,
"parent_id");
727 this->
guildId = getId(jsonData,
"guild_id");
729 this->
position = getUint32(jsonData,
"position");
731 Jsonifier::Array arrayValue{};
732 if (!getArray(arrayValue,
"permission_overwrites", jsonData)) {
734 for (JsonifierResult<Value> value: arrayValue) {
735 OverWriteData dataNew{ value.value() };
740 this->
name = getString(jsonData,
"name");
743 ActiveThreadsData::ActiveThreadsData(Value jsonData) {
744 Jsonifier::Array arrayValue{};
745 if (!getArray(arrayValue,
"threads", jsonData)) {
746 for (JsonifierResult<Value> value: arrayValue) {
747 ChannelData newData{ value.value() };
748 this->threads.emplace_back(std::move(newData));
752 if (!getArray(arrayValue,
"members", jsonData)) {
753 for (JsonifierResult<Value> value: arrayValue) {
754 ThreadMemberData newData{ value.value() };
755 this->members.emplace_back(std::move(newData));
759 this->hasMore = getBool(jsonData,
"has_more");
762 ArchivedThreadsData::ArchivedThreadsData(Value jsonData) {
763 Jsonifier::Array arrayValue{};
765 if (!getArray(arrayValue,
"threads", jsonData)) {
766 for (JsonifierResult<Value> value: arrayValue) {
767 ChannelData newData{ value.value() };
768 this->threads.emplace_back(std::move(newData));
773 if (!getArray(arrayValue,
"members", jsonData)) {
774 for (JsonifierResult<Value> value: arrayValue) {
775 ThreadMemberData newData{ value.value() };
776 this->members.emplace_back(std::move(newData));
780 this->hasMore = getBool(jsonData,
"has_more");
783 TriggerMetaData::TriggerMetaData(Value jsonData) {
784 Jsonifier::Array arrayValue{};
786 if (!getArray(arrayValue,
"keyword_filter", jsonData)) {
787 for (JsonifierResult<Value> value: arrayValue) {
788 this->
keywordFilter.emplace_back(value.getString().value().data());
792 if (!getArray(arrayValue,
"presets", jsonData)) {
793 for (JsonifierResult<Value> value: arrayValue) {
798 if (!getArray(arrayValue,
"allow_list", jsonData)) {
799 for (JsonifierResult<Value> value: arrayValue) {
800 this->
allowList.emplace_back(value.getString().value());
807 ActionMetaData::ActionMetaData(Value jsonData) {
808 this->
channelId = getId(jsonData,
"channel_id");
813 ActionData::ActionData(Value jsonData) {
815 if (!getObject(
object,
"metadata", jsonData)) {
816 this->
metadata = ActionMetaData{
object };
819 this->
type =
static_cast<ActionType>(getUint64(jsonData,
"type"));
822 AutoModerationRuleData::AutoModerationRuleData(Value jsonData) {
823 this->
name = getString(jsonData,
"name");
825 this->
id = getId(jsonData,
"id");
827 this->
enabled = getBool(jsonData,
"enabled");
833 this->
creatorId = getId(jsonData,
"creator_id");
835 Jsonifier::Array arrayValue{};
836 if (!getArray(arrayValue,
"actions", jsonData)) {
837 for (JsonifierResult<Value> value: arrayValue) {
838 ActionData newData{ value.value() };
839 this->
actions.emplace_back(std::move(newData));
843 if (!getArray(arrayValue,
"exempt_roles", jsonData)) {
845 for (JsonifierResult<Value> value: arrayValue) {
846 this->
exemptRoles.emplace_back(strtoull(std::string{ value.getString().takeValue() }));
850 if (!getArray(arrayValue,
"exempt_channels", jsonData)) {
852 for (JsonifierResult<Value> value: arrayValue) {
853 this->
exemptChannels.emplace_back(strtoull(std::string{ value.getString().takeValue() }));
858 if (!getObject(
object,
"trigger_metadata", jsonData)) {
862 this->
guildId = getId(jsonData,
"guild_id");
865 ApplicationCommandPermissionData::ApplicationCommandPermissionData(Value jsonData) {
866 this->
id = getId(jsonData,
"id");
868 this->
permission = getBool(jsonData,
"permission");
873 GuildApplicationCommandPermissionsData::GuildApplicationCommandPermissionsData(Value jsonData) {
874 this->
guildId = getId(jsonData,
"guild_id");
878 this->
id = getId(jsonData,
"id");
880 Jsonifier::Array arrayValue{};
881 if (!getArray(arrayValue,
"permissions", jsonData)) {
883 for (JsonifierResult<Value> value: arrayValue) {
884 ApplicationCommandPermissionData newData{ value.value() };
885 this->
permissions.emplace_back(std::move(newData));
890 GuildApplicationCommandPermissionsDataVector::GuildApplicationCommandPermissionsDataVector(Value jsonData) {
891 if (jsonData.type() != Jsonifier::JsonType::Null) {
892 Jsonifier::Array arrayValue{};
893 if (!getArray(arrayValue, jsonData)) {
894 for (JsonifierResult<Value> value: arrayValue) {
895 GuildApplicationCommandPermissionsData newData{ value.value() };
896 this->guildApplicationCommandPermissionss.emplace_back(std::move(newData));
902 EmojiDataVector::EmojiDataVector(Value jsonData) {
903 if (jsonData.type() != Jsonifier::JsonType::Null) {
904 Jsonifier::Array arrayValue{};
905 if (!getArray(arrayValue, jsonData)) {
906 for (JsonifierResult<Value> value: arrayValue) {
907 EmojiData newData{ value.value() };
908 this->theEmojis.emplace_back(std::move(newData));
914 ReactionData::ReactionData(Value jsonData) {
915 this->
count = getUint32(jsonData,
"count");
917 this->
me = getBool(jsonData,
"me");
920 if (!getObject(
object,
"emoji", jsonData)) {
921 this->
emoji = EmojiData{
object };
924 this->
guildId = getId(jsonData,
"guild_id");
926 this->
channelId = getId(jsonData,
"channel_id");
928 this->
userId = getId(jsonData,
"user_id");
930 this->
messageId = getId(jsonData,
"message_id");
932 if (!getObject(
object,
"member", jsonData)) {
933 this->
member = GuildMemberData{
object };
937 VoiceRegionData::VoiceRegionData(Value jsonData) {
938 this->
id = getId(jsonData,
"id");
940 this->
custom = getBool(jsonData,
"custom");
942 this->
deprecated = getBool(jsonData,
"deprecated");
944 this->
optimal = getBool(jsonData,
"optimal");
946 this->
name = getString(jsonData,
"name");
949 VoiceRegionDataVector::VoiceRegionDataVector(Value jsonData) {
950 if (jsonData.type() != Jsonifier::JsonType::Null) {
951 Jsonifier::Array arrayValue{};
952 if (!getArray(arrayValue, jsonData)) {
953 for (JsonifierResult<Value> value: arrayValue) {
954 VoiceRegionData newData{ value.value() };
955 this->voiceRegions.emplace_back(std::move(newData));
961 MessageActivityData::MessageActivityData(Value jsonData) {
964 this->
partyId = getString(jsonData,
"party_id");
967 BanData::BanData(Value jsonData) {
969 if (!getObject(
object,
"user", jsonData)) {
970 this->
user = UserData{
object };
973 this->
reason = getString(jsonData,
"reason");
976 BanDataVector::BanDataVector(Value jsonData) {
977 if (jsonData.type() != Jsonifier::JsonType::Null) {
978 Jsonifier::Array arrayValue{};
979 if (!getArray(arrayValue, jsonData)) {
980 for (JsonifierResult<Value> value: arrayValue) {
981 BanData newData{ value.value() };
982 this->bans.emplace_back(std::move(newData));
988 TeamMembersObjectData::TeamMembersObjectData(Value jsonData) {
991 this->
teamId = getId(jsonData,
"team_id");
993 Jsonifier::Array arrayValue{};
994 if (!getArray(arrayValue,
"permissions", jsonData)) {
995 for (JsonifierResult<Value> value: arrayValue) {
996 this->
permissions.emplace_back(Permissions{ value.getString().value().data() });
1001 if (!getObject(
object,
"user", jsonData)) {
1002 this->
user = UserData{
object };
1006 TeamObjectData::TeamObjectData(Value jsonData) {
1007 this->
icon = getString(jsonData,
"icon");
1009 this->
id = getId(jsonData,
"id");
1011 Jsonifier::Array arrayValue{};
1012 if (!getArray(arrayValue,
"members", jsonData)) {
1013 for (JsonifierResult<Value> value: arrayValue) {
1014 TeamMembersObjectData newData{ value.value() };
1015 this->
members.emplace_back(std::move(newData));
1019 this->
ownerUserId = getId(jsonData,
"owner_user_id");
1022 InstallParamsData::InstallParamsData(Value jsonData) {
1023 Jsonifier::Array arrayValue{};
1024 if (!getArray(arrayValue,
"scopes", jsonData)) {
1025 for (JsonifierResult<Value> value: arrayValue) {
1026 this->
scopes.emplace_back(Permissions{ value.getString().value().data() });
1033 ApplicationData::ApplicationData(Value jsonData) {
1035 if (!getObject(
object,
"params", jsonData)) {
1036 this->
params = InstallParamsData{
object };
1039 Jsonifier::Array arrayValue{};
1040 if (!getArray(arrayValue,
"tags", jsonData)) {
1041 for (JsonifierResult<Value> value: arrayValue) {
1042 this->
tags.emplace_back(value.getString().value().data());
1046 this->
id = getId(jsonData,
"id");
1048 this->
name = getString(jsonData,
"name");
1050 this->
icon = getString(jsonData,
"icon");
1052 this->
description = getString(jsonData,
"description");
1054 if (!getArray(arrayValue,
"rpc_origins", jsonData)) {
1055 for (JsonifierResult<Value> value: arrayValue) {
1056 this->
rpcOrigins.emplace_back(value.getString().value().data());
1060 this->
botPublic = getBool(jsonData,
"bot_public");
1068 if (!getObject(
object,
"owner", jsonData)) {
1069 this->
owner = UserData{
object };
1072 if (!getObject(
object,
"team", jsonData)) {
1073 this->
team = TeamObjectData{
object };
1076 this->
summary = getString(jsonData,
"summary");
1078 this->
verifyKey = getString(jsonData,
"verify_key");
1080 this->
guildId = getId(jsonData,
"guild_id");
1082 this->
primarySkuId = getString(jsonData,
"primary_sku_id");
1084 this->
slug = getString(jsonData,
"slug");
1086 this->
coverImage = getString(jsonData,
"cover_image");
1093 if (!getObject(
object,
"application", jsonData)) {
1097 Jsonifier::Array arrayValue{};
1098 if (!getArray(arrayValue,
"features", jsonData)) {
1100 for (JsonifierResult<Value> value: arrayValue) {
1101 this->
scopes.emplace_back(std::string{ value.getString().takeValue() });
1105 this->
expires = getString(jsonData,
"expires");
1106 if (!getObject(
object,
"user", jsonData)) {
1107 this->user = UserData{
object };
1111 AccountData::AccountData(Value jsonData) {
1112 this->
id = getId(jsonData,
"id");
1114 this->
name = getString(jsonData,
"name");
1117 GuildWidgetData::GuildWidgetData(Value jsonData) {
1118 this->
enabled = getBool(jsonData,
"enabled");
1120 this->
channelId = getId(jsonData,
"channel_id");
1123 GuildWidgetImageData::GuildWidgetImageData(Value jsonData) {
1124 this->url = getString(jsonData,
"widget_image");
1127 IntegrationData::IntegrationData(Value jsonData) {
1128 this->
id = getId(jsonData,
"id");
1130 this->
name = getString(jsonData,
"name");
1132 this->
type = getString(jsonData,
"type");
1134 this->
enabled = getBool(jsonData,
"enabled");
1136 this->
syncing = getBool(jsonData,
"syncing");
1138 this->
roleId = getId(jsonData,
"role_id");
1147 if (!getObject(
object,
"user", jsonData)) {
1148 this->
user = UserData{
object };
1151 if (!getObject(
object,
"account", jsonData)) {
1152 this->
account = AccountData{
object };
1155 if (!getObject(
object,
"application", jsonData)) {
1159 this->
syncedAt = getString(jsonData,
"synced_at");
1163 this->
revoked = getBool(jsonData,
"revoked");
1166 IntegrationDataVector::IntegrationDataVector(Value jsonData) {
1167 if (jsonData.type() != Jsonifier::JsonType::Null) {
1168 Jsonifier::Array arrayValue{};
1169 if (!getArray(arrayValue, jsonData)) {
1170 for (JsonifierResult<Value> value: arrayValue) {
1171 IntegrationData newData{ value.value() };
1172 this->integeregrations.emplace_back(std::move(newData));
1178 OptionalAuditEntryInfoData::OptionalAuditEntryInfoData(Value jsonData) {
1183 this->
channelId = getId(jsonData,
"channel_id");
1185 this->
messageId = getId(jsonData,
"message_id");
1187 this->
count = getString(jsonData,
"count");
1189 this->
id = getId(jsonData,
"id");
1191 this->
type = getString(jsonData,
"type");
1193 this->
roleName = getString(jsonData,
"role_name");
1196 AuditLogChangeData::AuditLogChangeData(Value jsonData) {
1197 this->
newValue.value = getString(jsonData,
"new_value");
1199 this->
oldValue.value = getString(jsonData,
"old_value");
1201 this->
key = getString(jsonData,
"key");
1204 GuildPruneCountData::GuildPruneCountData(Value jsonData) {
1205 this->count = getUint32(jsonData,
"pruned");
1208 AuditLogEntryData::AuditLogEntryData(Value jsonData) {
1209 this->
targetId = getId(jsonData,
"target_id");
1211 Jsonifier::Array arrayValue{};
1212 if (!getArray(arrayValue,
"changes", jsonData)) {
1213 for (JsonifierResult<Value> value: arrayValue) {
1214 AuditLogChangeData newData{ value.value() };
1215 this->
changes.emplace_back(std::move(newData));
1219 this->
userId = getId(jsonData,
"user_id");
1221 this->
id = getId(jsonData,
"id");
1227 if (!getObject(
object,
"options", jsonData)) {
1228 this->
options = OptionalAuditEntryInfoData{
object };
1231 this->
reason = getString(jsonData,
"reason");
1234 WelcomeScreenChannelData::WelcomeScreenChannelData(Value jsonData) {
1235 this->
channelId = getId(jsonData,
"channel_id");
1237 this->
description = getString(jsonData,
"description");
1239 this->
emojiId = getId(jsonData,
"emoji_id");
1241 this->
emojiName = getString(jsonData,
"emoji_name");
1244 WelcomeScreenData::WelcomeScreenData(Value jsonData) {
1245 this->
description = getString(jsonData,
"description");
1247 Jsonifier::Array arrayValue{};
1248 if (!getArray(arrayValue,
"welcome_channels", jsonData)) {
1249 for (JsonifierResult<Value> value: arrayValue) {
1250 WelcomeScreenChannelData newData{ value.value() };
1256 StageInstanceData::StageInstanceData(Value jsonData) {
1257 this->
id = getId(jsonData,
"id");
1259 this->
guildId = getId(jsonData,
"guild_id");
1261 this->
channelId = getId(jsonData,
"channel_id");
1263 this->
topic = getString(jsonData,
"topic");
1270 StickerData::StickerData(Value jsonData) {
1271 this->
asset = getString(jsonData,
"asset");
1273 this->
description = getString(jsonData,
"description");
1278 newFlags = setBool(newFlags, StickerFlags::Available, getBool(jsonData,
"available"));
1280 this->
flags =
static_cast<StickerFlags
>(newFlags);
1282 this->
guildId = getId(jsonData,
"guild_id");
1284 this->
id = getId(jsonData,
"id");
1286 this->
packId = getString(jsonData,
"pack_id");
1290 this->
sortValue = getUint32(jsonData,
"sort_value");
1292 this->
name = getString(jsonData,
"name");
1295 if (!getObject(
object,
"user", jsonData)) {
1296 this->
user = UserData{
object };
1300 GuildPreviewData::GuildPreviewData(Value jsonData) {
1301 this->approximatePresenceCount = getUint32(jsonData,
"approximate_presence_count");
1303 this->approximateMemberCount = getUint32(jsonData,
"approximate_member_count");
1305 this->discoverySplash = getString(jsonData,
"discovery_splash");
1307 Jsonifier::Array arrayValue{};
1308 if (!getArray(arrayValue,
"emojis", jsonData)) {
1309 for (JsonifierResult<Value> value: arrayValue) {
1310 EmojiData newData{ value.value() };
1311 this->emojis.emplace_back(std::move(newData));
1315 if (!getArray(arrayValue,
"stickers", jsonData)) {
1316 for (JsonifierResult<Value> value: arrayValue) {
1317 StickerData newData{ value.value() };
1318 this->stickers.emplace_back(std::move(newData));
1322 if (!getArray(arrayValue,
"features", jsonData)) {
1323 this->features.clear();
1324 for (JsonifierResult<Value> value: arrayValue) {
1325 this->features.emplace_back(value.getString().takeValue());
1329 this->description = getString(jsonData,
"description");
1331 this->splash = getString(jsonData,
"splash");
1333 this->icon = getString(jsonData,
"icon");
1335 this->name = getString(jsonData,
"name");
1337 this->
id = getId(jsonData,
"id");
1342 if (DiscordCoreClient::getVoiceConnection(this->
id) && DiscordCoreClient::getVoiceConnection(this->
id)->areWeConnected()) {
1345 }
else if (
static_cast<Snowflake
>(guildMemberId) != 0 ||
static_cast<Snowflake
>(channelId) != 0) {
1346 Snowflake channelId{};
1347 if (
static_cast<Snowflake
>(guildMemberId) != 0) {
1350 dataLight.userId = guildMemberId;
1351 auto voiceStateData = GuildMembers::getVsCache()[dataLight];
1352 if (voiceStateData.channelId != 0) {
1353 channelId = voiceStateData.channelId;
1356 channelId = channelId;
1358 uint64_t theShardId{ (this->
id.operator size_t() >> 22) % this->
discordCoreClient->configManager.getTotalShardCount() };
1359 auto theBaseSocketAgentIndex{
static_cast<int32_t
>(
1360 floor(
static_cast<double>(theShardId) /
static_cast<double>(this->
discordCoreClient->configManager.getTotalShardCount()) *
1361 this->discordCoreClient->baseSocketAgentsMap.size())) };
1364 voiceConnectInitData.streamInfo = streamInfoNew;
1365 voiceConnectInitData.channelId = channelId;
1366 voiceConnectInitData.guildId = this->
id;
1368 voiceConnectInitData.selfDeaf = selfDeaf;
1369 voiceConnectInitData.selfMute = selfMute;
1370 StopWatch stopWatch{ 10000ms };
1371 auto voiceConnection = DiscordCoreClient::getVoiceConnection(this->
id);
1372 voiceConnection->connect(voiceConnectInitData);
1373 while (voiceConnection->areWeConnected()) {
1374 std::this_thread::sleep_for(1ms);
1383 std::string GuildData::getIconUrl() noexcept {
1384 std::string stringNew{
"https://cdn.discordapp.com/" };
1385 stringNew +=
"icons/" + this->
id +
"/" + this->
icon.getIconHash() +
".png";
1389 bool GuildData::areWeConnected() {
1390 return DiscordCoreClient::getVoiceConnection(this->
id)->areWeConnected();
1393 void GuildData::disconnect() {
1394 if (DiscordCoreClient::getVoiceConnection(this->
id)) {
1395 UpdateVoiceStateData updateVoiceData{};
1396 updateVoiceData.channelId = 0;
1397 updateVoiceData.selfDeaf =
false;
1398 updateVoiceData.selfMute =
false;
1399 updateVoiceData.guildId = this->
id;
1401 DiscordCoreClient::getVoiceConnection(this->
id)->disconnect();
1406 GuildData::GuildData(Value jsonData) {
1418 this->
ownerId = getId(jsonData,
"owner_id");
1420 this->
memberCount = getUint32(jsonData,
"member_count");
1422 this->
joinedAt = getString(jsonData,
"joined_at");
1424 this->
id = getId(jsonData,
"id");
1426 this->
icon = getString(jsonData,
"icon");
1428 this->
name = getString(jsonData,
"name");
1432 Jsonifier::Array arrayValue{};
1433 if (!getArray(arrayValue,
"features", jsonData)) {
1435 for (
auto value: arrayValue) {
1436 auto object = value.value();
1437 this->
threads.emplace_back(getId(
object,
"id"));
1441 if (!getArray(arrayValue,
"stickers", jsonData)) {
1443 for (
auto value: arrayValue) {
1444 this->
stickers.emplace_back(getId(value.value(),
"id"));
1448 if (!getArray(arrayValue,
"guild_scheduled_events", jsonData)) {
1450 for (
auto value: arrayValue) {
1455 if (!getArray(arrayValue,
"stage_instances", jsonData)) {
1457 for (
auto value: arrayValue) {
1462 if (!getArray(arrayValue,
"emoji", jsonData)) {
1463 this->
emoji.clear();
1464 for (
auto value: arrayValue) {
1465 this->
emoji.emplace_back(getId(value.value(),
"id"));
1469 if (Roles::doWeCacheRoles()) {
1470 this->
roles.clear();
1471 if (!getArray(arrayValue,
"roles", jsonData)) {
1472 for (
auto value: arrayValue) {
1473 RoleData newData{ value.value() };
1474 newData.guildId = this->
id;
1475 this->
roles.emplace_back(newData.id);
1476 Roles::insertRole(std::move(newData));
1481 if (GuildMembers::doWeCacheGuildMembers()) {
1483 GuildMemberData newData{};
1484 if (!getArray(arrayValue,
"members", jsonData)) {
1485 for (
auto value: arrayValue) {
1486 newData = value.value();
1487 newData.guildId = this->
id;
1488 this->
members.emplace_back(newData.id);
1489 GuildMembers::insertGuildMember(std::move(newData));
1494 if (!getArray(arrayValue,
"voice_states", jsonData)) {
1495 for (
auto value: arrayValue) {
1496 VoiceStateDataLight dataNew{ value.value() };
1497 dataNew.guildId = this->
id;
1498 GuildMembers::vsCache[dataNew] = dataNew;
1502 if (GuildMembers::doWeCacheGuildMembers()) {
1504 if (!getArray(arrayValue,
"presences", jsonData)) {
1505 for (
auto value: arrayValue) {
1506 PresenceUpdateData newData{ value.value() };
1507 newData.guildId = this->
id;
1508 this->
presences.emplace_back(std::move(newData));
1513 if (Channels::doWeCacheChannels()) {
1515 if (!getArray(arrayValue,
"channels", jsonData)) {
1516 for (
auto value: arrayValue) {
1517 ChannelData newData{ value.value() };
1518 newData.guildId = this->
id;
1519 this->
channels.emplace_back(newData.id);
1520 Channels::insertChannel(std::move(newData));
1526 GuildDataVector::GuildDataVector(Value jsonData) {
1527 if (jsonData.type() != Jsonifier::JsonType::Null) {
1528 Jsonifier::Array arrayValue{};
1529 if (!getArray(arrayValue, jsonData)) {
1530 for (JsonifierResult<Value> value: arrayValue) {
1531 GuildData newData{ value.value() };
1532 this->guilds.emplace_back(std::move(newData));
1538 GuildScheduledEventMetadata::GuildScheduledEventMetadata(Value jsonData) {
1539 this->location = getString(jsonData,
"location");
1542 GuildScheduledEventData::GuildScheduledEventData(Value jsonData) {
1550 if (!getObject(
object,
"entity_metadata", jsonData)) {
1558 this->
userCount = getUint32(jsonData,
"user_count");
1560 this->
channelId = getId(jsonData,
"channel_id");
1562 this->
creatorId = getId(jsonData,
"creator_id");
1564 this->
entityId = getId(jsonData,
"entity_id");
1566 this->
guildId = getId(jsonData,
"guild_id");
1568 this->
id = getId(jsonData,
"id");
1570 this->
description = getString(jsonData,
"description");
1572 if (!getObject(
object,
"creator", jsonData)) {
1573 this->
creator = UserData{
object };
1576 this->
name = getString(jsonData,
"name");
1579 GuildScheduledEventUserData::GuildScheduledEventUserData(Value jsonData) {
1583 if (!getObject(
object,
"member", jsonData)) {
1584 this->
member = GuildMemberData{
object };
1587 if (!getObject(
object,
"user", jsonData)) {
1588 this->
user = UserData{
object };
1592 GuildScheduledEventUserDataVector::GuildScheduledEventUserDataVector(Value jsonData) {
1593 if (jsonData.type() != Jsonifier::JsonType::Null) {
1594 Jsonifier::Array arrayValue{};
1595 if (!getArray(arrayValue, jsonData)) {
1596 for (JsonifierResult<Value> value: arrayValue) {
1597 GuildScheduledEventUserData newData{ value.value() };
1598 this->guildScheduledEventUsers.emplace_back(std::move(newData));
1604 GuildScheduledEventDataVector::GuildScheduledEventDataVector(Value jsonData) {
1605 if (jsonData.type() != Jsonifier::JsonType::Null) {
1606 Jsonifier::Array arrayValue{};
1607 if (!getArray(arrayValue, jsonData)) {
1608 for (JsonifierResult<Value> value: arrayValue) {
1609 GuildScheduledEventData newData{ value.value() };
1610 this->guildScheduledEvents.emplace_back(std::move(newData));
1616 InviteData::InviteData(Value jsonData) {
1617 this->
code = getUint32(jsonData,
"code");
1620 if (!getObject(
object,
"guild", jsonData)) {
1621 this->
guild = GuildData{
object };
1624 if (!getObject(
object,
"channel", jsonData)) {
1625 this->
channel = ChannelData{
object };
1628 if (!getObject(
object,
"inviter", jsonData)) {
1629 this->
inviter = UserData{
object };
1632 this->
targetType = getUint32(jsonData,
"target_type");
1634 if (!getObject(
object,
"target_user", jsonData)) {
1638 if (!getObject(
object,
"target_application", jsonData)) {
1642 if (!getObject(
object,
"stage_instance", jsonData)) {
1646 if (!getObject(
object,
"guild_scheduled_event", jsonData)) {
1654 this->
guildId = getId(jsonData,
"guild_id");
1656 this->
expiresAt = getString(jsonData,
"expires_at");
1658 this->
uses = getUint32(jsonData,
"uses");
1660 this->
maxUses = getUint32(jsonData,
"max_uses");
1662 this->
maxAge = getUint32(jsonData,
"max_age");
1664 this->
temporary = getBool(jsonData,
"temporary");
1666 this->
createdAt = getString(jsonData,
"created_at");
1669 InviteDataVector::InviteDataVector(Value jsonData) {
1670 if (jsonData.type() != Jsonifier::JsonType::Null) {
1671 Jsonifier::Array arrayValue{};
1672 if (!getArray(arrayValue, jsonData)) {
1673 for (JsonifierResult<Value> value: arrayValue) {
1674 InviteData newData{ value.value() };
1675 this->invites.emplace_back(std::move(newData));
1681 GuildTemplateData::GuildTemplateData(Value jsonData) {
1683 if (!getObject(
object,
"serialized_source_guild", jsonData)) {
1687 if (!getObject(
object,
"creator", jsonData)) {
1688 this->
creator = UserData{
object };
1691 this->
sourceGuildId = getString(jsonData,
"source_guild_id");
1693 this->
description = getString(jsonData,
"description");
1695 this->
usageCount = getUint32(jsonData,
"usage_count");
1697 this->
creatorId = getString(jsonData,
"creator_id");
1699 this->
createdAt = getString(jsonData,
"created_at");
1701 this->
updatedAt = getString(jsonData,
"updated_at");
1703 this->
isDirty = getBool(jsonData,
"is_dirty");
1705 this->
code = getString(jsonData,
"code");
1707 this->
name = getString(jsonData,
"name");
1710 GuildTemplateDataVector::GuildTemplateDataVector(Value jsonData) {
1711 if (jsonData.type() != Jsonifier::JsonType::Null) {
1712 Jsonifier::Array arrayValue{};
1713 if (!getArray(arrayValue, jsonData)) {
1714 for (JsonifierResult<Value> value: arrayValue) {
1715 GuildTemplateData newData{ value.value() };
1716 this->guildTemplates.emplace_back(std::move(newData));
1722 WebHookData::WebHookData(Value jsonData) {
1723 this->
id = getId(jsonData,
"id");
1727 this->
guildId = getId(jsonData,
"guild_id");
1729 this->
channelId = getId(jsonData,
"channel_id");
1732 if (!getObject(
object,
"user", jsonData)) {
1733 this->
user = UserData{
object };
1736 this->
name = getString(jsonData,
"name");
1738 this->
avatar = getString(jsonData,
"avatar");
1740 this->
token = getString(jsonData,
"token");
1744 if (!getObject(
object,
"source_guild", jsonData)) {
1748 if (!getObject(
object,
"source_channel", jsonData)) {
1752 this->
url = getString(jsonData,
"url");
1755 WebHookDataVector::WebHookDataVector(Value jsonData) {
1756 if (jsonData.type() != Jsonifier::JsonType::Null) {
1757 Jsonifier::Array arrayValue{};
1758 if (!getArray(arrayValue, jsonData)) {
1759 for (JsonifierResult<Value> value: arrayValue) {
1760 WebHookData newData{ value.value() };
1761 this->webHooks.emplace_back(std::move(newData));
1767 AuditLogData::AuditLogData(Value jsonData) {
1768 Jsonifier::Array arrayValue{};
1769 if (!getArray(arrayValue,
"webhooks", jsonData)) {
1770 for (JsonifierResult<Value> value: arrayValue) {
1771 WebHookData newData{ value.value() };
1772 this->
webhooks.emplace_back(std::move(newData));
1776 if (!getArray(arrayValue,
"guild_scheduled_events", jsonData)) {
1777 for (JsonifierResult<Value> value: arrayValue) {
1778 GuildScheduledEventData newData{ value.value() };
1783 if (!getArray(arrayValue,
"auto_moderation_rules", jsonData)) {
1784 for (JsonifierResult<Value> value: arrayValue) {
1785 AutoModerationRuleData newData{ value.value() };
1790 if (!getArray(arrayValue,
"users", jsonData)) {
1791 for (JsonifierResult<Value> value: arrayValue) {
1792 UserData newData{ value.value() };
1793 this->
users.emplace_back(std::move(newData));
1797 if (!getArray(arrayValue,
"audit_log_entries", jsonData)) {
1798 for (JsonifierResult<Value> value: arrayValue) {
1799 AuditLogEntryData newData{ value.value() };
1804 if (!getArray(arrayValue,
"integrations", jsonData)) {
1805 for (JsonifierResult<Value> value: arrayValue) {
1806 IntegrationData newData{ value.value() };
1811 if (!getArray(arrayValue,
"threads", jsonData)) {
1812 for (JsonifierResult<Value> value: arrayValue) {
1813 ChannelData newData{ value.value() };
1814 this->
threads.emplace_back(std::move(newData));
1819 ReactionRemoveData::ReactionRemoveData(Value jsonData) {
1820 this->userId = getId(jsonData,
"user_id");
1822 this->channelId = getId(jsonData,
"channel_id");
1824 this->messageId = getId(jsonData,
"message_id");
1826 this->guildId = getId(jsonData,
"guild_id");
1829 if (!getObject(
object,
"emoji", jsonData)) {
1830 this->emoji = EmojiData{
object };
1834 ApplicationCommandOptionChoiceData::ApplicationCommandOptionChoiceData(Value jsonData) {
1835 std::string_view
string{};
1840 if (jsonData[
"value"].get(
string) == Jsonifier::ErrorCode::Success) {
1841 this->
value =
static_cast<std::string
>(string);
1842 this->
type = JsonType::String;
1843 }
else if (jsonData[
"value"].get(integer) == Jsonifier::ErrorCode::Success) {
1844 this->
value = std::to_string(integer);
1845 this->
type = JsonType::Int64;
1846 }
else if (jsonData[
"value"].get(theBool) == Jsonifier::ErrorCode::Success) {
1847 this->
type = JsonType::Bool;
1848 std::stringstream stream{};
1849 stream << std::boolalpha << theBool;
1850 this->
value = stream.str();
1851 }
else if (jsonData[
"value"].get(doubleVal) == Jsonifier::ErrorCode::Success) {
1852 this->
type = JsonType::Float;
1853 this->
value = std::to_string(doubleVal);
1856 this->
name = getString(jsonData,
"name");
1859 if (jsonData[
"name_localizations"].get(map) == Jsonifier::ErrorCode::Success) {
1861 for (
auto value: map) {
1867 bool operator==(
const ApplicationCommandOptionChoiceData& lhs,
const ApplicationCommandOptionChoiceData& rhs) {
1868 if (lhs.name != rhs.name) {
1871 if (lhs.nameLocalizations != rhs.nameLocalizations) {
1874 if (lhs.type != rhs.type) {
1877 if (lhs.value != rhs.value) {
1883 ApplicationCommandOptionData::ApplicationCommandOptionData(Value jsonData) {
1884 this->
name = getString(jsonData,
"name");
1887 if (jsonData[
"name_localizations"].get(map) == Jsonifier::ErrorCode::Success) {
1889 for (
auto value: map) {
1890 this->
nameLocalizations.emplace(value.unescapedKey().takeValue(), value.value().getString().takeValue());
1894 if (jsonData[
"description_localizations"].get(map) == Jsonifier::ErrorCode::Success) {
1896 for (
auto value: map) {
1901 this->
description = getString(jsonData,
"description");
1903 Jsonifier::Array arrayValue{};
1904 if (!getArray(arrayValue,
"channel_types", jsonData)) {
1905 for (JsonifierResult<Value> value: arrayValue) {
1913 this->
minValue = getInt64(jsonData,
"min_value");
1915 this->
minValue = getFloat(jsonData,
"min_value");
1919 this->
maxValue = getInt32(jsonData,
"max_value");
1921 this->
maxValue = getFloat(jsonData,
"max_value");
1924 this->
required = getBool(jsonData,
"required");
1926 this->
autocomplete = getBool(jsonData,
"autocomplete");
1929 if (!getArray(arrayValue,
"options", jsonData)) {
1930 for (JsonifierResult<Value> value: arrayValue) {
1931 ApplicationCommandOptionData newData{ value.value() };
1932 this->
options.emplace_back(std::move(newData));
1936 if (!getArray(arrayValue,
"choices", jsonData)) {
1937 for (JsonifierResult<Value> value: arrayValue) {
1938 ApplicationCommandOptionChoiceData newData{ value.value() };
1939 this->
choices.emplace_back(std::move(newData));
1944 bool operator==(
const ApplicationCommandOptionData& lhs,
const ApplicationCommandOptionData& rhs) {
1945 if (lhs.autocomplete != rhs.autocomplete) {
1948 if (lhs.channelTypes != rhs.channelTypes) {
1951 if (lhs.description != rhs.description) {
1954 if (lhs.descriptionLocalizations != rhs.descriptionLocalizations) {
1957 if (lhs.maxValue != rhs.maxValue) {
1960 if (lhs.minValue != rhs.minValue) {
1963 if (lhs.name != rhs.name) {
1966 if (lhs.nameLocalizations != rhs.nameLocalizations) {
1969 if (lhs.options.size() != rhs.options.size()) {
1972 if (lhs.required != rhs.required) {
1975 if (lhs.type != rhs.type) {
1978 if (lhs.choices.size() != rhs.choices.size()) {
1981 for (int32_t x = 0; x < rhs.choices.size(); ++x) {
1982 if (lhs.choices[x] != rhs.choices[x]) {
1988 ApplicationCommandData::ApplicationCommandData(Value jsonData) {
1989 this->
id = getId(jsonData,
"id");
1993 this->
dmPermission = getBool(jsonData,
"dm_permission");
1995 this->
version = getString(jsonData,
"version");
2000 if (jsonData[
"name_localizations"].get(map) == Jsonifier::ErrorCode::Success) {
2002 for (
auto value: map) {
2003 this->
nameLocalizations.emplace(value.unescapedKey().takeValue(), value.value().getString().takeValue());
2007 if (jsonData[
"description_localizations"].get(map) == Jsonifier::ErrorCode::Success) {
2009 for (
auto value: map) {
2016 this->
name = getString(jsonData,
"name");
2018 this->
description = getString(jsonData,
"description");
2020 this->
version = getString(jsonData,
"version");
2022 Jsonifier::Array arrayValue{};
2023 if (!getArray(arrayValue,
"options", jsonData)) {
2024 for (JsonifierResult<Value> value: arrayValue) {
2025 ApplicationCommandOptionData newData{ value.value() };
2026 this->
options.emplace_back(std::move(newData));
2031 bool operator==(
const ApplicationCommandData& lhs,
const ApplicationCommandData& rhs) {
2032 if (lhs.description != rhs.description) {
2035 if (lhs.name != rhs.name) {
2038 if (lhs.type != rhs.type) {
2041 if (lhs.options.size() != rhs.options.size()) {
2044 for (
size_t x = 0; x < lhs.options.size(); ++x) {
2045 if (lhs.options[x] != rhs.options[x]) {
2052 TypingStartData::TypingStartData(Value jsonData) {
2053 this->channelId = getId(jsonData,
"channel_id");
2055 this->guildId = getId(jsonData,
"guild_id");
2058 if (!getObject(
object,
"member", jsonData)) {
2059 this->member = GuildMemberData{
object };
2062 this->userId = getId(jsonData,
"user_id");
2064 this->timeStamp = getUint32(jsonData,
"timestamp");
2067 YouTubeFormat::YouTubeFormat(Value jsonData) {
2068 this->audioQuality = getString(jsonData,
"audioQuality");
2070 this->averageBitrate = getUint32(jsonData,
"averageBitrate");
2072 this->audioSampleRate = getString(jsonData,
"audioSampleRate");
2074 this->bitrate = getUint32(jsonData,
"bitrate");
2076 this->contentLength = strtoull(getString(jsonData,
"contentLength"));
2078 this->fps = getUint32(jsonData,
"fps");
2080 this->height = getUint32(jsonData,
"height");
2082 this->height = getUint32(jsonData,
"width");
2084 this->aitags = getString(jsonData,
"aitags");
2086 this->itag = getUint32(jsonData,
"itag");
2088 this->downloadUrl = getString(jsonData,
"url");
2090 this->mimeType = getString(jsonData,
"mimeType");
2092 this->quality = getString(jsonData,
"quality");
2094 std::string
string = getString(jsonData,
"signatureCipher");
2096 string = getString(jsonData,
"cipher");
2099 this->signatureCipher = string;
2101 auto ampersandSpFind = this->signatureCipher.find(
"&sp");
2102 if (ampersandSpFind != std::string::npos) {
2103 this->signature = this->signatureCipher.substr(0, ampersandSpFind);
2106 auto urlFind = this->signatureCipher.find(
"url");
2107 if (urlFind != std::string::npos) {
2108 this->downloadUrl = this->signatureCipher.substr(urlFind + 4);
2110 this->downloadUrl = getString(jsonData,
"url");
2114 YouTubeFormatVector::YouTubeFormatVector(Value jsonData) {
2116 if (!getObject(valueNew,
"streamingData", jsonData)) {
2117 Jsonifier::Array arrayValue{};
2118 if (!getArray(arrayValue,
"formats", valueNew)) {
2119 for (JsonifierResult<Value> value: arrayValue) {
2120 YouTubeFormat newData{ value.value() };
2121 this->formats.emplace_back(std::move(newData));
2127 if (!getObject(valueNew,
"streamingData", jsonData)) {
2128 Jsonifier::Array arrayValue{};
2129 if (!getArray(arrayValue,
"adaptiveFormats", valueNew)) {
2130 for (JsonifierResult<Value> value: arrayValue) {
2131 YouTubeFormat newData{ value.value() };
2132 this->formats.emplace_back(std::move(newData));
2138 UserCommandInteractionData::UserCommandInteractionData(Value jsonData) {
2139 this->
targetId = getId(jsonData,
"target_id");
2142 MessageCommandInteractionData::MessageCommandInteractionData(Value jsonData) {
2143 this->
targetId = getId(jsonData,
"target_id");
2146 ComponentInteractionData::ComponentInteractionData(Value jsonData) {
2147 Jsonifier::Array arrayValue{};
2148 if (!getArray(arrayValue,
"values", jsonData)) {
2150 for (
auto iterator = arrayValue.begin(); iterator != arrayValue.end(); ++iterator) {
2151 this->
values.emplace_back(iterator.value().operator*().getString().takeValue());
2155 this->
customId = getString(jsonData,
"custom_id");
2160 ModalInteractionData::ModalInteractionData(Value jsonData) {
2161 Value theComponent{};
2162 if (jsonData[
"components"][0][
"components"][0].get(theComponent) == Jsonifier::ErrorCode::Success) {
2163 this->
value = getString(theComponent,
"value");
2167 this->
customId = getString(jsonData,
"custom_id");
2170 AllowedMentionsData::AllowedMentionsData(Value jsonData) {
2171 Jsonifier::Array arrayValue{};
2172 if (!getArray(arrayValue,
"parse", jsonData)) {
2173 for (JsonifierResult<Value> value: arrayValue) {
2174 this->
parse.emplace_back(
static_cast<std::string
>(value.getString().value()));
2178 if (!getArray(arrayValue,
"roles", jsonData)) {
2179 for (JsonifierResult<Value> value: arrayValue) {
2180 this->
roles.emplace_back(
static_cast<std::string
>(value.getString().value()));
2184 if (!getArray(arrayValue,
"users", jsonData)) {
2185 for (JsonifierResult<Value> value: arrayValue) {
2186 this->
users.emplace_back(
static_cast<std::string
>(value.getString().value()));
2190 this->
repliedUser = getBool(jsonData,
"replied_user");
2193 SelectOptionData::SelectOptionData(Value jsonData) {
2194 this->
label = getString(jsonData,
"label");
2196 this->
value = getString(jsonData,
"value");
2198 this->
description = getString(jsonData,
"description");
2201 if (jsonData[
"emoji"].get(theEmoji) == Jsonifier::ErrorCode::Success) {
2202 this->
emoji = EmojiData{ theEmoji };
2205 this->
_default = getBool(jsonData,
"default");
2208 ActionRowData::ActionRowData(Value jsonData) {
2209 Jsonifier::Array arrayValue{};
2210 if (!getArray(arrayValue,
"components", jsonData)) {
2212 for (JsonifierResult<Value> value: arrayValue) {
2213 ComponentData newData{ value.value() };
2214 this->
components.emplace_back(std::move(newData));
2219 ComponentData::ComponentData(Value jsonData) {
2222 this->
customId = getString(jsonData,
"custom_id");
2224 this->
placeholder = getString(jsonData,
"placeholder");
2226 this->
disabled = getBool(jsonData,
"disabled");
2228 this->
style = getUint32(jsonData,
"style");
2230 this->
label = getString(jsonData,
"label");
2232 this->
minLength = getUint32(jsonData,
"min_length");
2234 this->
maxLength = getUint32(jsonData,
"max_length");
2236 this->
maxValues = getUint32(jsonData,
"max_values");
2238 this->
maxValues = getUint32(jsonData,
"min_values");
2240 this->
title = getString(jsonData,
"title");
2242 this->
required = getBool(jsonData,
"required");
2245 if (!getObject(
object,
"emoji", jsonData)) {
2246 this->
emoji = EmojiData{
object };
2249 this->
url = getString(jsonData,
"url");
2251 Jsonifier::Array arrayValue{};
2252 if (!getArray(arrayValue,
"select_option_data", jsonData)) {
2254 for (JsonifierResult<Value>
value: arrayValue) {
2255 SelectOptionData newData{
value.value() };
2256 this->
options.emplace_back(std::move(newData));
2260 if (!getArray(arrayValue,
"channel_types", jsonData)) {
2262 for (JsonifierResult<Value>
value: arrayValue) {
2269 ChannelMentionData::ChannelMentionData(Value jsonData) {
2270 this->
id = getId(jsonData,
"id");
2272 this->
guildId = getId(jsonData,
"guild_id");
2276 this->
name = getString(jsonData,
"name");
2279 ChannelPinsUpdateEventData::ChannelPinsUpdateEventData(Value jsonData) {
2280 this->
guildId = getId(jsonData,
"guild_id");
2282 this->
channelId = getId(jsonData,
"channel_id");
2287 ThreadListSyncData::ThreadListSyncData(Value jsonData) {
2288 this->
guildId = getId(jsonData,
"guild_id");
2290 Jsonifier::Array arrayValue{};
2291 if (!getArray(arrayValue,
"channel_ids", jsonData)) {
2292 for (JsonifierResult<Value> value: arrayValue) {
2293 this->
channelIds.emplace_back(value.getString().takeValue());
2297 if (!getArray(arrayValue,
"members", jsonData)) {
2298 for (JsonifierResult<Value> value: arrayValue) {
2299 ThreadMemberData newData{ value.value() };
2300 this->
members.emplace_back(std::move(newData));
2304 if (!getArray(arrayValue,
"threads", jsonData)) {
2305 for (JsonifierResult<Value> value: arrayValue) {
2306 ChannelData newData{ value.value() };
2307 this->
threads.emplace_back(std::move(newData));
2312 ThreadMembersUpdateData::ThreadMembersUpdateData(Value jsonData) {
2313 this->
guildId = getId(jsonData,
"guild_id");
2315 this->
id = getId(jsonData,
"id");
2317 this->
memberCount = getUint32(jsonData,
"member_count");
2319 Jsonifier::Array arrayValue{};
2320 if (!getArray(arrayValue,
"added_members", jsonData)) {
2321 for (JsonifierResult<Value> value: arrayValue) {
2322 ThreadMemberData newData{ value.value() };
2327 if (!getArray(arrayValue,
"removed_member_ids", jsonData)) {
2328 for (JsonifierResult<Value> value: arrayValue) {
2334 MessageInteractionData::MessageInteractionData(Value jsonData) {
2335 this->
id = getId(jsonData,
"id");
2337 this->type =
static_cast<InteractionType>(getUint8(jsonData,
"type"));
2339 this->name = getString(jsonData,
"name");
2342 if (!getObject(
object,
"user", jsonData)) {
2343 this->user = UserData{
object };
2346 if (!getObject(
object,
"member", jsonData)) {
2347 this->member = GuildMemberData{
object };
2351 StickerItemData::StickerItemData(Value jsonData) {
2352 this->
id = getId(jsonData,
"id");
2354 this->
name = getString(jsonData,
"name");
2359 MessageDataOld::MessageDataOld(Value jsonData) {
2360 this->
content = getString(jsonData,
"content");
2362 this->
id = getId(jsonData,
"id");
2364 this->
channelId = getId(jsonData,
"channel_id");
2366 this->
guildId = getId(jsonData,
"guild_id");
2369 if (!getObject(
object,
"author", jsonData)) {
2370 this->
author = UserData{
object };
2373 if (!getObject(
object,
"member", jsonData)) {
2374 this->
member = GuildMemberData{
object };
2377 this->
timeStamp = getString(jsonData,
"timestamp");
2381 this->
tts = getBool(jsonData,
"tts");
2386 Jsonifier::Array arrayValue{};
2387 if (!getArray(arrayValue,
"mentions", jsonData)) {
2389 for (JsonifierResult<Value> value: arrayValue) {
2390 UserData newData{ value.value() };
2391 this->
mentions.emplace_back(std::move(newData));
2395 if (!getArray(arrayValue,
"mention_roles", jsonData)) {
2397 for (JsonifierResult<Value> value: arrayValue) {
2398 std::string_view
object = value.getString().takeValue();
2403 if (!getArray(arrayValue,
"mention_channels", jsonData)) {
2405 for (JsonifierResult<Value> value: arrayValue) {
2406 ChannelMentionData newChannelData{ value.value() };
2411 if (!getArray(arrayValue,
"attachments", jsonData)) {
2413 for (JsonifierResult<Value> value: arrayValue) {
2414 AttachmentData newAttachmentData{ value.value() };
2415 this->
attachments.emplace_back(std::move(newAttachmentData));
2419 if (!getArray(arrayValue,
"embeds", jsonData)) {
2421 for (JsonifierResult<Value> value: arrayValue) {
2422 EmbedData newEmbedData{ value.value() };
2423 this->
embeds.emplace_back(std::move(newEmbedData));
2427 if (!getArray(arrayValue,
"reactions", jsonData)) {
2428 this->reactions.clear();
2429 for (JsonifierResult<Value> value: arrayValue) {
2430 ReactionData newReactionData{ value.value() };
2431 this->reactions.emplace_back(std::move(newReactionData));
2435 this->
nonce = getString(jsonData,
"nonce");
2437 this->
pinned = getBool(jsonData,
"pinned");
2439 this->
webHookId = getId(jsonData,
"webhook_id");
2442 if (!getObject(
object,
"activity", jsonData)) {
2443 this->
activity = MessageActivityData{
object };
2446 if (!getObject(
object,
"application", jsonData)) {
2452 if (!getObject(
object,
"message_reference", jsonData)) {
2456 this->
flags = getUint32(jsonData,
"flags");
2457 if (!getArray(arrayValue,
"sticker_items", jsonData)) {
2459 for (JsonifierResult<Value> value: arrayValue) {
2460 StickerItemData newReactionData{ value.value() };
2461 this->
stickerItems.emplace_back(std::move(newReactionData));
2465 if (!getArray(arrayValue,
"stickers", jsonData)) {
2467 for (JsonifierResult<Value> value: arrayValue) {
2468 StickerData newReactionData{ value.value() };
2469 this->
stickers.emplace_back(std::move(newReactionData));
2473 if (!getObject(
object,
"interaction", jsonData)) {
2474 this->
interaction = MessageInteractionData{
object };
2477 if (!getArray(arrayValue,
"components", jsonData)) {
2479 for (JsonifierResult<Value> value: arrayValue) {
2480 ActionRowData newActionRowData{ value.value() };
2481 this->
components.emplace_back(std::move(newActionRowData));
2485 if (!getObject(
object,
"thread", jsonData)) {
2486 this->
thread = ChannelData{
object };
2490 MessageData::MessageData(Value jsonData) {
2491 this->
content = getString(jsonData,
"content");
2493 this->
id = getId(jsonData,
"id");
2495 this->
channelId = getId(jsonData,
"channel_id");
2497 this->
guildId = getId(jsonData,
"guild_id");
2500 if (!getObject(
object,
"author", jsonData)) {
2501 this->
author = UserData{
object };
2504 if (!getObject(
object,
"member", jsonData)) {
2505 this->
member = GuildMemberData{
object };
2508 this->
timeStamp = getString(jsonData,
"timestamp");
2512 this->
tts = getBool(jsonData,
"tts");
2517 Jsonifier::Array arrayValue{};
2518 if (!getArray(arrayValue,
"mentions", jsonData)) {
2520 for (JsonifierResult<Value> value: arrayValue) {
2521 UserData newData{ value.value() };
2522 this->
mentions.emplace_back(std::move(newData));
2526 if (!getArray(arrayValue,
"mention_roles", jsonData)) {
2528 for (JsonifierResult<Value> value: arrayValue) {
2529 std::string_view
object = value.getString().takeValue();
2534 if (!getArray(arrayValue,
"mention_channels", jsonData)) {
2536 for (JsonifierResult<Value> value: arrayValue) {
2537 ChannelMentionData newChannelData{ value.value() };
2542 if (!getArray(arrayValue,
"attachments", jsonData)) {
2544 for (JsonifierResult<Value> value: arrayValue) {
2545 AttachmentData newAttachmentData{ value.value() };
2546 this->
attachments.emplace_back(std::move(newAttachmentData));
2550 if (!getArray(arrayValue,
"embeds", jsonData)) {
2552 for (JsonifierResult<Value> value: arrayValue) {
2553 EmbedData newEmbedData{ value.value() };
2554 this->
embeds.emplace_back(std::move(newEmbedData));
2558 if (!getArray(arrayValue,
"reactions", jsonData)) {
2559 this->reactions.clear();
2560 for (JsonifierResult<Value> value: arrayValue) {
2561 ReactionData newReactionData{ value.value() };
2562 this->reactions.emplace_back(std::move(newReactionData));
2566 this->
nonce = getString(jsonData,
"nonce");
2568 this->
pinned = getBool(jsonData,
"pinned");
2570 this->
webHookId = getId(jsonData,
"webhook_id");
2574 if (!getObject(
object,
"activity", jsonData)) {
2575 this->
activity = MessageActivityData{
object };
2578 if (!getObject(
object,
"application", jsonData)) {
2584 if (!getObject(
object,
"referenced_message", jsonData)) {
2588 if (!getObject(
object,
"message_reference", jsonData)) {
2592 this->
flags = getUint32(jsonData,
"flags");
2594 if (!getArray(arrayValue,
"sticker_items", jsonData)) {
2596 for (JsonifierResult<Value> value: arrayValue) {
2597 StickerItemData newReactionData{ value.value() };
2598 this->
stickerItems.emplace_back(std::move(newReactionData));
2602 if (!getArray(arrayValue,
"stickers", jsonData)) {
2604 for (JsonifierResult<Value> value: arrayValue) {
2605 StickerData newReactionData{ value.value() };
2606 this->
stickers.emplace_back(std::move(newReactionData));
2610 if (!getObject(
object,
"interaction", jsonData)) {
2611 this->
interaction = MessageInteractionData{
object };
2614 if (!getArray(arrayValue,
"components", jsonData)) {
2616 for (JsonifierResult<Value> value: arrayValue) {
2617 ActionRowData newActionRowData{ value.value() };
2618 this->
components.emplace_back(std::move(newActionRowData));
2622 if (!getObject(
object,
"thread", jsonData)) {
2623 this->
thread = ChannelData{
object };
2627 ResolvedData::ResolvedData(Value jsonData) {
2628 Object arrayValue{};
2629 if (jsonData[
"attachments"].get(arrayValue) == Jsonifier::ErrorCode::Success) {
2631 for (JsonifierResult<Field> value: arrayValue) {
2632 AttachmentData newData{ value.value() };
2633 this->
attachments[strtoull(std::string{ value.key().takeValue().raw() })] = std::move(newData);
2636 if (jsonData[
"users"].get(arrayValue) == Jsonifier::ErrorCode::Success) {
2637 this->
users.clear();
2638 for (JsonifierResult<Field> value: arrayValue) {
2639 UserData newData{ value.value() };
2640 this->
users[strtoull(std::string{ value.key().takeValue().raw() })] = std::move(newData);
2643 if (jsonData[
"channels"].get(arrayValue) == Jsonifier::ErrorCode::Success) {
2645 for (JsonifierResult<Field> value: arrayValue) {
2646 ChannelData newData{ value.value() };
2647 this->
channels[strtoull(std::string{ value.key().takeValue().raw() })] = std::move(newData);
2650 if (jsonData[
"roles"].get(arrayValue) == Jsonifier::ErrorCode::Success) {
2651 this->
roles.clear();
2652 for (JsonifierResult<Field> value: arrayValue) {
2653 RoleData newData{ value.value() };
2657 if (jsonData[
"members"].get(arrayValue) == Jsonifier::ErrorCode::Success) {
2659 for (JsonifierResult<Field> value: arrayValue) {
2660 GuildMemberData newData{ value.value() };
2661 this->
members[strtoull(std::string{ value.key().takeValue().raw() })] = std::move(newData);
2665 if (jsonData[
"messages"].get(arrayValue) == Jsonifier::ErrorCode::Success) {
2667 for (JsonifierResult<Field> value: arrayValue) {
2668 MessageData newData{ value.value() };
2669 this->
messages[strtoull(std::string{ value.key().takeValue().raw() })] = std::move(newData);
2674 StickerPackData::StickerPackData(Value jsonData) {
2675 Jsonifier::Array arrayValue{};
2676 if (!getArray(arrayValue,
"stickers", jsonData)) {
2677 for (JsonifierResult<Value> value: arrayValue) {
2678 StickerData newData{ value.value() };
2679 this->
stickers.emplace_back(std::move(newData));
2685 this->
bannerAssetId = getString(jsonData,
"banner_asset_id");
2687 this->
description = getString(jsonData,
"description");
2689 this->
name = getString(jsonData,
"name");
2691 this->
Id = getId(jsonData,
"id");
2693 this->
skuId = getString(jsonData,
"sku_id");
2696 StickerPackDataVector::StickerPackDataVector(Value jsonData) {
2697 if (jsonData.type() != Jsonifier::JsonType::Null) {
2698 Jsonifier::Array arrayValue{};
2699 if (!getArray(arrayValue, jsonData)) {
2700 for (JsonifierResult<Value> value: arrayValue) {
2701 StickerPackData newData{ value.value() };
2702 this->stickerPacks.emplace_back(std::move(newData));
2708 ConnectionData::ConnectionData(Value jsonData) {
2709 this->
name = getString(jsonData,
"name");
2711 this->
id = getId(jsonData,
"id");
2713 this->
type = getString(jsonData,
"type");
2715 this->
showActivity = getBool(jsonData,
"show_activity");
2717 this->
friendSync = getBool(jsonData,
"friend_sync");
2719 this->
revoked = getBool(jsonData,
"revoked");
2721 this->
verified = getBool(jsonData,
"verified");
2725 Jsonifier::Array arrayValue{};
2726 if (!getArray(arrayValue,
"integrations", jsonData)) {
2727 for (JsonifierResult<Value> value: arrayValue) {
2728 IntegrationData newData{ value.value() };
2734 ApplicationCommandInteractionDataOption::ApplicationCommandInteractionDataOption(Value jsonData) {
2737 this->
focused = getBool(jsonData,
"focused");
2739 this->
name = getString(jsonData,
"name");
2740 Jsonifier::Array arrayValue{};
2741 if (!getArray(arrayValue,
"options", jsonData)) {
2742 for (JsonifierResult<Value>
value: arrayValue) {
2743 ApplicationCommandInteractionDataOption newData{
value.value() };
2744 this->
options.emplace_back(std::move(newData));
2748 Jsonifier::Value newValue{};
2749 if (jsonData[
"value"].get(newValue) == Jsonifier::Success) {
2750 switch (newValue.type()) {
2751 case JsonType::String: {
2752 this->
value.type = JsonType::String;
2753 this->
value.value = newValue.getString().value();
2756 case JsonType::Uint64: {
2757 this->
value.type = JsonType::Uint64;
2758 this->
value.value = newValue.getUint64().value();
2761 case JsonType::Bool: {
2762 this->
value.type = JsonType::Bool;
2763 this->
value.value = newValue.getBool().value();
2766 case JsonType::Float: {
2767 this->
value.type = JsonType::Float;
2768 this->
value.value = newValue.getDouble().value();
2774 this->
value.type = JsonType::Null;
2777 ApplicationCommandInteractionData::ApplicationCommandInteractionData(Value jsonData) {
2780 this->
name = getString(jsonData,
"name");
2782 this->
guildId = getId(jsonData,
"guild_id");
2784 this->
id = getId(jsonData,
"id");
2786 Jsonifier::Array arrayValue{};
2787 if (!getArray(arrayValue,
"options", jsonData)) {
2788 for (JsonifierResult<Value> value: arrayValue) {
2789 ApplicationCommandInteractionDataOption newData{ value.value() };
2790 this->
options.emplace_back(std::move(newData));
2795 if (!getObject(
object,
"resolved", jsonData)) {
2796 this->
resolved = ResolvedData{
object };
2800 InteractionDataData::InteractionDataData(Value jsonData) {
2802 if (!getObject(
object,
"id", jsonData)) {
2806 if (!getObject(
object,
"target_id", jsonData)) {
2811 uint64_t componentType{};
2812 if (!getObject(
object,
"component_type", jsonData)) {
2816 if (!getObject(
object,
"components", jsonData)) {
2817 this->
modalData = ModalInteractionData{ jsonData };
2821 InteractionData::InteractionData(Value jsonData) {
2823 if (!getObject(
object,
"data", jsonData)) {
2824 this->
data = InteractionDataData{
object };
2831 this->
token = getString(jsonData,
"token");
2832 if (!getObject(
object,
"member", jsonData)) {
2833 this->
member = GuildMemberData{
object };
2838 if (!getObject(
object,
"user", jsonData)) {
2839 this->
user = UserData{
object };
2842 this->
channelId = getId(jsonData,
"channel_id");
2844 this->
guildId = getId(jsonData,
"guild_id");
2846 this->
locale = getString(jsonData,
"locale");
2848 this->
guildLocale = getString(jsonData,
"guild_locale");
2850 if (!getObject(
object,
"message", jsonData)) {
2851 this->
message = MessageData{
object };
2854 this->
version = getUint32(jsonData,
"version");
2856 this->
id = getId(jsonData,
"id");
2861 SessionStartData::SessionStartData(Value jsonData) {
2864 this->
remaining = getUint32(jsonData,
"remaining");
2866 this->
resetAfter = getUint32(jsonData,
"reset_after");
2868 this->
total = getUint32(jsonData,
"total");
2871 GatewayBotData::GatewayBotData(Value jsonData) {
2872 this->
url = getString(jsonData,
"url");
2874 this->
shards = getUint32(jsonData,
"shards");
2877 if (!getObject(
object,
"session_start_limit", jsonData)) {
2882 GuildEmojisUpdateEventData::GuildEmojisUpdateEventData(Value jsonData) {
2883 this->guildId = getId(jsonData,
"guild_id");
2885 Jsonifier::Array arrayValue{};
2886 if (!getArray(arrayValue,
"emojis", jsonData)) {
2887 for (JsonifierResult<Value> value: arrayValue) {
2888 EmojiData newData{ value.value() };
2889 this->emojis.emplace_back(std::move(newData));
2894 GuildStickersUpdateEventData::GuildStickersUpdateEventData(Value jsonData) {
2895 this->guildId = getId(jsonData,
"guild_id");
2897 Jsonifier::Array arrayValue{};
2898 if (!getArray(arrayValue,
"stickers", jsonData)) {
2899 for (JsonifierResult<Value> value: arrayValue) {
2900 StickerData newData{ value.value() };
2901 this->stickers.emplace_back(std::move(newData));
2906 GuildMembersChunkEventData::GuildMembersChunkEventData(Value jsonData) {
2907 this->guildId = getId(jsonData,
"guild_id");
2909 this->nonce = getString(jsonData,
"nonce");
2911 this->chunkIndex = getUint32(jsonData,
"chunk_index");
2913 this->chunkCount = getUint32(jsonData,
"chunk_count");
2915 Jsonifier::Array arrayValue{};
2916 if (!getArray(arrayValue,
"presences", jsonData)) {
2917 for (JsonifierResult<Value> value: arrayValue) {
2918 PresenceUpdateData newData{ value.value() };
2919 this->presences.emplace_back(std::move(newData));
2923 if (!getArray(arrayValue,
"not_found", jsonData)) {
2924 for (JsonifierResult<Value> value: arrayValue) {
2925 this->notFound.emplace_back(value.getString().takeValue());
2929 if (!getArray(arrayValue,
"members", jsonData)) {
2930 for (JsonifierResult<Value> value: arrayValue) {
2931 GuildMemberData newData{ value.value() };
2932 this->members.emplace_back(std::move(newData));
2937 MediaTranscoding::MediaTranscoding(Value jsonData) {
2938 this->thePreset = getString(jsonData,
"preset");
2940 this->theUrl = getString(jsonData,
"url");
2943 Song::Song(Value jsonData) {
2945 getString(getObject(getObject(getObject(jsonData,
"lengthText"),
"accessibility"),
"accessibilityData"),
"label");
2946 std::string newString = getString(
2947 getObject(getArray(getObject(getObject(getArray(jsonData,
"detailedMetadataSnippets"), 0),
"snippetText"),
"runs"), 0),
2949 if (newString.size() > 256) {
2950 newString = newString.substr(0, 256);
2954 this->
thumbnailUrl = getString(getObject(getArray(getObject(jsonData,
"thumbnail"),
"thumbnails"), 0),
"url");
2955 std::string newTitle01 = getString(getObject(getArray(getObject(jsonData,
"title"),
"runs"), 0),
"text");
2956 if (newTitle01.size() > 256) {
2957 newTitle01 = newTitle01.substr(0, 256);
2959 if (newTitle01.size() > 0) {
2960 this->
songTitle = utf8MakeValid(newTitle01);
2962 std::string newTitle02 = getString(getObject(jsonData,
"title"),
"simpleText");
2963 if (newTitle02.size() > 256) {
2964 newTitle02 = newTitle02.substr(0, 256);
2966 if (newTitle02.size() > 0) {
2967 this->
songTitle = utf8MakeValid(newTitle02);
2970 if (newTitle01 !=
"") {
2976 this->songId = getString(jsonData,
"videoId");
2978 this->trackAuthorization = getString(jsonData,
"track_authorization");
2980 std::vector<MediaTranscoding> theMedia{};
2981 auto arrayValueNew = getArray(getObject(jsonData,
"media"),
"transcodings");
2982 if (arrayValueNew.didItSucceed) {
2983 for (
auto value: arrayValueNew.arrayValue) {
2984 MediaTranscoding dataNew{ value.value() };
2985 theMedia.emplace_back(dataNew);
2990 for (
auto& value: theMedia) {
2991 if (value.thePreset ==
"opus_0_0") {
2993 this->firstDownloadUrl = value.theUrl;
2994 this->songId = value.theUrl;
2995 this->doWeGetSaved =
true;
3000 for (
auto& value: theMedia) {
3001 if (value.thePreset ==
"mp3_0_0") {
3002 this->firstDownloadUrl = value.theUrl;
3003 this->songId = value.theUrl;
3008 if (!isItFound2 && !isItFound) {
3009 for (
auto& value: theMedia) {
3010 this->firstDownloadUrl = value.theUrl;
3011 this->songId = value.theUrl;
3015 newString = getString(jsonData,
"title");
3016 if (newString.size() > 0) {
3017 if (newString.size() > 256) {
3018 newString = newString.substr(0, 256);
3020 this->
songTitle = utf8MakeValid(newString);
3023 newString = getString(jsonData,
"description");
3024 if (newString.size() > 0) {
3025 if (newString.size() > 256) {
3026 newString = newString.substr(0, 256);
3032 newString = getString(jsonData,
"artwork_url");
3033 if (newString.size() > 0) {
3037 newString = getString(getObject(jsonData,
"user"),
"avatar_url");
3038 if (newString.size() > 0) {
3042 uint32_t theDuration = getUint32(jsonData,
"duration");
3043 if (theDuration != 0) {
3044 this->
duration = TimeStamp::convertMsToDurationString(theDuration);
3047 newString = getString(jsonData,
"permalink_url");
3048 if (newString.size() > 0) {
3053 AttachmentData::operator Serializer() {
3055 data[
"content_type"] = this->contentType;
3056 data[
"description"] = this->description;
3057 data[
"ephemeral"] = this->ephemeral;
3058 data[
"file_name"] = this->filename;
3059 data[
"proxy_url"] = this->proxyUrl;
3060 data[
"height"] = this->height;
3061 data[
"width"] = this->width;
3062 data[
"size"] = this->size;
3063 data[
"url"] = this->url;
3067 EmbedFieldData::operator Serializer() {
3069 data[
"inline"] = this->Inline;
3070 data[
"value"] = escapeCharacters(this->value);
3071 data[
"name"] = escapeCharacters(this->name);
3075 EmbedData::operator Serializer() {
3077 for (
auto& value2: this->fields) {
3078 data[
"fields"].emplaceBack(value2.operator Serializer());
3080 std::string realColorVal = std::to_string(this->hexColorValue.getIntColorValue());
3081 data[
"footer"][
"proxy_icon_url"] = this->footer.proxyIconUrl;
3082 data[
"footer"][
"icon_url"] = this->footer.iconUrl;
3083 data[
"footer"][
"text"] = escapeCharacters(this->footer.text);
3084 data[
"author"][
"proxy_icon_url"] = this->author.proxyIconUrl;
3085 data[
"author"][
"icon_url"] = this->author.iconUrl;
3086 data[
"author"][
"name"] = this->author.name;
3087 data[
"author"][
"url"] = this->author.url;
3088 data[
"thumbnail"][
"proxy_url"] = this->thumbnail.proxyUrl;
3089 data[
"thumbnail"][
"height"] = this->thumbnail.height;
3090 data[
"thumbnail"][
"width"] = this->thumbnail.width;
3091 data[
"thumbnail"][
"url"] = this->thumbnail.url;
3092 data[
"image"][
"proxy_url"] = this->image.proxyUrl;
3093 data[
"image"][
"height"] = this->image.height;
3094 data[
"image"][
"width"] = this->image.width;
3095 data[
"image"][
"url"] = this->image.url;
3096 data[
"video"][
"proxy_url"] = this->video.proxyUrl;
3097 data[
"video"][
"height"] = this->video.height;
3098 data[
"video"][
"url"] = this->video.url;
3099 data[
"video"][
"width"] = this->video.width;
3100 data[
"provider"][
"name"] = this->provider.name;
3101 data[
"provider"][
"url"] = this->provider.url;
3102 data[
"description"] = escapeCharacters(this->description);
3103 data[
"timestamp"] = this->timeStamp;
3104 data[
"title"] = escapeCharacters(this->title);
3105 data[
"color"] = realColorVal;
3106 data[
"type"] = this->type;
3107 data[
"url"] = this->url;
3131 field.value = value;
3133 this->fields.emplace_back(field);
3153 this->
title = titleNew;
3162 MessageReferenceData::operator Serializer() {
3164 data[
"fail_if_not_exists"] = this->failIfNotExists;
3165 data[
"message_id"] = this->messageId;
3166 data[
"channel_id"] = this->channelId;
3167 data[
"guild_id"] = this->guildId;
3171 GuildApplicationCommandPermissionsDataVector::operator std::vector<GuildApplicationCommandPermissionsData>() {
3172 return this->guildApplicationCommandPermissionss;
3175 BanDataVector::operator std::vector<BanData>() {
3179 UpdateVoiceStateData::operator Serializer() {
3182 if (this->channelId == 0) {
3183 data[
"d"][
"channel_id"] = JsonType::Null;
3185 data[
"d"][
"channel_id"] = this->channelId;
3187 data[
"d"][
"self_deaf"] = this->selfDeaf;
3188 data[
"d"][
"self_mute"] = this->selfMute;
3189 data[
"d"][
"guild_id"] = this->guildId;
3193 GuildDataVector::operator std::vector<GuildData>() {
3194 return this->guilds;
3197 GuildScheduledEventUserDataVector::operator std::vector<GuildScheduledEventUserData>() {
3198 return this->guildScheduledEventUsers;
3201 GuildScheduledEventDataVector::operator std::vector<GuildScheduledEventData>() {
3202 return this->guildScheduledEvents;
3205 InviteDataVector::operator std::vector<InviteData>() {
3206 return this->invites;
3209 GuildTemplateDataVector::operator std::vector<GuildTemplateData>() {
3210 return this->guildTemplates;
3213 WebHookDataVector::operator std::vector<WebHookData>() {
3214 return this->webHooks;
3217 auto AuditLogData::getAuditLogData(
const Snowflake userIdOfChanger,
AuditLogEvent auditLogType) {
3219 if (value.id == userIdOfChanger && value.actionType == auditLogType) {
3223 return AuditLogEntryData();
3226 auto AuditLogData::getAuditLogData(
AuditLogEvent auditLogType,
const Snowflake userIdOfTarget) {
3227 for (
auto& value: this->auditLogEntries) {
3228 if (value.targetId == userIdOfTarget && value.actionType == auditLogType) {
3232 return AuditLogEntryData();
3235 ApplicationCommandOptionChoiceData::operator Serializer() {
3237 data[
"name"] = this->name;
3238 data[
"name_localizations"] = this->nameLocalizations;
3239 switch (this->type) {
3240 case JsonType::Int64: {
3241 data[
"value"] = uint64_t{ stoull(this->value) };
3244 case JsonType::Uint64: {
3245 data[
"value"] = uint64_t{ stoull(this->value) };
3248 case JsonType::Float: {
3249 data[
"value"] =
double{ stod(this->value) };
3252 case JsonType::Bool: {
3253 if (this->value ==
"false") {
3254 data[
"value"] =
bool{};
3256 data[
"value"] =
bool{
true };
3260 case JsonType::String: {
3261 data[
"value"] = this->value;
3264 case JsonType::Null: {
3265 data[
"value"] = this->value;
3272 ApplicationCommandOptionData::operator Serializer() {
3275 data[
"channel_types"] = this->channelTypes;
3278 data[
"required"] = this->required;
3280 if (this->descriptionLocalizations.size() > 0) {
3281 data[
"description_localizations"] = this->descriptionLocalizations;
3283 if (this->nameLocalizations.size() > 0) {
3284 data[
"name_localizations"] = this->nameLocalizations;
3286 data[
"description"] = this->description;
3287 if (this->minValue != std::numeric_limits<int32_t>::max()) {
3288 data[
"min_value"] = this->minValue;
3290 if (this->maxValue != std::numeric_limits<int32_t>::min()) {
3291 data[
"max_value"] = this->maxValue;
3293 data[
"required"] = this->required;
3294 data[
"name"] = this->name;
3295 data[
"type"] = this->type;
3296 for (
auto& value: this->choices) {
3297 data[
"choices"].emplaceBack(value.operator Serializer());
3299 if (this->choices.size() == 0) {
3300 data[
"autocomplete"] = this->autocomplete;
3302 for (
auto& value: this->options) {
3303 data[
"options"].emplaceBack(value.operator Serializer());
3308 ThreadMemberDataVector::operator std::vector<ThreadMemberData>() {
3309 return this->threadMembers;
3312 YouTubeFormatVector::operator std::vector<YouTubeFormat>() {
3313 return this->formats;
3316 AudioFrameData& AudioFrameData::operator+=(std::basic_string_view<std::byte> other)
noexcept {
3317 if (this->data.size() < this->currentSize + other.size()) {
3318 this->data.resize(other.size() + this->currentSize);
3320 std::copy(other.data(), other.data() + other.size(), this->data.data() + this->currentSize);
3321 this->currentSize += other.size();
3326 AudioFrameData& AudioFrameData::operator+=(std::byte character) {
3328 this->
data.push_back(character);
3332 bool operator==(
const AudioFrameData& lhs,
const AudioFrameData& rhs) {
3333 if (lhs.data != rhs.data) {
3336 if (lhs.currentSize != rhs.currentSize) {
3339 if (lhs.guildMemberId != rhs.guildMemberId) {
3342 if (lhs.type != rhs.type) {
3348 AudioFrameData& AudioFrameData::operator=(AudioFrameData&& other)
noexcept {
3349 if (this->data.size() < other.data.size() + this->currentSize) {
3350 this->data.resize(other.data.size() + this->currentSize);
3352 std::copy(other.data.data(), other.data.data() + other.data.size(), this->data.data() + this->currentSize);
3353 this->currentSize += other.data.size();
3354 this->guildMemberId = std::move(other.guildMemberId);
3355 this->type = other.type;
3356 other.currentSize = 0;
3361 AudioFrameData::AudioFrameData(AudioFrameData&& other)
noexcept {
3362 *
this = std::move(other);
3365 void AudioFrameData::clearData() noexcept {
3372 AllowedMentionsData::operator Serializer() {
3374 for (
auto& value: this->parse) {
3375 data[
"parse"].emplaceBack(value);
3377 for (
auto& value: this->roles) {
3378 data[
"roles"].emplaceBack(value);
3380 for (
auto& value: this->users) {
3381 data[
"users"].emplaceBack(value);
3383 data[
"replied_user"] = this->repliedUser;
3387 ActionRowData::operator Serializer() {
3390 if (this->components.size() > 0) {
3391 for (
auto& valueNew: this->components) {
3393 Serializer component{};
3394 if (valueNew.emoji.name !=
"") {
3395 component[
"emoji"][
"animated"] = valueNew.emoji.animated;
3396 component[
"emoji"][
"name"] = std::string{ valueNew.emoji.name };
3397 if (valueNew.emoji.id != 0) {
3398 component[
"emoji"][
"id"] = valueNew.emoji.id;
3401 component[
"custom_id"] = valueNew.customId;
3402 component[
"disabled"] = valueNew.disabled;
3403 component[
"label"] = valueNew.label;
3404 component[
"style"] = valueNew.style;
3405 component[
"type"] = valueNew.type;
3406 component[
"url"] = valueNew.url;
3407 data[
"components"].emplaceBack(component);
3411 Serializer component{};
3412 for (
auto& value01: valueNew.options) {
3413 Serializer option{};
3414 if (valueNew.emoji.name !=
"") {
3415 component[
"emoji"][
"animated"] = valueNew.emoji.animated;
3416 component[
"emoji"][
"name"] = std::string{ valueNew.emoji.name };
3417 if (valueNew.emoji.id != 0) {
3418 component[
"emoji"][
"id"] = valueNew.emoji.id;
3421 option[
"description"] = value01.description;
3422 option[
"default"] = value01._default;
3423 option[
"label"] = value01.label;
3424 option[
"value"] = value01.value;
3425 component[
"options"].emplaceBack(option);
3427 component[
"placeholder"] = valueNew.placeholder;
3428 component[
"max_values"] = valueNew.maxValues;
3429 component[
"min_values"] = valueNew.minValues;
3430 component[
"custom_id"] = valueNew.customId;
3431 component[
"disabled"] = valueNew.disabled;
3432 component[
"type"] = valueNew.type;
3433 data[
"components"].emplaceBack(component);
3436 Serializer component{};
3437 component[
"placeholder"] = valueNew.placeholder;
3438 component[
"min_length"] = valueNew.minLength;
3439 component[
"max_length"] = valueNew.maxLength;
3440 component[
"custom_id"] = valueNew.customId;
3441 component[
"required"] = valueNew.required;
3442 component[
"style"] = valueNew.style;
3443 component[
"label"] = valueNew.label;
3444 component[
"value"] = valueNew.value;
3445 component[
"type"] = valueNew.type;
3446 data[
"components"].emplaceBack(component);
3453 MessageData& MessageData::operator=(
const MessageData& other) {
3454 if (
this != &other) {
3455 if (other.referencedMessage) {
3468 this->components = other.components;
3472 this->reactions = other.reactions;
3476 this->
content = other.content;
3477 this->
guildId = other.guildId;
3478 this->
member = other.member;
3479 this->
thread = other.thread;
3480 this->
pinned = other.pinned;
3481 this->
author = other.author;
3482 this->
embeds = other.embeds;
3483 this->
nonce = other.nonce;
3484 this->
flags = other.flags;
3485 this->
type = other.type;
3486 this->
tts = other.tts;
3487 this->
id = other.id;
3492 MessageData::MessageData(
const MessageData& other) {
3496 StickerPackDataVector::operator std::vector<StickerPackData>() {
3497 return this->stickerPacks;
3500 ConnectionDataVector::operator std::vector<ConnectionData>() {
3501 return this->connections;
3504 ConnectionDataVector::ConnectionDataVector(Value jsonData)
noexcept {
3505 if (jsonData.type() != Jsonifier::JsonType::Null) {
3506 Jsonifier::Array arrayValue{};
3507 if (!getArray(arrayValue, jsonData)) {
3508 for (JsonifierResult<Value> value: arrayValue) {
3509 ConnectionData newData{ value.value() };
3510 this->connections.emplace_back(std::move(newData));
3516 VoiceRegionDataVector::operator std::vector<VoiceRegionData>() {
3517 return this->voiceRegions;
3520 IntegrationDataVector::operator std::vector<IntegrationData>() {
3521 return this->integeregrations;
3524 InputEventData& InputEventData::operator=(InputEventData&& other)
noexcept {
3525 if (
this != &other) {
3526 *this->interactionData = std::move(*other.interactionData);
3527 this->responseType = other.responseType;
3532 InputEventData::InputEventData(InputEventData&& other)
noexcept {
3533 *
this = std::move(other);
3536 InputEventData& InputEventData::operator=(
const InputEventData& other)
noexcept {
3537 if (
this != &other) {
3538 *this->interactionData = *other.interactionData;
3539 this->responseType = other.responseType;
3544 InputEventData::InputEventData(
const InputEventData& other)
noexcept {
3548 InputEventData& InputEventData::operator=(
const InteractionData& other)
noexcept {
3549 *this->interactionData = other;
3553 InputEventData::InputEventData(
const InteractionData& interactionData)
noexcept {
3554 *
this = interactionData;
3559 returnData.
id = this->interactionData->user.id;
3561 return this->interactionData->user;
3566 returnData.
id = this->interactionData->channelId;
3579 returnData.
id = this->interactionData->guildId;
3585 return *this->interactionData;
3589 return this->interactionData->message;
3594 this->interactionToken = dataPackage.
token;
3595 this->messageId = dataPackage.
message.
id;
3596 this->channelId = dataPackage.
channelId;
3597 this->interactionId = dataPackage.
id;
3598 this->eventType = dataPackage.
type;
3602 RespondToInputEventData::RespondToInputEventData(
const InteractionData& dataPackage) {
3603 *
this = dataPackage;
3606 RespondToInputEventData& RespondToInputEventData::operator=(
const InputEventData& dataPackage) {
3607 this->applicationId = dataPackage.getInteractionData().applicationId;
3608 this->interactionToken = dataPackage.getInteractionData().token;
3609 this->interactionId = dataPackage.getInteractionData().id;
3610 this->channelId = dataPackage.getChannelData().id;
3611 this->messageId = dataPackage.getMessageData().id;
3615 RespondToInputEventData::RespondToInputEventData(
const InputEventData& dataPackage) {
3616 *
this = dataPackage;
3620 const std::string& buttonLabel,
ButtonStyle buttonStyle,
const std::string& emojiName, Snowflake emojiId,
const std::string& url) {
3621 if (this->components.size() == 0) {
3623 this->components.emplace_back(actionRowData);
3625 if (this->components.size() < 5) {
3626 if (this->components[this->components.size() - 1].components.size() < 5) {
3630 component.
label = buttonLabel;
3631 component.
style =
static_cast<int32_t
>(buttonStyle);
3635 component.
url = url;
3636 this->components[this->components.size() - 1].components.emplace_back(component);
3637 }
else if (this->components[this->components.size() - 1].components.size() == 5) {
3639 this->components.emplace_back(actionRowData);
3646 std::vector<SelectOptionData> options,
const std::string& placeholder, int32_t maxValues, int32_t minValues, SelectMenuType type,
3647 std::vector<ChannelType> channelTypes) {
3648 if (this->components.size() == 0) {
3650 this->components.emplace_back(actionRowData);
3652 if (this->components.size() < 5) {
3653 if (this->components[this->components.size() - 1].components.size() < 5) {
3658 componentData.
customId = customIdNew;
3662 componentData.
options = options;
3663 this->components[this->components.size() - 1].components.emplace_back(componentData);
3664 }
else if (this->components[this->components.size() - 1].components.size() == 5) {
3666 this->components.emplace_back(actionRowData);
3673 const std::string& titleNew,
const std::string& customIdNew,
bool required, int32_t minLength, int32_t maxLength,
3674 TextInputStyle inputStyle,
const std::string& label,
const std::string& placeholder) {
3675 this->title = topTitleNew;
3676 this->customId = topCustomIdNew;
3677 if (this->components.size() == 0) {
3679 this->components.emplace_back(actionRowData);
3681 if (this->components.size() < 5) {
3682 if (this->components[this->components.size() - 1].components.size() < 5) {
3685 component.customId = customIdNew;
3686 component.style =
static_cast<int32_t
>(inputStyle);
3687 component.title = titleNew;
3688 component.maxLength = maxLength;
3689 component.minLength = minLength;
3690 component.label = label;
3691 component.required = required;
3692 component.placeholder = placeholder;
3693 this->components[this->components.size() - 1].components.emplace_back(component);
3694 }
else if (this->components[this->components.size() - 1].components.size() == 5) {
3696 this->components.emplace_back(actionRowData);
3703 this->files.emplace_back(theFile);
3708 this->allowedMentions = dataPackage;
3713 this->
type = typeNew;
3718 this->components.emplace_back(dataPackage);
3723 this->embeds.emplace_back(dataPackage);
3728 this->content = dataPackage;
3733 this->tts = enabledTTs;
3738 std::unordered_map<std::string, std::string> theNameLocalizations) {
3741 choiceData.name = theName;
3742 switch (value.getType()) {
3743 case JsonType::String: {
3744 choiceData.type = JsonType::String;
3747 case JsonType::Float: {
3748 choiceData.type = JsonType::Float;
3751 case JsonType::Uint64: {
3752 choiceData.type = JsonType::Uint64;
3755 case JsonType::Int64: {
3756 choiceData.type = JsonType::Int64;
3759 case JsonType::Bool: {
3760 choiceData.type = JsonType::Bool;
3764 value.refreshString(JsonifierSerializeType::Json);
3765 choiceData.value = value.operator std::string();
3766 this->choices.emplace_back(choiceData);
3771 this->targetUserId = targetUserIdNew;
3776 ButtonStyle buttonStyle,
const std::string& emojiName, Snowflake emojiId,
const std::string& url) {
3777 if (this->components.size() == 0) {
3779 this->components.emplace_back(actionRowData);
3781 if (this->components.size() < 5) {
3782 if (this->components[this->components.size() - 1].components.size() < 5) {
3786 component.
label = buttonLabel;
3787 component.
style =
static_cast<int32_t
>(buttonStyle);
3791 component.
url = url;
3792 this->components[this->components.size() - 1].components.emplace_back(component);
3793 }
else if (this->components[this->components.size() - 1].components.size() == 5) {
3795 this->components.emplace_back(actionRowData);
3802 std::vector<SelectOptionData> options,
const std::string& placeholder, int32_t maxValues, int32_t minValues, SelectMenuType type,
3803 std::vector<ChannelType> channelTypes) {
3804 if (this->components.size() == 0) {
3806 this->components.emplace_back(actionRowData);
3808 if (this->components.size() < 5) {
3809 if (this->components[this->components.size() - 1].components.size() < 5) {
3814 componentData.
customId = customIdNew;
3818 componentData.
options = options;
3819 this->components[this->components.size() - 1].components.emplace_back(componentData);
3820 }
else if (this->components[this->components.size() - 1].components.size() == 5) {
3822 this->components.emplace_back(actionRowData);
3829 const std::string& titleNew,
const std::string& customIdNew,
bool required, int32_t minLength, int32_t maxLength,
3830 TextInputStyle inputStyle,
const std::string& label,
const std::string& placeholder) {
3831 this->title = topTitleNew;
3832 this->customId = topCustomIdNew;
3833 if (this->components.size() == 0) {
3835 this->components.emplace_back(actionRowData);
3837 if (this->components.size() < 5) {
3838 if (this->components[this->components.size() - 1].components.size() < 5) {
3841 component.customId = customIdNew;
3842 component.style =
static_cast<int32_t
>(inputStyle);
3843 component.title = titleNew;
3844 component.maxLength = maxLength;
3845 component.minLength = minLength;
3846 component.label = label;
3847 component.required = required;
3848 component.placeholder = placeholder;
3849 this->components[this->components.size() - 1].components.emplace_back(component);
3850 }
else if (this->components[this->components.size() - 1].components.size() == 5) {
3852 this->components.emplace_back(actionRowData);
3859 this->files.emplace_back(theFile);
3864 this->allowedMentions = dataPackage;
3869 this->components.emplace_back(dataPackage);
3874 this->embeds.emplace_back(dataPackage);
3879 this->content = dataPackage;
3884 this->tts = enabledTTs;
3902 InteractionResponseData::InteractionResponseData(
const RespondToInputEventData& other) {
3906 InteractionResponseData::operator Serializer() {
3908 data[
"type"] = this->type;
3909 if (this->data.attachments.size() > 0) {
3910 for (
auto& value: this->data.attachments) {
3911 data[
"data"][
"attachments"].emplaceBack(value);
3914 if (this->data.components.size() == 0) {
3915 data[
"data"][
"components"].emplaceBack(ActionRowData{});
3916 data[
"data"][
"components"].getValue<Serializer::ArrayType>().clear();
3918 for (
auto& value: this->data.components) {
3919 data[
"data"][
"components"].emplaceBack(value);
3922 if (this->data.allowedMentions.parse.size() > 0 || this->data.allowedMentions.roles.size() > 0 ||
3923 this->data.allowedMentions.users.size() > 0) {
3924 data[
"data"][
"allowed_mentions"] = this->data.allowedMentions.operator Serializer();
3926 if (this->data.choices.size() > 0) {
3927 for (
auto& value: this->data.choices) {
3928 Serializer valueNew{};
3929 valueNew[
"name"] = value.name;
3930 valueNew[
"name_localizations"] = value.nameLocalizations;
3931 valueNew[
"value"] = value.value;
3932 data[
"data"][
"choices"].emplaceBack(value);
3935 if (this->data.embeds.size() == 0) {
3936 data[
"data"][
"embeds"].emplaceBack(EmbedData{});
3937 data[
"data"][
"embeds"].getValue<Serializer::ArrayType>().clear();
3939 for (
auto& value: this->data.embeds) {
3940 data[
"data"][
"embeds"].emplaceBack(value);
3943 if (this->data.customId !=
"") {
3944 data[
"data"][
"custom_id"] = this->data.customId;
3946 if (this->data.content !=
"") {
3947 data[
"data"][
"content"] = this->data.content;
3949 if (this->data.title !=
"") {
3950 data[
"data"][
"title"] = this->data.title;
3952 data[
"data"][
"flags"] = this->data.flags;
3953 data[
"data"][
"tts"] = this->data.tts;
3957 void parseCommandDataOption(std::unordered_map<std::string, JsonStringValue>& values, ApplicationCommandInteractionDataOption& data) {
3958 JsonStringValue valueNew{};
3959 valueNew.type = data.value.type;
3960 valueNew.value = data.value.value;
3961 values.insert_or_assign(data.name, valueNew);
3962 for (
auto& value: data.options) {
3963 parseCommandDataOption(values, value);
3967 CommandData& CommandData::operator=(
const CommandData& other)
noexcept {
3968 this->subCommandGroupName = other.subCommandGroupName;
3969 this->subCommandName = other.subCommandName;
3970 this->commandName = other.commandName;
3971 this->optionsArgs = other.optionsArgs;
3972 this->eventData = other.eventData;
3976 CommandData::CommandData(
const CommandData& other)
noexcept {
3980 CommandData::CommandData(InputEventData inputEventData) {
3981 if (inputEventData.interactionData->data.applicationCommandData.name !=
"") {
3982 this->commandName = inputEventData.interactionData->data.applicationCommandData.name;
3984 if (inputEventData.interactionData->data.messageInteractionData.targetId != 0) {
3985 this->optionsArgs.values.emplace(
"target_id",
3986 JsonStringValue{ .value = inputEventData.interactionData->data.messageInteractionData.targetId, .type = JsonType::String });
3987 }
else if (inputEventData.interactionData->data.userInteractionData.targetId != 0) {
3988 this->optionsArgs.values.emplace(
"target_id",
3989 JsonStringValue{ .value = inputEventData.interactionData->data.userInteractionData.targetId, .type = JsonType::String });
3991 this->eventData = inputEventData;
3992 for (
auto& value: this->eventData.interactionData->data.applicationCommandData.options) {
3993 JsonStringValue valueNew{};
3994 valueNew.type = value.value.type;
3995 valueNew.value = value.value.value;
3996 this->optionsArgs.values.insert_or_assign(value.name, valueNew);
3997 parseCommandDataOption(this->optionsArgs.values, value);
3999 for (
auto& value: inputEventData.interactionData->data.applicationCommandData.options) {
4001 this->subCommandName = value.name;
4004 this->subCommandGroupName = value.name;
4010 return *this->eventData.interactionData;
4034 return this->commandName;
4038 return this->subCommandName;
4042 return this->subCommandGroupName;
4046 return this->optionsArgs;
4050 return this->eventData;
4055 this->discordCoreClient = discordCoreClientNew;
4058 MoveThroughMessagePagesData moveThroughMessagePages(
const std::string& userID, InputEventData originalEvent, uint32_t currentPageIndex,
4059 const std::vector<EmbedData>& messageEmbeds,
bool deleteAfter, uint32_t waitForMaxMs,
bool returnResult) {
4060 MoveThroughMessagePagesData returnData{};
4061 uint32_t newCurrentPageIndex = currentPageIndex;
4062 StopWatch stopWatch{ Milliseconds{ waitForMaxMs } };
4063 auto createResponseData = std::make_unique<CreateInteractionResponseData>(originalEvent);
4064 auto interactionResponse = std::make_unique<RespondToInputEventData>(originalEvent);
4065 auto embedData = std::make_unique<EmbedData>();
4066 embedData->setColor(
"FEFEFE");
4067 embedData->setTitle(
"__**Permissions Issue:**__");
4069 embedData->setDescription(
"Sorry, but that button can only be pressed by <@" + userID +
">!");
4070 createResponseData->addMessageEmbed(*embedData);
4072 if (messageEmbeds.size() > 0) {
4073 interactionResponse->addMessageEmbed(messageEmbeds[currentPageIndex]);
4083 while (!stopWatch.hasTimePassed()) {
4084 std::this_thread::sleep_for(1ms);
4085 std::unique_ptr<ButtonCollector> button{ std::make_unique<ButtonCollector>(originalEvent) };
4086 std::vector<ButtonResponseData> buttonIntData{
4087 button->collectButtonData(
false, waitForMaxMs, 1, *createResponseData, Snowflake{ stoull(userID) }).get()
4089 std::unique_ptr<InteractionData> interactionData{ std::make_unique<InteractionData>() };
4090 if (buttonIntData.size() == 0 || buttonIntData.at(0).buttonId ==
"empty" || buttonIntData.at(0).buttonId ==
"exit") {
4091 std::unique_ptr<RespondToInputEventData> dataPackage02{ std::make_unique<RespondToInputEventData>(originalEvent) };
4092 if (buttonIntData.at(0).buttonId ==
"empty") {
4093 *dataPackage02 = originalEvent;
4095 interactionData = std::make_unique<InteractionData>(buttonIntData.at(0));
4096 *dataPackage02 = RespondToInputEventData{ *interactionData };
4099 dataPackage02->addMessageEmbed(messageEmbeds[newCurrentPageIndex]);
4100 for (
size_t x = 0; x < originalEvent.getMessageData().components.size(); ++x) {
4101 ActionRowData actionRow{};
4102 for (
size_t y = 0; y < originalEvent.getMessageData().components[x].components.size(); ++y) {
4103 auto component = originalEvent.getMessageData().components[x].components[y];
4104 component.disabled =
true;
4105 actionRow.components.push_back(component);
4107 dataPackage02->addComponentRow(actionRow);
4109 if (deleteAfter ==
true) {
4110 InputEventData dataPackage03{ originalEvent };
4116 MoveThroughMessagePagesData dataPackage03{};
4117 dataPackage03.inputEventData = originalEvent;
4118 dataPackage03.buttonId =
"exit";
4119 return dataPackage03;
4120 }
else if (buttonIntData.at(0).buttonId ==
"forwards" || buttonIntData.at(0).buttonId ==
"backwards") {
4121 if (buttonIntData.at(0).buttonId ==
"forwards" && (newCurrentPageIndex == (messageEmbeds.size() - 1))) {
4122 newCurrentPageIndex = 0;
4123 }
else if (buttonIntData.at(0).buttonId ==
"forwards" && (newCurrentPageIndex < messageEmbeds.size())) {
4124 ++newCurrentPageIndex;
4125 }
else if (buttonIntData.at(0).buttonId ==
"backwards" && (newCurrentPageIndex > 0)) {
4126 --newCurrentPageIndex;
4127 }
else if (buttonIntData.at(0).buttonId ==
"backwards" && (newCurrentPageIndex == 0)) {
4128 newCurrentPageIndex =
static_cast<uint32_t
>(messageEmbeds.size()) - 1;
4130 interactionData = std::make_unique<InteractionData>(buttonIntData.at(0));
4131 auto dataPackage = RespondToInputEventData{ *interactionData };
4133 for (
size_t x = 0; x < originalEvent.getMessageData().components.size(); ++x) {
4134 ActionRowData actionRow{};
4135 for (
size_t y = 0; y < originalEvent.getMessageData().components[x].components.size(); ++y) {
4136 auto component = originalEvent.getMessageData().components[x].components[y];
4137 component.disabled =
false;
4138 actionRow.components.push_back(component);
4140 dataPackage.addComponentRow(actionRow);
4142 dataPackage.addMessageEmbed(messageEmbeds[newCurrentPageIndex]);
4144 }
else if (buttonIntData.at(0).buttonId ==
"select") {
4145 if (deleteAfter ==
true) {
4146 InputEventData dataPackage03{ originalEvent };
4149 std::unique_ptr<InteractionData> interactionData = std::make_unique<InteractionData>(buttonIntData.at(0));
4150 auto dataPackage = RespondToInputEventData{ *interactionData };
4152 dataPackage.addMessageEmbed(messageEmbeds[newCurrentPageIndex]);
4153 for (
size_t x = 0; x < originalEvent.getMessageData().components.size(); ++x) {
4154 ActionRowData actionRow{};
4155 for (
size_t y = 0; y < originalEvent.getMessageData().components[x].components.size(); ++y) {
4156 auto component = originalEvent.getMessageData().components[x].components[y];
4157 component.disabled =
true;
4158 actionRow.components.push_back(component);
4160 dataPackage.addComponentRow(actionRow);
4164 returnData.currentPageIndex = newCurrentPageIndex;
4165 returnData.inputEventData = originalEvent;
4166 returnData.buttonId = buttonIntData.at(0).buttonId;
TimeFormat
Time formatting methods.
@ LongDateTime
"Tuesday, 20 April 2021 16:20" - Long Date/Time
ButtonStyle
Button styles.
GuildScheduledEventStatus
GuildScheduledEventStatus.
TriggerType
Trigger types for auto-moderation.
AuditLogEvent
Audit log events.
StickerFormatType
Sticker format types.
StageInstancePrivacyLevel
Stage instance privacy levels.
ApplicationCommandOptionType
Application command-option types.
GuildScheduledEventPrivacyLevel
Guild scheduled event privacy levels.
ComponentType
Component types.
SortOrderTypes
The sorting order, for Guild Forum channels.
InteractionType
Interaction types.
ChannelType
Channel types.
DiscordCoreAPI_Dll std::string getTimeAndDate()
Acquires a timeStamp with the current time and date - suitable for use in message-embeds.
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.
EventType
Event types for auto-moderation.
ApplicationCommandType
Application command types.
ConnectionVisibilityTypes
Connection visibility 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.
TextInputStyle
Text input style for modals.
@ Verified
Is it verified?
@ System
Is it a system integration?
@ MFAEnabled
Is MFA enabled?
@ Sub_Command
Sub-command.
@ Sub_Command_Group
Sub-command group.
@ Channel_Message_With_Source
Respond to an interaction with a message.
@ 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.
@ Unavailable
Unavailable.
@ WidgetEnabled
Widget enabled.
@ Edit_Interaction_Response
Interaction response edit.
@ invisible
Invisible and shown as offline.
The main namespace for this library.
static ChannelData getCachedChannel(GetChannelData dataPackage)
Collects a Channel from the library's cache.
DiscordCoreClient - The main class for this library.
static BotUser getBotUser()
For collecting a copy of the current bot's User.
std::string getCreatedAtTimestamp(TimeFormat timeFormat)
Converts the snowflake-id into a time and date stamp.
std::string botId
What is the bot id?
std::string integrationId
What is the integration id?
Data structure representing a single User.
StringWrapper userName
The user's userName, not unique across the platform identify.
IconHash avatar
The user's avatar hash.
StringWrapper discriminator
The user's 4-digit discord-tag identify.
UserFlags flags
The public flags on a user' s account.
std::string proxyIconUrl
Proxy icon url.
std::string text
Footer text.
std::string iconUrl
Icon url.
int32_t width
Image width.
int32_t height
Image height.
std::string url
Image url.
std::string proxyUrl
Proxy url.
std::string proxyUrl
Proxy url.
std::string url
Image url.
int32_t height
Image height.
int32_t width
Image width.
int32_t width
Image width.
std::string url
Image url.
int32_t height
Image height.
std::string proxyUrl
Proxy url.
std::string iconUrl
Icon url.
std::string proxyIconUrl
Proxy icon url.
std::string value
The text on the field.
bool Inline
Is the field inline with the rest of them?
std::string name
The title of the field.
std::string url
Url for the embed.
EmbedData & setFooter(const std::string &footerText, const std::string &footerIconUrlText="")
Sets the footer's values for the embed.
EmbedData & setTitle(const std::string &titleNew)
Sets the title of the embed.
EmbedData & setImage(const std::string &imageUrl)
Sets the image of the embed.
EmbedProviderData provider
Embed provider data.
EmbedData & addField(const std::string &name, const std::string &value, bool Inline=true)
Adds a field to the embed.
std::string type
Type of the embed.
EmbedAuthorData author
Embed author data.
std::string description
Description of the embed.
EmbedThumbnailData thumbnail
Embed thumbnail data.
EmbedImageData image
Embed image data.
ColorValue hexColorValue
Hex color value of the embed.
std::string title
Title of the embed.
EmbedVideoData video
Embed video data.
EmbedData & setDescription(const std::string &descriptionNew)
Sets the description (the main contents) of the embed.
EmbedData & setColor(const std::string &hexColorValueNew)
Sets the color of the embed, by applying a hex-color value.
std::string timeStamp
Timestamp to be placed on the embed.
EmbedData & setThumbnail(const std::string &thumbnailUrl)
Sets the thumbnail of the embed.
EmbedData & setAuthor(const std::string &authorName, const std::string &authorAvatarUrl="")
Sets the author's name and avatar for the embed.
EmbedData & setTimeStamp(const std::string &timeStamp)
Sets the timeStamp on the embed.
std::vector< EmbedFieldData > fields
Array of embed fields.
EmbedFooterData footer
Embed footer data.
Snowflake guildId
Id of the Guild that the referenced Message was sent in.
Snowflake channelId
Id of the Channel that the referenced Message was sent in.
Snowflake messageId
Id of the Message to reference.
bool failIfNotExists
Fail if the Message doesn't exist?
Data representing a file to be sent via multipart-form data.
TimeStamp archiveTimestamp
(Where applicable) the time at which this Thread was archived.
int32_t autoArchiveDuration
How int64_t before archiving this Thread.
bool archived
Whether or not this Thread is currently archived.
bool invitable
The id of the individual who archived this Thread.
bool locked
Whether or not this Thread is currently locked.
TimeStamp joinTimestamp
The time at which the member joined this Thread.
Snowflake userId
The User's id.
Snowflake userId
The User id this voice state is for.
Snowflake channelId
The Channel id this User is connected to.
Snowflake guildId
The Guild id this voice state is for.
std::string sessionId
The session id for this voice state.
TimeStamp requestToSpeakTimestamp
The time at which the User requested to speak.
bool selfDeaf
Whether this User is locally deafened.
bool mute
Whether this User is muted by the server.
bool deaf
Whether this User is deafened by the server.
bool selfStream
Whether this User is streaming using "Go Live".
bool suppress
Whether this User is muted by the current User.
bool selfMute
Whether this User is locally muted.
bool selfVideo
Whether this User's camera is enabled.
Snowflake guildId
The id of the Guild that this Role is from.
Permissions permissions
The Role's base Guild Permissions.
StringWrapper name
The Role's name.
int16_t position
Its position amongst the rest of the Guild's roles.
ColorValue color
The Role's color.
StringWrapper unicodeEmoji
Emoji representing the Role.
RoleFlags flags
Role flags.
UserData user
User that created this emoji.
bool requireColons
Require colons to render it?
bool animated
Is it animated?
bool available
Is it available to be used?
std::vector< RoleData > roles
Roles that are allowed to use this emoji.
bool managed
Is it managed?
StringWrapper name
What is its name?
PresenceUpdateFlags theStatus
Current client status.
Snowflake guildId
Guild id for the current presence.
Data structure representing a single GuildMember.
GuildMemberFlags flags
GuildMember flags.
std::vector< Snowflake > roles
The Guild roles that they have.
IconHash avatar
This GuildMember's Guild Avatar.
TimeStamp joinedAt
When they joined the Guild.
StringWrapper nick
Their nick/display name.
Permissions permissions
Their base-level Permissions in the Guild.
Snowflake guildId
The current Guild's id.
uint64_t deny
Collection of Permissions to deny.
uint64_t allow
Collection of Permissions to allow.
PermissionOverwritesType type
Role or User type.
Data structure representing a single Channel.
std::vector< OverWriteData > permissionOverwrites
Permission overwrites.
uint16_t position
The position of the Channel, in the Guild's Channel list.
Snowflake ownerId
Id of the Channel's owner.
SortOrderTypes defaultSortOrder
Default sorting order for a forum thread.
Snowflake parentId
Id of the Channel's parent Channel/category.
ChannelFlags flags
Flags combined as a bitmask.
ChannelType type
The type of the Channel.
uint32_t memberCount
Count of members active in the Channel.
Snowflake guildId
Id of the Channel's Guild, if applicable.
StringWrapper name
Name of the Channel.
int64_t durationSeconds
Timeout duration in seconds.
Snowflake channelId
Channel to which user content should be logged.
int32_t mentionTotalLimit
Total number of unique role and user mentions allowed per message (Maximum of 50).
std::vector< std::string > allowList
Substrings which will be exempt from triggering the preset trigger type.
std::vector< std::string > keywordFilter
Substrings which will be searched for in content.keyword_filter array of strings.
std::vector< KeywordPresetType > presets
The internally pre-defined wordsets which will be searched for in content.
ActionType type
The type of action.
ActionMetaData metadata
Additional metadata needed during execution for this specific action type.
std::vector< Snowflake > exemptChannels
The channel ids that should not be affected by the rule(Maximum of 50).
EventType eventType
The rule event type.
TriggerMetaData triggerMetaData
The rule trigger metadata actions array of action objects the.
TriggerType triggerType
The rule trigger type.
std::string name
The rule name.
std::vector< Snowflake > exemptRoles
The role ids that should not be affected by the rule(Maximum of 20).
Snowflake creatorId
The user which first created this rule.
std::vector< ActionData > actions
Actions which will execute when the rule is triggered.
Snowflake guildId
The guild which this rule belongs to.
bool enabled
Whether the rule is enabled.
ApplicationCommandPermissionType type
The type of PermissionTypes.
bool permission
Whether the PermissionTypes is active or not.
Snowflake applicationId
The application's id.
std::vector< ApplicationCommandPermissionData > permissions
The Permissions.
Snowflake guildId
The Guild's id.
bool me
Whether or not I (The bot) placed it.
Snowflake messageId
The id of the Message upon which it was placed.
Snowflake guildId
The id of the Guild where it was placed.
EmojiData emoji
The emoji that was placed as a reaction.
Snowflake channelId
The id of the Channel where it was placed.
GuildMemberData member
The GuildMember who placed the reaction.
Snowflake userId
The id of the User who placed the reaction.
int32_t count
The number of times this particular emoji was placed as a reaction to the given Message.
bool optimal
True for a single server that is closest to the current User's client.
bool custom
Whether this is a custom voice region(used for events / etc).
bool deprecated
Whether this is a deprecated voice region(avoid switching to these).
std::string name
Name of the region.
MessageActivityType type
Message activity type.
std::string partyId
Party id.
std::string reason
Reason for the ban.
UserData user
User that was banned.
int32_t membershipState
Current state.
std::vector< Permissions > permissions
Permissions for the team.
UserData user
User data of the current User.
Snowflake teamId
Id of the current team.
std::vector< TeamMembersObjectData > members
Array of team members object data.
std::string icon
Icon for the team.
Snowflake ownerUserId
User id of the team owner.
std::vector< std::string > scopes
The scopes to add the application to the server with.
Permissions permissions
The permissions to request for the bot role.
std::string coverImage
The cover image.
InstallParamsData params
Settings for the application's default in-app authorization link, if enabled.
UserData owner
Application's owner.
std::vector< std::string > tags
Up to 5 tags describing the content and functionality of the application install_params.
bool botPublic
Is the bot public?
TeamObjectData team
Team object data.
std::string icon
Application's icon.
std::string termsOfServiceUrl
Terms of service Url.
std::string privacyPolicyUrl
Privacy policy Url.
std::string verifyKey
The verification key.
bool botRequireCodeGrant
Does the bot require a code grant?
std::string primarySkuId
Primary SKU Id.
ApplicationFlags flags
Application flags.
std::string name
Application's name.
std::string description
Description of the application.
Snowflake guildId
Guild id.
std::vector< std::string > rpcOrigins
Array of RPC origin strings.
std::string summary
Summary of the application.
std::string expires
When the access token expires.
std::vector< std::string > scopes
Array of strings - the scopes the User has authorized the application for.
AuthorizationInfoData() noexcept=default
The User who has authorized, if the User has authorized with the identify scope.
ApplicationData application
Partial application object the current application.
std::string name
Name of the account.
Snowflake channelId
The widget Channel id.
bool enabled
Whether the widget is enabled.
UserData user
User data for the integration.
int32_t subscriberCount
Number of current subscribers.
bool syncing
Is it syncing?
TimeStamp syncedAt
Time it was last synced at.
int32_t expireBehavior
What to do upon expiry.
AccountData account
Account data.
ApplicationData application
Application data.
std::string type
Type of integration.
int32_t expireGracePeriod
How int64_t before the integration expires.
bool enableEmoticons
Emoticons enabled?
std::string name
Name of the integration.
bool revoked
Has it been revoked?
std::string membersRemoved
Number of members that were removed upon a prune.
Snowflake channelId
Channel Id.
std::string roleName
Role name.
std::string deleteMemberDays
Number of days for which the member's Messages were deleted.
Snowflake messageId
Message Id.
std::string key
The key of the audit log change.
JsonStringValue newValue
New value.
JsonStringValue oldValue
Old value.
OptionalAuditEntryInfoData options
Audit log entry info data.
Snowflake targetId
Id of the target User.
TimeStamp createdTimeStamp
Time at which this entry was created.
Snowflake userId
Id of the executing User.
AuditLogEvent actionType
Audit log action type.
std::string reason
The reason that was entered for the given change.
std::vector< AuditLogChangeData > changes
Array of audit log change data.
std::string description
Description of the welcome Channel.
Snowflake emojiId
Emoji id for the Channel.
Snowflake channelId
Id of the welcome Channel.
std::string emojiName
Emoji name for the Channel.
std::vector< WelcomeScreenChannelData > welcomeChannels
Welcome screen Channel data.
std::string description
Description of the welcome screen.
Snowflake guildId
The Guild id for which the Channel exists in.
bool discoverableDisabled
Is it discoverable?
std::string topic
The topic of the StageInstance.
StageInstancePrivacyLevel privacyLevel
Privacy level of the Channel.
Snowflake channelId
The Channel's id.
int32_t sortValue
Where in the stack of stickers it resides.
UserData user
The User that uploaded the Guild Sticker.
std::string packId
Pack id of the Sticker.
StickerType type
The type of Sticker.
std::string asset
Asset value for the Sticker.
StickerFormatType formatType
Format type.
Snowflake guildId
The Guild id for which the Sticker exists in.
std::string name
The Sticker's name.
std::string description
Description of the Sticker.
StickerFlags flags
Sticker flags.
Data structure representing a single Guild.
std::vector< Snowflake > stickers
Array of Guild channels.
StringWrapper name
The Guild's name.
std::vector< Snowflake > members
Array of GuildMembers.
std::vector< Snowflake > emoji
Array of Guild channels.
std::vector< PresenceUpdateData > presences
Presence states for each of the GuildMembers..
TimeStamp joinedAt
When the bot joined this Guild.
std::vector< Snowflake > guildScheduledEvents
Array of Guild channels.
IconHash icon
Url to the Guild's icon.
DiscordCoreClient * discordCoreClient
A pointer to the DiscordCoreClient.
std::vector< Snowflake > threads
Array of Guild channels.
uint32_t memberCount
Member count.
VoiceConnection * connectToVoice(const Snowflake guildMemberId, const Snowflake channelId=Snowflake{}, bool selfDeaf=false, bool selfMute=false, StreamInfo streamInfo=StreamInfo{})
For connecting to an individual voice channel.
Snowflake ownerId
User id of the Guild's owner.
std::vector< Snowflake > stageInstances
Array of Guild channels.
std::vector< Snowflake > channels
Array of Guild channels.
VoiceConnection * voiceConnectionPtr
A pointer to the VoiceConnection, if present.
GuildFlags flags
Guild flags.
std::vector< Snowflake > roles
Array of Guild roles.
Snowflake guildId
The Guild id which the scheduled event belongs to.
Snowflake channelId
The Channel id in which the scheduled event will be hosted, or null if scheduled entity type is Exter...
Snowflake creatorId
The id of the User that created the scheduled event *.
std::string description
The description of the scheduled event(1 - 1000 characters.
std::string scheduledEndTime
The time the scheduled event will end, required if entity_type is External.
Snowflake entityId
The id of an entity associated with a Guild scheduled event.
uint32_t userCount
The number of users subscribed to the scheduled event.
GuildScheduledEventPrivacyLevel privacyLevel
The privacy level of the scheduled event.
GuildScheduledEventEntityType entityType
The type of the scheduled event.
UserData creator
The User that created the scheduled event.
GuildScheduledEventStatus status
The status of the scheduled event.
std::string scheduledStartTime
The time the scheduled event will start.
std::string name
The name of the scheduled event(1 - 100 characters).
GuildScheduledEventMetadata entityMetadata
Additional metadata for the Guild scheduled event.
Snowflake guildScheduledEventId
The scheduled event id which the User subscribed to/.
UserData user
User which subscribed to an event.
GuildMemberData member
Guild member data for this User for the Guild which this event belongs to, if any.
GuildScheduledEventData guildScheduledEvent
Scheduled Guild event.
int32_t maxUses
Max number of uses.
int32_t maxAge
Maximum age of the invite.
StageInstanceData stageInstance
Stage instance data.
int32_t approximatePresenceCount
Approximate presence count.
ApplicationData targetApplication
Application data.
UserData inviter
The User who created the invite.
int32_t approximateMemberCount
Approximate member count.
GuildData guild
Guild data of the Channel that the invite is for.
bool temporary
Is it temporary?
int32_t targetType
Target type.
TimeStamp expiresAt
When the invite expires.
Snowflake guildId
The Guild this invite is for.
UserData targetUser
Target User of the invite.
TimeStamp createdAt
Time it was created at.
std::string code
Unique invite code.
ChannelData channel
Channel data of the Channel that the invite is for.
int32_t uses
The current number of uses.
UserData creator
The User who created the template.
std::string description
The description for the template.
std::string code
The template code(unique ID).
std::string updatedAt
When this template was last synced to the source Guild.
GuildData serializedSourceGuild
The Guild snapshot this template contains.
std::string name
Template name.
uint32_t usageCount
Number of times this template has been used.
std::string createdAt
When this template was created.
std::string creatorId
The ID of the User who created the template.
bool isDirty
Whether the template has unsynced changes.
std::string sourceGuildId
The ID of the Guild this template is based on.
std::string name
Name of the WebHook.
WebHookType type
Type of WebHook.
GuildData sourceGuild
Source Guild id.
std::string url
Url of the WebHook.
Snowflake channelId
Channel id for which the WebHook was issued.
Snowflake applicationId
Application id.
std::string avatar
Avatar of the WebHook.
std::string token
Token of the WebHook.
Snowflake guildId
Guild id for which the WebHook was issued.
UserData user
User which create the WebHook.
ChannelData sourceChannel
Channel for which th WebHook was issued.
std::vector< IntegrationData > integrations
Array of partial integration objects.
std::vector< UserData > users
Array of user objects.
std::vector< AuditLogEntryData > auditLogEntries
Array of audit log entry objects.
std::vector< GuildScheduledEventData > guildScheduledEvents
Array of guild scheduled event objects.
std::vector< ChannelData > threads
Array of thread-specific channel objects.
std::vector< WebHookData > webhooks
Array of webhook objects.
std::vector< AutoModerationRuleData > autoModerationRules
List of auto moderation rules referenced in the audit log.
Data structure representing an ApplicationCommand's option choice.
JsonType type
The type of the option.
std::unordered_map< std::string, std::string > nameLocalizations
Dictionary with keys in available locales Localization dictionary for the name field.
std::string name
The name of the current choice.
std::string value
The value of the option.
std::string name
Name of the current ApplicationCommand option.
std::unordered_map< std::string, std::string > nameLocalizations
Dictionary for the name localizations field.
int32_t maxValue
If the option is an INTEGER or NUMBER type, the maximum value permitted.
std::string description
A description of the current ApplicationCommand option.
bool autocomplete
If autocomplete interactions are enabled for this STRING, INTEGER, or NUMBER type option.
std::vector< ChannelType > channelTypes
Set when the ApplicationCommand option type is set to Channel.
int32_t minValue
If the option is an INTEGER or NUMBER type, the minimum value permitted.
bool required
If the parameter is required or optional– default false.
ApplicationCommandOptionType type
The type of command option.
std::vector< ApplicationCommandOptionData > options
A vector of possible options for the current ApplicationCommand option.
std::vector< ApplicationCommandOptionChoiceData > choices
A vector of possible choices for the current ApplicationCommand option.
std::unordered_map< std::string, std::string > descriptionLocalizations
Dictionary for the description localizations field.
Snowflake targetId
The target User's id.
Snowflake targetId
The target Message's id.
ComponentType componentType
The type of component.
std::string customId
The custom id of the Interaction entity.
std::vector< std::string > values
The values of the components.
std::string customId
The custom id of the Interaction entity.
std::string customIdSmall
The custom id of a particular modal input.
std::string value
The input value of the modal.
Allowable mentions for a Message.
std::vector< std::string > users
Array of user_ids to mention (Max size of 100)
bool repliedUser
For replies, whether to mention the author of the Message being replied to (default false).
std::vector< std::string > parse
A vector of allowed mention types to parse from the content.
std::vector< std::string > roles
Array of role_ids to mention (Max size of 100)
std::string description
Description of the select-menu-option.
std::string value
A value for identifying the option.
EmojiData emoji
An optional emoji to put on it.
bool _default
Is it the default option?
std::string label
A visible label for the select-menu-option.
Represents a single Message-component.
int32_t style
One of ButtonStyle, or TextInputStyle.
bool required
Whether this component is required to be filled.
std::string label
The label for this component.
EmojiData emoji
Emoji name, id, and animated.
int32_t minLength
The minimum input length for a text input.
ComponentType type
Integer component type.
std::string title
Url, for url types.
bool disabled
Whether the component is disabled, default false.
int32_t maxLength
The maximum input length for a text input.
std::string placeholder
Custom placeholder text if nothing is selected, max 100 characters.
std::string url
Url, for url types.
std::string value
A pre-filled value for this component.
std::vector< ChannelType > channelTypes
Array of channel types List of channel types to include in the channel select component (type 8).
int32_t maxValues
The maximum number of items that can be chosen; default 1, max 25.
std::vector< SelectOptionData > options
Aray of select options the choices in the select, max 25.
int32_t minValues
The minimum number of items that must be chosen; default 1, min 0, max 25.
std::string customId
A developer-defined identifier for the component, max 100 characters.
Action row data of Message components.
std::vector< ComponentData > components
Array of components to make up the action-row.
std::string content
Message content.
std::string customId
A developer-defined identifier for the component, max 100 characters.
std::vector< ApplicationCommandOptionChoiceData > choices
Autocomplete choices(max of 25 choices).
std::vector< EmbedData > embeds
Message embeds.
std::vector< ActionRowData > components
Message components.
std::vector< File > files
Files for uploading.
AllowedMentionsData allowedMentions
Allowed mentions data.
std::string title
The title of the popup modal.
ApplicationCommandType type
The type of ApplicationCommand.
bool dmPermission
Indicates whether the command is available in DMs with the app, only for globally - scoped commands.
std::string description
A description of the current ApplicationCommand.
std::string version
An autoincremented version.
std::string name
Name of the current ApplicationCommand.
std::unordered_map< std::string, std::string > nameLocalizations
Dictionary with keys in available locales.
Snowflake applicationId
The current application id.
std::vector< ApplicationCommandOptionData > options
A vector of possible options for the current ApplicationCommand.
Permissions defaultMemberPermissions
Set of permissions represented as a bit set all.
std::unordered_map< std::string, std::string > descriptionLocalizations
Dictionary with keys in available locales.
std::string name
The name of the Channel that was mentioned.
Snowflake guildId
The id of the Guild where it took place.
ChannelType type
The type of Channel that was mentioned.
TimeStamp lastPinTimeStamp
The time of the last pinned Message.
Snowflake guildId
The id of the Guild within which the Message was pinned.
Snowflake channelId
The id of the Channel within which the Message was pinned.
Snowflake guildId
The id of the Guild for which the threads are being synced.
std::vector< ChannelData > threads
All active threads in the given channels that the current User can access.
std::vector< ThreadMemberData > members
Array of members that are a part of the Thread.
std::vector< std::string > channelIds
The parent Channel ids whose threads are being synced.
std::vector< ThreadMemberData > addedMembers
New members added to the Thread.
uint32_t memberCount
Number of Guild-members in the Thread.
Snowflake guildId
Guild id of the Thread.
std::vector< std::string > removedMemberIds
Members who have been removed.
std::string name
The name of the Sticker.
StickerItemType formatType
Message Sticker item type.
TimeStamp editedTimestamp
The time at which it was edited.
std::vector< std::string > mentionRoles
std::vector of "mention roles" ids.
std::vector< UserData > mentions
Array of User data, for individual's that were mentioned.
MessageType type
Message type.
bool mentionEveryone
Does the Message mention everyone?
Snowflake webHookId
WebHook id of the Message, if applicable.
MessageInteractionData interaction
Message Interaction data.
MessageReferenceData messageReference
Message reference data.
ChannelData thread
The Thread that the Message was sent in, if applicable.
TimeStamp timeStamp
The timeStamp of when the Message was created.
GuildMemberData member
The author's Guild member data.
std::string content
The Message's content.
Snowflake channelId
The Channel it was sent in.
Snowflake guildId
The id of the Guild the Message was sent in.
std::vector< StickerItemData > stickerItems
Array of Message Sticker item data.
std::vector< ChannelMentionData > mentionChannels
array of Channel mention data.
UserData author
The author's User data.
std::vector< ActionRowData > components
Array of action row data.
std::vector< AttachmentData > attachments
Array of attachment data.
std::vector< EmbedData > embeds
Array of Message embeds.
std::vector< StickerData > stickers
Array of Message Sticker data.
Snowflake applicationId
Application id.
bool tts
Is it a text-to-speech Message?
ApplicationData application
Application data.
MessageActivityData activity
Message activity data.
Data structure representing a single Message.
std::unique_ptr< MessageDataOld > referencedMessage
The referenced Message, to reply to.
std::unordered_map< uint64_t, UserData > users
std::map full of UserData.
std::unordered_map< uint64_t, MessageData > messages
std::map full of messageData->
std::unordered_map< uint64_t, AttachmentData > attachments
std::map of Snowflakes to attachment objects the ids and attachment objects.
std::unordered_map< uint64_t, RoleData > roles
std::map full of RoleData.
std::unordered_map< uint64_t, ChannelData > channels
std::map full of ChannelData.
std::unordered_map< uint64_t, GuildMemberData > members
std::map full of GuildMemeberData.
std::string coverStickerId
Id of a Sticker in the pack which is shown as the pack's icon.
std::string name
Name of the Sticker pack.
std::string skuId
Id of the pack's SKU.
Snowflake Id
Id of the Sticker pack.
std::string description
Description of the Sticker pack.
std::vector< StickerData > stickers
Array of Sticker objects the stickers in the pack.
std::string bannerAssetId
Id of the Sticker pack's banner image.
std::vector< IntegrationData > integrations
An array of partial server integrations.
bool friendSync
Whether friend sync is enabled for this connection.
std::string name
The userName of the connection account.
std::string type
The service of the connection(twitch, youtube).
bool verified
Whether the connection is verified.
ConnectionVisibilityTypes visibility
Visibility of this connection.
bool revoked
Whether the connection is revoked.
bool showActivity
Whether activities related to this connection will be shown in presence updates.
std::vector< ApplicationCommandInteractionDataOption > options
ApplicationCommand Interaction data options.
ApplicationCommandOptionType type
The type of ApplicationCommand options.
std::string name
The name of the current option.
bool focused
True if this option is the currently focused option for autocomplete.
JsonStringValue value
The value if it's an int32_t.
Snowflake guildId
The guild that the command took place in.
std::vector< ApplicationCommandInteractionDataOption > options
ApplicationCommand Interaction data options.
std::string name
The name of the command.
ApplicationCommandType type
The type of ApplicationCommand.
ResolvedData resolved
Resolved data.
ApplicationCommandInteractionData applicationCommandData
ApplicationCommand Interaction data.
MessageCommandInteractionData messageInteractionData
Message command Interaction data.
UserCommandInteractionData userInteractionData
User command Interaction data.
ComponentInteractionData componentData
Component Interaction data.
ModalInteractionData modalData
Modal Interaction data.
Snowflake guildId
The Guild id of the Guild it was sent in.
InteractionDataData data
The Interaction's data.
MessageData message
The Message that the Interaction came through on, if applicable.
Snowflake applicationId
The application's id.
std::string guildLocale
The guild's preferred locale, if invoked in a guild.
std::string token
The Interaction token.
UserData user
The User data of the sender of the Interaction.
InteractionType type
The type of Interaction.
int32_t version
The Interaction version.
std::string locale
The selected language of the invoking user.
GuildMemberData member
The data of the Guild member who sent the Interaction, if applicable.
Snowflake channelId
The Channel the Interaction was sent in.
Permissions appPermissions
Bitwise set of permissions the app or bot has within the channel the interaction was sent from.
uint32_t maxConcurrency
The number of identify requests allowed per 5 seconds.
uint32_t total
The total number of session starts the current User is allowed.
uint32_t resetAfter
The number of Milliseconds after which the limit resets.
uint32_t remaining
The remaining number of session starts the current User is allowed.
uint32_t shards
The recommended number of shards to use when connecting.
SessionStartData sessionStartLimit
Information on the current session start limit.
std::string url
The WSS Url that can be used for connecting to the gateway.
Data representing an input-event, which is any Message or Interaction that is coming into the bot as ...
GuildData getGuildData() const
Returns the Guild of this input-event.
MessageData getMessageData() const
Returns the Message data, if applicable, of this input-event.
UserData getUserData() const
Returns the User of this input-event.
ChannelData getChannelData() const
Returns the Channel of this input-event.
GuildMemberData getGuildMemberData() const
Returns the GuildMember of this input-event.
InteractionData getInteractionData() const
Returns the Interaction data, if appplicable, of this input-event.
Data for responding to an input-event.
RespondToInputEventData & addFile(File theFile)
Adds a file to the current collection of files for this message response.
RespondToInputEventData & setResponseType(InputEventResponseType typeNew)
For setting the type of response to make.
RespondToInputEventData & addSelectMenu(bool disabled, const std::string &customIdNew, std::vector< SelectOptionData > options, const std::string &placeholder, int32_t maxValues, int32_t minValues, SelectMenuType type, std::vector< ChannelType > channelTypes=std::vector< ChannelType >{})
Adds a select-menu to the response Message.
InputEventResponseType type
The type of response to make.
RespondToInputEventData & setTTSStatus(bool enabledTTs)
For setting the tts status of a response.
RespondToInputEventData & addContent(const std::string &dataPackage)
For setting the Message content in a response.
RespondToInputEventData & setTargetUserID(const Snowflake targetUserIdNew)
For setting the direct-Message User target of a response.
RespondToInputEventData & addAllowedMentions(AllowedMentionsData dataPackage)
For setting the allowable mentions in a response.
RespondToInputEventData & addComponentRow(ActionRowData dataPackage)
For setting the components in a response.
RespondToInputEventData & addModal(const std::string &topTitleNew, const std::string &topCustomIdNew, const std::string &titleNew, const std::string &customIdNew, bool required, int32_t minLength, int32_t maxLength, TextInputStyle inputStyle, const std::string &label="", const std::string &placeholder="")
Adds a modal to the response Message.
RespondToInputEventData & addMessageEmbed(EmbedData dataPackage)
For setting the embeds in a response.
RespondToInputEventData & addButton(bool disabled, const std::string &customIdNew, const std::string &buttonLabel, ButtonStyle buttonStyle, const std::string &emojiName="", Snowflake emojiId=Snowflake{}, const std::string &url="")
Adds a button to the response Message.
RespondToInputEventData & setAutoCompleteChoice(Serializer value, const std::string &theName, std::unordered_map< std::string, std::string > theNameLocalizations)
For setting the choices of an autocomplete response.
Message response base, for responding to messages.
MessageResponseBase & addContent(const std::string &dataPackage)
For setting the Message content in a response.
MessageResponseBase & addModal(const std::string &topTitleNew, const std::string &topCustomIdNew, const std::string &titleNew, const std::string &customIdNew, bool required, int32_t minLength, int32_t maxLength, TextInputStyle inputStyle, const std::string &label="", const std::string &placeholder="")
Adds a modal to the response Message.
MessageResponseBase & addMessageEmbed(EmbedData dataPackage)
For setting the embeds in a response.
MessageResponseBase & addFile(File theFile)
Adds a file to the current collection of files for this message response.
MessageResponseBase & setTTSStatus(bool enabledTTs)
For setting the tts status of a response.
MessageResponseBase & addAllowedMentions(AllowedMentionsData dataPackage)
For setting the allowable mentions in a response.
MessageResponseBase & addComponentRow(ActionRowData dataPackage)
For setting the components in a response.
MessageResponseBase & addButton(bool disabled, const std::string &customIdNew, const std::string &buttonLabel, ButtonStyle buttonStyle, const std::string &emojiName="", Snowflake emojiId=Snowflake{}, const std::string &url="")
Adds a button to the response Message.
MessageResponseBase & addSelectMenu(bool disabled, const std::string &customIdNew, std::vector< SelectOptionData > options, const std::string &placeholder, int32_t maxValues, int32_t minValues, SelectMenuType type, std::vector< ChannelType > channelTypes=std::vector< ChannelType >{})
Adds a select-menu to the response Message.
Interaction response data.
InteractionCallbackData data
Interaction ApplicationCommand callback data.
std::string thumbnailUrl
The Url of the thumbnail image of this Song.
std::string duration
The duration of the Song.
std::string viewUrl
The url for listening to this Song through a browser.
std::string description
A description of the Song.
std::string songTitle
The title of the Song.
Command data, for functions executed by the CommandController.
MessageData getMessageData() noexcept
Returns the Message data, if applicable, of this input-event.
std::string getCommandName() noexcept
Returns the name of this entered command.
GuildData getGuildData() noexcept
Returns the Guild of this input-event.
GuildMemberData getGuildMemberData() noexcept
Returns the GuildMember of this input-event.
InputEventData getInputEventData() noexcept
Returns the InputEventData for this command.
InteractionData getInteractionData() noexcept
Returns the Interaction data, if appplicable, of this input-event.
std::string getSubCommandName() noexcept
Returns the subcommand-name of this entered command.
ChannelData getChannelData() noexcept
Returns the Channel of this input-event.
UserData getUserData() noexcept
Returns the User of this input-event.
JsonifierValue getCommandArguments() noexcept
Returns the collection of command inputs/options for this command.
std::string getSubCommandGroupName() noexcept
Returns the subcommand-name of this entered command group.
static GuildData getCachedGuild(GetGuildData dataPackage)
Collects a Guild from the library's cache.
static GuildMemberData getCachedGuildMember(GetGuildMemberData dataPackage)
Collects a GuildMember from the library's cache.
static CoRoutine< void > deleteInputEventResponseAsync(InputEventData &dataPackage, int32_t timeDelayNew=0)
Deletes a previously sent "input-event-response".
static CoRoutine< InputEventData > respondToInputEventAsync(RespondToInputEventData dataPackage)
Responds to one of a number of types of "InputEvents".
void updateVoiceStatus(UpdateVoiceStateData &datdataPackageaPackage)
Updates the bot's current voice-status. Joins/leaves a Channel, and/or self deafens/mutes.
static UserData getCachedUser(GetUserData dataPackage)
Collects a given User from the library's cache.
For connecting two bots to stream the VC contents between the two.
AudioFrameType type
The type of audio frame.
std::basic_string< std::byte > data
The audio data.
int64_t currentSize
The current size of the allocated memory.
uint64_t guildMemberId
GuildMemberId for the sending GuildMember.
For connecting to a voice-channel. "streamInfo" is used when a socket is created to connect this bot ...
int32_t currentShard
The current websocket shard, if applicable.
Class for representing a timeStamp, as well as working with time-related values.
VoiceConnection class - represents the connection to a given voice Channel.