47 namespace discord_core_internal {
49 websocket_resume_data::operator discord_core_internal::etf_serializer() {
50 etf_serializer data{};
51 data[
"seq"] = lastNumberReceived;
52 data[
"session_id"] = sessionId;
53 data[
"token"] = botToken;
57 websocket_identify_data::operator discord_core_internal::etf_serializer() {
58 etf_serializer serializer{};
59 serializer[
"intents"] = intents;
60 serializer[
"large_threshold"] = 250;
61 serializer[
"presence"] = presence.operator discord_core_internal::etf_serializer();
62 serializer[
"properties"][
"browser"] =
"DiscordCoreAPI";
63 serializer[
"properties"][
"device"] =
"DiscordCoreAPI";
64 serializer[
"properties"][
"os"] = properties.os;
65 serializer[
"shard"].emplaceBack(shard.at(0));
66 serializer[
"shard"].emplaceBack(shard.at(1));
67 serializer[
"token"] = botToken;
71 https_workload_data& https_workload_data::operator=(https_workload_data&& other)
noexcept {
73 headersToInsert = std::move(other.headersToInsert);
74 relativePath = std::move(other.relativePath);
75 callStack = std::move(other.callStack);
76 baseUrl = std::move(other.baseUrl);
77 content = std::move(other.content);
78 workloadClass = other.workloadClass;
79 workloadType = other.workloadType;
80 payloadType = other.payloadType;
85 https_workload_data::https_workload_data(https_workload_data&& other)
noexcept {
86 *
this = std::move(other);
89 https_workload_data& https_workload_data::operator=(https_workload_type type) {
94 https_workload_type https_workload_data::getWorkloadType()
const {
98 https_workload_data::https_workload_data(https_workload_type type) {
103 update_presence_data::operator discord_core_internal::etf_serializer() {
104 discord_core_internal::etf_serializer data{};
105 for (
auto& value: activities) {
106 discord_core_internal::etf_serializer newData{};
107 if (value.url !=
"") {
108 newData[
"url"] = value.url;
110 if (value.state !=
"") {
111 newData[
"state"] = value.state;
113 newData[
"name"] = value.name;
114 newData[
"type"] = value.type;
115 data[
"activities"].emplaceBack(newData);
117 data[
"status"] = statusReal;
118 data[
"since"] = since;
123 update_voice_state_data::operator discord_core_internal::etf_serializer() {
124 discord_core_internal::etf_serializer data{};
125 if (channelId == 0) {
126 data[
"channel_id"] = discord_core_internal::json_type::null_t;
128 data[
"channel_id"] = channelId.operator jsonifier::string();
130 data[
"self_deaf"] = selfDeaf;
131 data[
"self_mute"] = selfMute;
132 data[
"guild_id"] = guildId.operator jsonifier::string();
136 update_voice_state_data_dc::operator discord_core_internal::etf_serializer() {
137 discord_core_internal::etf_serializer data{};
138 data[
"channel_id"] = discord_core_internal::json_type::null_t;
139 data[
"self_deaf"] = selfDeaf;
140 data[
"self_mute"] = selfMute;
141 data[
"guild_id"] = guildId.operator jsonifier::string();
169 bool guild_cache_data::areWeConnected() {
170 return getDiscordCoreClient()->getVoiceConnection(
id).areWeConnected();
174 update_voice_state_data data{};
176 data.selfDeaf =
false;
177 data.selfMute =
false;
179 discord_core_client::getSongAPI(
id).disconnect();
181 discord_core_client::getVoiceConnection(
id).disconnect();
184 bool guild_data::areWeConnected() {
185 return getDiscordCoreClient()->getVoiceConnection(
id).areWeConnected();
189 discord_core_internal::websocket_message_data<update_voice_state_data> data{};
190 data.jsonifierExcludedKeys.emplace(
"t");
191 data.jsonifierExcludedKeys.emplace(
"s");
192 data.d.channelId = 0;
193 data.d.selfDeaf =
false;
194 data.d.selfMute =
false;
196 discord_core_client::getSongAPI(
id).disconnect();
198 discord_core_client::getVoiceConnection(
id).disconnect();
238 for (uint64_t x = 0; x < rhs.
choices.size(); ++x) {
248 author.iconUrl = authorAvatarUrl;
254 footer.iconUrl = footerIconUrlText;
259 timeStamp =
static_cast<jsonifier::string
>(timeStampNew);
264 embed_field_data field{};
265 field.Inline = Inline;
268 fields.emplace_back(field);
278 hexColorValue = jsonifier::strToUint64<16>(
static_cast<jsonifier::string
>(hexColorValueNew));
293 image.url = imageUrl;
297 void embed_image_data::generateExcludedKeys() {
309 void embed_author_data::generateExcludedKeys() {
324 void embed_data::generateExcludedKeys() {
346 author.generateExcludedKeys();
370 if (value.id == userIdOfChanger && value.actionType == auditLogType) {
374 return audit_log_entry_data();
379 if (value.targetId == userIdOfTarget && value.actionType == auditLogType) {
383 return audit_log_entry_data();
386 void partial_emoji_data::generateExcludedKeys() {
395 void emoji_data::generateExcludedKeys() {
405 if (
roles.size() == 0) {
417 if (
name != rhs.name) {
420 if (
type != rhs.type) {
423 if (
options.size() != rhs.options.size()) {
426 for (uint64_t x = 0; x <
options.size(); ++x) {
427 if (
options.at(x) != rhs.options.at(x)) {
435 if (
name != rhs.name) {
441 if (
value != rhs.value) {
448 if (
this != &other) {
449 interactionData = std::move(other.interactionData);
450 interactionData->member.guildId = interactionData->guildId;
451 responseType = other.responseType;
457 *
this = std::move(other);
461 if (
this != &other) {
463 interactionData->member.guildId = interactionData->guildId;
475 interactionData->member.guildId = interactionData->guildId;
479 input_event_data::input_event_data(
const interaction_data& interactionData) {
480 *
this = interactionData;
484 if (interactionData->member.user.id != 0) {
485 return interactionData->member.user;
487 return interactionData->user;
492 return interactionData->channel;
496 return interactionData->member;
499 void interaction_callback_data::generateExcludedKeys() {
504 for (
auto& value02: value.components) {
505 value02.generateExcludedKeys();
508 for (
auto& value:
embeds) {
509 value.generateExcludedKeys();
526 if (
files.size() == 0) {
534 void action_row_data::generateExcludedKeys() {
536 jsonifierExcludedKeys.emplace(
"components");
539 value.generateExcludedKeys();
544 void component_data::generateExcludedKeys() {
547 if (customId ==
"") {
548 jsonifierExcludedKeys.emplace(
"custom_id");
550 if (emoji.name ==
"") {
551 jsonifierExcludedKeys.emplace(
"emoji");
553 emoji.generateExcludedKeys();
556 jsonifierExcludedKeys.emplace(
"label");
558 if (placeholder ==
"") {
559 jsonifierExcludedKeys.emplace(
"placeholder");
562 jsonifierExcludedKeys.emplace(
"url");
564 jsonifierExcludedKeys.emplace(
"options");
565 jsonifierExcludedKeys.emplace(
"channel_types");
566 jsonifierExcludedKeys.emplace(
"placeholder");
567 jsonifierExcludedKeys.emplace(
"min_values");
568 jsonifierExcludedKeys.emplace(
"max_values");
569 jsonifierExcludedKeys.emplace(
"min_length");
570 jsonifierExcludedKeys.emplace(
"max_length");
571 jsonifierExcludedKeys.emplace(
"required");
572 jsonifierExcludedKeys.emplace(
"value");
573 jsonifierExcludedKeys.emplace(
"title");
577 if (customId ==
"") {
578 jsonifierExcludedKeys.emplace(
"custom_id");
581 jsonifierExcludedKeys.emplace(
"label");
583 if (maxLength == 0) {
584 jsonifierExcludedKeys.emplace(
"max_length");
586 if (minLength == 0) {
587 jsonifierExcludedKeys.emplace(
"min_length");
589 if (placeholder ==
"") {
590 jsonifierExcludedKeys.emplace(
"placeholder");
593 jsonifierExcludedKeys.emplace(
"title");
596 jsonifierExcludedKeys.emplace(
"value");
598 jsonifierExcludedKeys.emplace(
"style");
599 jsonifierExcludedKeys.emplace(
"label");
600 jsonifierExcludedKeys.emplace(
"emoji");
601 jsonifierExcludedKeys.emplace(
"url");
602 jsonifierExcludedKeys.emplace(
"min_length");
603 jsonifierExcludedKeys.emplace(
"max_length");
604 jsonifierExcludedKeys.emplace(
"required");
605 jsonifierExcludedKeys.emplace(
"title");
621 if (customId ==
"") {
622 jsonifierExcludedKeys.emplace(
"custom_id");
624 if (channelTypes.size() == 0) {
625 jsonifierExcludedKeys.emplace(
"channel_types");
628 jsonifierExcludedKeys.emplace(
"label");
630 if (maxValues == 0) {
631 jsonifierExcludedKeys.emplace(
"max_values");
633 if (minValues == 0) {
634 jsonifierExcludedKeys.emplace(
"min_values");
636 if (options.size() == 0) {
637 jsonifierExcludedKeys.emplace(
"options");
639 if (placeholder ==
"") {
640 jsonifierExcludedKeys.emplace(
"placeholder");
642 jsonifierExcludedKeys.emplace(
"style");
643 jsonifierExcludedKeys.emplace(
"label");
644 jsonifierExcludedKeys.emplace(
"emoji");
645 jsonifierExcludedKeys.emplace(
"url");
646 jsonifierExcludedKeys.emplace(
"min_length");
647 jsonifierExcludedKeys.emplace(
"max_length");
648 jsonifierExcludedKeys.emplace(
"required");
649 jsonifierExcludedKeys.emplace(
"value");
650 jsonifierExcludedKeys.emplace(
"title");
651 jsonifierExcludedKeys.emplace(
"placeholer");
657 void application_command_option_data::generateExcludedKeys() {
659 value.generateExcludedKeys();
662 value.generateExcludedKeys();
664 if (
maxValue == std::numeric_limits<int64_t>::min()) {
665 jsonifierExcludedKeys.emplace(
"max_value");
667 if (
minValue == std::numeric_limits<int64_t>::max()) {
668 jsonifierExcludedKeys.emplace(
"min_value");
671 jsonifierExcludedKeys.emplace(
"name_localizations");
674 jsonifierExcludedKeys.emplace(
"choices");
677 jsonifierExcludedKeys.emplace(
"options");
680 jsonifierExcludedKeys.emplace(
"autocomplete");
683 jsonifierExcludedKeys.emplace(
"description_localizations");
686 jsonifierExcludedKeys.emplace(
"channel_types");
690 void application_command_option_choice_data::generateExcludedKeys() {
692 jsonifierExcludedKeys.emplace(
"name_localizations");
696 void application_command_data::generateExcludedKeys() {
713 value.generateExcludedKeys();
721 return *interactionData;
725 return interactionData->message;
731 returnData.components = components;
732 returnData.customId = customId;
733 returnData.choices = choices;
734 returnData.content = content;
735 returnData.embeds = embeds;
736 returnData.files = files;
737 returnData.flags = flags;
738 returnData.title = title;
739 returnData.tts = tts;
744 applicationId = dataPackage.applicationId;
745 messageId = dataPackage.message.
id;
746 channelId = dataPackage.channelId;
747 interactionToken = dataPackage.token;
748 eventType = dataPackage.type;
749 interactionId = dataPackage.id;
753 respond_to_input_event_data::respond_to_input_event_data(
const interaction_data dataPackage) {
758 applicationId = dataPackage.getInteractionData().applicationId;
759 interactionToken = dataPackage.getInteractionData().token;
760 channelId = dataPackage.interactionData->channelId;
761 interactionId = dataPackage.getInteractionData().
id;
762 messageId = dataPackage.getMessageData().id;
763 type = dataPackage.responseType;
767 respond_to_input_event_data::respond_to_input_event_data(
const input_event_data dataPackage) {
772 button_style buttonStyle,
const jsonifier::string& emojiName,
snowflake emojiId,
const jsonifier::string& url) {
773 if (components.size() == 0) {
774 action_row_data actionRowData;
775 components.emplace_back(actionRowData);
777 if (components.size() < 5) {
778 if (components[components.size() - 1].components.size() < 5) {
779 component_data component;
781 component.emoji.
name = emojiName;
782 component.label = buttonLabel;
783 component.style =
static_cast<uint64_t
>(buttonStyle);
784 component.customId = customIdNew;
785 component.disabled = disabled;
786 component.emoji.
id = emojiId;
788 components[components.size() - 1].components.emplace_back(component);
789 }
else if (components[components.size() - 1].components.size() == 5) {
790 action_row_data actionRowData;
791 components.emplace_back(actionRowData);
798 const jsonifier::string& placeholder, uint64_t maxValues, uint64_t minValues, select_menu_type typeNew, jsonifier::vector<channel_type> channelTypes) {
799 if (components.size() == 0) {
800 action_row_data actionRowData;
801 components.emplace_back(actionRowData);
803 if (components.size() < 5) {
804 if (components[components.size() - 1].components.size() < 5) {
805 component_data componentData;
807 componentData.channelTypes = channelTypes;
808 componentData.placeholder = placeholder;
809 componentData.customId = customIdNew;
810 componentData.maxValues = maxValues;
811 componentData.minValues = minValues;
812 componentData.disabled = disabled;
813 componentData.options = options;
814 components[components.size() - 1].components.emplace_back(componentData);
815 }
else if (components[components.size() - 1].components.size() == 5) {
816 action_row_data actionRowData;
817 components.emplace_back(actionRowData);
824 const jsonifier::string& customIdNew,
bool required, uint64_t minLength, uint64_t maxLength,
text_input_style inputStyle,
const jsonifier::string& label,
825 const jsonifier::string& placeholder) {
827 customId = topCustomIdNew;
828 if (components.size() == 0) {
829 action_row_data actionRowData;
830 components.emplace_back(actionRowData);
832 if (components.size() < 5) {
833 if (components[components.size() - 1].components.size() < 5) {
834 component_data component{};
836 component.customId = customIdNew;
837 component.style =
static_cast<uint64_t
>(inputStyle);
838 component.title = titleNew;
839 component.maxLength = maxLength;
840 component.minLength = minLength;
841 component.label = label;
842 component.required = required;
843 component.placeholder = placeholder;
844 components[components.size() - 1].components.emplace_back(component);
845 }
else if (components[components.size() - 1].components.size() == 5) {
846 action_row_data actionRowData;
847 components.emplace_back(actionRowData);
854 files.emplace_back(theFile);
859 allowedMentions = dataPackage;
869 components.emplace_back(dataPackage);
874 embeds.emplace_back(dataPackage);
879 content = dataPackage;
889 const unordered_map<jsonifier::string, jsonifier::string>& theNameLocalizations) {
890 application_command_option_choice_data choiceData{};
891 choiceData.nameLocalizations = theNameLocalizations;
892 choiceData.name = theName;
893 choiceData.value = jsonifier::string{ value.operator jsonifier::string_base<uint8_t>() };
894 choices.emplace_back(choiceData);
899 targetUserId = targetUserIdNew;
904 const jsonifier::string& emojiName,
snowflake emojiId,
const jsonifier::string& url) {
905 if (components.size() == 0) {
906 action_row_data actionRowData;
907 components.emplace_back(actionRowData);
909 if (components.size() < 5) {
910 if (components[components.size() - 1].components.size() < 5) {
911 component_data component;
913 component.emoji.
name = emojiName;
914 component.label = buttonLabel;
915 component.style =
static_cast<uint64_t
>(buttonStyle);
916 component.customId = customIdNew;
917 component.disabled = disabled;
918 component.emoji.
id = emojiId;
920 components[components.size() - 1].components.emplace_back(component);
921 }
else if (components[components.size() - 1].components.size() == 5) {
922 action_row_data actionRowData;
923 components.emplace_back(actionRowData);
930 const jsonifier::string& placeholder, uint64_t maxValues, uint64_t minValues, select_menu_type type, jsonifier::vector<channel_type> channelTypes) {
931 if (components.size() == 0) {
932 action_row_data actionRowData;
933 components.emplace_back(actionRowData);
935 if (components.size() < 5) {
936 if (components[components.size() - 1].components.size() < 5) {
937 component_data componentData;
939 componentData.channelTypes = channelTypes;
940 componentData.placeholder = placeholder;
941 componentData.customId = customIdNew;
942 componentData.maxValues = maxValues;
943 componentData.minValues = minValues;
944 componentData.disabled = disabled;
945 componentData.options = options;
946 components[components.size() - 1].components.emplace_back(componentData);
947 }
else if (components[components.size() - 1].components.size() == 5) {
948 action_row_data actionRowData;
949 components.emplace_back(actionRowData);
956 const jsonifier::string& customIdNew,
bool required, uint64_t minLength, uint64_t maxLength,
text_input_style inputStyle,
const jsonifier::string& label,
957 const jsonifier::string& placeholder) {
959 customId = topCustomIdNew;
960 if (components.size() == 0) {
961 action_row_data actionRowData;
962 components.emplace_back(actionRowData);
964 if (components.size() < 5) {
965 if (components[components.size() - 1].components.size() < 5) {
966 component_data component{};
968 component.customId = customIdNew;
969 component.style =
static_cast<uint64_t
>(inputStyle);
970 component.title = titleNew;
971 component.maxLength = maxLength;
972 component.minLength = minLength;
973 component.label = label;
974 component.required = required;
975 component.placeholder = placeholder;
976 components[components.size() - 1].components.emplace_back(component);
977 }
else if (components[components.size() - 1].components.size() == 5) {
978 action_row_data actionRowData;
979 components.emplace_back(actionRowData);
986 files.emplace_back(theFile);
991 allowedMentions = dataPackage;
996 components.emplace_back(dataPackage);
1001 embeds.emplace_back(dataPackage);
1006 content = dataPackage;
1016 data.allowedMentions = other.allowedMentions;
1017 data.components = other.components;
1018 data.customId = other.customId;
1019 data.choices = other.choices;
1020 data.content = other.content;
1021 data.embeds = other.embeds;
1022 data.title = other.title;
1023 data.files = other.files;
1024 data.flags = other.flags;
1025 data.tts = other.tts;
1034 jsonifier::raw_json_data valueNew{};
1035 valueNew = data.value;
1036 values[data.name] = valueNew;
1037 for (
auto& value: data.options) {
1038 parseCommandDataOption(values, value);
1047 subCommandGroupName = other.subCommandGroupName;
1048 subCommandName = other.subCommandName;
1049 commandName = other.commandName;
1050 optionsArgs = other.optionsArgs;
1055 command_data::command_data(
const command_data& other) {
1060 if (inputEventData.interactionData->data.name !=
"") {
1061 commandName = inputEventData.interactionData->data.name;
1063 if (inputEventData.interactionData->data.targetId != 0) {
1064 optionsArgs.values.emplace(
"target_id", jsonifier::raw_json_data{ inputEventData.interactionData->data.targetId.operator jsonifier::string() });
1065 }
else if (inputEventData.interactionData->data.targetId != 0) {
1066 optionsArgs.values.emplace(
"target_id", jsonifier::raw_json_data{ inputEventData.interactionData->data.targetId.operator jsonifier::string() });
1069 for (
auto& value: eventData->interactionData->data.options) {
1070 jsonifier::raw_json_data serializer{ value.value.operator jsonifier::string() };
1071 optionsArgs.values[value.name] = serializer;
1072 parseCommandDataOption(optionsArgs.values, value);
1074 for (
auto& value: eventData->interactionData->data.options) {
1076 subCommandName = value.name;
1079 subCommandGroupName = value.name;
1085 return *eventData->interactionData;
1089 return eventData->getGuildMemberData();
1093 return eventData->getChannelData();
1097 return eventData->getMessageData();
1101 return eventData->getUserData();
1109 return subCommandName;
1113 return subCommandGroupName;
1120 base_function_arguments::base_function_arguments(
const command_data& commanddataNew) :
command_data{ commanddataNew } {};
1122 move_through_message_pages_data moveThroughMessagePages(
snowflake userID,
input_event_data originalEvent, uint32_t currentPageIndex,
1123 const jsonifier::vector<embed_data>& messageEmbeds,
bool deleteAfter, uint32_t waitForMaxMs,
bool returnResult) {
1125 uint32_t newCurrentPageIndex = currentPageIndex;
1126 stop_watch<milliseconds> stopWatch{ milliseconds{ waitForMaxMs } };
1131 embedData->setColor(
"FEFEFE");
1132 embedData->setTitle(
"__**Permissions Issue:**__");
1134 embedData->setDescription(
"Sorry, but that button can only be pressed by <@" + userID +
">!");
1135 createResponseData->addMessageEmbed(*embedData);
1137 if (messageEmbeds.size() > 0) {
1138 interactionResponse->addMessageEmbed(messageEmbeds[currentPageIndex]);
1141 interactionResponse->addButton(
false,
"select",
"Select",
button_style::Success, unicode_emojis::x);
1143 interactionResponse->addButton(
false,
"backwards",
"Prev Page",
button_style::Primary, unicode_emojis::arrow_left);
1144 interactionResponse->addButton(
false,
"forwards",
"Next Page",
button_style::Primary, unicode_emojis::arrow_right);
1145 interactionResponse->addButton(
false,
"exit",
"Exit",
button_style::Danger, unicode_emojis::x);
1148 while (!stopWatch.hasTimeElapsed()) {
1149 std::this_thread::sleep_for(1ms);
1151 jsonifier::vector<button_response_data> buttonIntData{ button->collectButtonData(
false, waitForMaxMs, 1, *createResponseData, userID).get() };
1153 if (buttonIntData.size() == 0) {
1156 dataPackage02->addMessageEmbed(messageEmbeds[newCurrentPageIndex]);
1157 for (uint64_t x = 0; x < originalEvent.getMessageData().components.size(); ++x) {
1159 for (uint64_t y = 0; y < originalEvent.getMessageData().components[x].components.size(); ++y) {
1160 component_data component = originalEvent.getMessageData().components[x].components[y];
1161 component.disabled =
true;
1162 actionRow.components.emplace_back(component);
1167 dataPackage02->addButton(
false,
"backwards",
"Prev Page",
button_style::Primary, unicode_emojis::arrow_left);
1168 dataPackage02->addButton(
false,
"forwards",
"Next Page",
button_style::Primary, unicode_emojis::arrow_right);
1171 if (deleteAfter ==
true) {
1179 dataPackage03->inputEventData = originalEvent;
1180 dataPackage03->buttonId =
"exit";
1181 return *dataPackage03;
1183 }
else if (buttonIntData[0].buttonId ==
"empty" || buttonIntData[0].buttonId ==
"exit") {
1185 if (buttonIntData[0].buttonId ==
"empty") {
1186 *dataPackage02 = originalEvent;
1192 dataPackage02->addMessageEmbed(messageEmbeds[newCurrentPageIndex]);
1193 for (uint64_t x = 0; x < originalEvent.getMessageData().components.size(); ++x) {
1195 for (uint64_t y = 0; y < originalEvent.getMessageData().components[x].components.size(); ++y) {
1196 component_data component = originalEvent.getMessageData().components[x].components[y];
1197 component.disabled =
true;
1198 actionRow.components.emplace_back(component);
1203 dataPackage02->addButton(
true,
"backwards",
"Prev Page",
button_style::Primary, unicode_emojis::arrow_left);
1204 dataPackage02->addButton(
true,
"forwards",
"Next Page",
button_style::Primary, unicode_emojis::arrow_right);
1207 if (deleteAfter ==
true) {
1215 dataPackage03->inputEventData = originalEvent;
1216 dataPackage03->buttonId =
"exit";
1217 return *dataPackage03;
1218 }
else if (buttonIntData[0].buttonId ==
"forwards" || buttonIntData[0].buttonId ==
"backwards") {
1219 if (buttonIntData[0].buttonId ==
"forwards" && (newCurrentPageIndex == (messageEmbeds.size() - 1))) {
1220 newCurrentPageIndex = 0;
1221 }
else if (buttonIntData[0].buttonId ==
"forwards" && (newCurrentPageIndex < messageEmbeds.size())) {
1222 ++newCurrentPageIndex;
1223 }
else if (buttonIntData[0].buttonId ==
"backwards" && (newCurrentPageIndex > 0)) {
1224 --newCurrentPageIndex;
1225 }
else if (buttonIntData[0].buttonId ==
"backwards" && (newCurrentPageIndex == 0)) {
1226 newCurrentPageIndex =
static_cast<uint32_t
>(messageEmbeds.size()) - 1;
1231 for (uint64_t x = 0; x < originalEvent.getMessageData().components.size(); ++x) {
1233 for (uint64_t y = 0; y < originalEvent.getMessageData().components[x].components.size(); ++y) {
1234 component_data component = originalEvent.getMessageData().components[x].components[y];
1235 component.disabled =
false;
1236 actionRow.components.emplace_back(component);
1241 dataPackage.addButton(
false,
"backwards",
"Prev Page",
button_style::Primary, unicode_emojis::arrow_left);
1242 dataPackage.addButton(
false,
"forwards",
"Next Page",
button_style::Primary, unicode_emojis::arrow_right);
1247 }
else if (buttonIntData[0].buttonId ==
"select") {
1248 if (deleteAfter ==
true) {
1255 for (uint64_t x = 0; x < originalEvent.getMessageData().components.size(); ++x) {
1257 for (uint64_t y = 0; y < originalEvent.getMessageData().components[x].components.size(); ++y) {
1258 component_data component = originalEvent.getMessageData().components[x].components[y];
1259 component.disabled =
true;
1260 actionRow.components.emplace_back(component);
1265 dataPackage.addButton(
true,
"backwards",
"Prev Page",
button_style::Primary, unicode_emojis::arrow_left);
1266 dataPackage.addButton(
true,
"forwards",
"Next Page",
button_style::Primary, unicode_emojis::arrow_right);
1272 returnData->currentPageIndex = newCurrentPageIndex;
1273 returnData->inputEventData = originalEvent;
1274 returnData->buttonId = buttonIntData[0].buttonId;
Action row data of message components.
jsonifier::vector< component_data > components
Array of components to make up the action-row.
Allowable mentions for a message.
Data structure representing an application_command_data.
jsonifier::vector< application_command_option_data > options
A vector of possible options for the current application_command_data.
unordered_map< jsonifier::string, jsonifier::string > descriptionLocalizations
Dictionary with keys in available locales.
application_command_type type
The type of application_command_data.
unordered_set< jsonifier::string > jsonifierExcludedKeys
Keys to exclude at serialization time.
snowflake guildId
(where applicable) a guild id for which guild to assign this application_command_data to.
jsonifier::string description
A description of the current application_command_data.
jsonifier::string version
An autoincremented version.
unordered_map< jsonifier::string, jsonifier::string > nameLocalizations
Dictionary with keys in available locales.
jsonifier::string name
Name of the current application_command_data.
Data structure representing an application_command_data's option choice.
jsonifier::string name
The name of the current choice.
unordered_map< jsonifier::string, jsonifier::string > nameLocalizations
Dictionary with keys in available locales localization dictionary for the name.
jsonifier::raw_json_data value
The value of the option.
jsonifier::vector< audit_log_entry_data > auditLogEntries
Array of audit log entry objects.
void updateVoiceStatus(update_voice_state_data dataPackage)
Updates the bot's current voice-status. joins/leaves a channel, and/or self deafens/mutes.
Command data, for functions executed by the command_controller.
const guild_member_data & getGuildMemberData() const
Returns the guild_member_data of this input-event.
jsonifier::string getSubCommandName() const
Returns the subcommand-name of this entered command.
const input_event_data & getInputEventData() const
Returns the input_event_data for this command.
const user_data & getUserData() const
Returns the user_data of this input-event.
const interaction_data & getInteractionData() const
Returns the interaction data, if appplicable, of this input-event.
jsonifier::string getCommandName() const
Returns the name of this entered command.
const channel_data & getChannelData() const
Returns the channel_data of this input-event.
jsonifier::string getSubCommandGroupName() const
Returns the subcommand-name of this entered command group.
const message_data & getMessageData() const
Returns the message data, if applicable, of this input-event.
serializer_value getCommandArguments() const
Returns the collection of command inputs/options for this command.
static bot_user getBotUser()
For collecting a copy of the current bot's user_data.
jsonifier::string description
Description of the embed.
jsonifier::string title
Title of the embed.
embed_provider_data provider
Embed provider data.
unordered_set< jsonifier::string > jsonifierExcludedKeys
For excluding certain keys from parsing/serialization.
embed_image_data image
Embed image data.
jsonifier::string type
Type of the embed.
uint64_t hexColorValue
Hex color value of the embed.
embed_data & setAuthor(const jsonifier::string &authorName, const jsonifier::string &authorAvatarUrl="")
Sets the author's name and avatar for the embed.
embed_data & setImage(const jsonifier::string &imageUrl)
Sets the image of the embed.
embed_data & addField(const jsonifier::string &name, const jsonifier::string &value, bool Inline=true)
Adds a field to the embed.
embed_thumbnail_data thumbnail
Embed thumbnail data.
embed_data & setThumbnail(const jsonifier::string &thumbnailUrl)
Sets the thumbnail of the embed.
jsonifier::string url
Url for the embed.
embed_footer_data footer
Embed footer data.
embed_data & setTitle(const jsonifier::string &titleNew)
Sets the title of the embed.
jsonifier::vector< embed_field_data > fields
Array of embed fields.
embed_video_data video
Embed video data.
embed_data & setFooter(const jsonifier::string &footerText, const jsonifier::string &footerIconUrlText="")
Sets the footer's values for the embed.
embed_data & setColor(const jsonifier::string &hexColorValueNew)
Sets the color of the embed, by applying a hex-color value.
time_stamp timeStamp
Timestamp to be placed on the embed.
embed_data & setTimeStamp(const jsonifier::string &timeStamp)
Sets the timeStamp on the embed.
embed_author_data author
Embed author data.
embed_data & setDescription(const jsonifier::string &descriptionNew)
Sets the description (the main contents) of the embed.
unordered_set< jsonifier::string > jsonifierExcludedKeys
Excluding keys from parsing/serializing.
bool managed
Is it managed?
std::wstring unicodeName
What is its unicode name?
jsonifier::vector< role_data > roles
Roles that are allowed to use this emoji.
void disconnect()
For disconnecting from the current guild's voice channel.
snowflake id
The id of this guild.
void disconnect()
For disconnecting from the current guild's voice channel.
user_id_base user
The user id for this guild_member_data.
Data structure representing a single guild_member_data.
user_data user
The user this guild member represents.
static voice_state_data_light getVoiceStateData(const two_id_key &voiceState)
Collect a given guild_member's voice state data.
The core of a message's data structure.
Message response base, for responding to messages.
message_response_base & setTTSStatus(bool enabledTTs)
For setting the tts status of a response.
message_response_base & addAllowedMentions(const allowed_mentions_data &dataPackage)
For setting the allowable mentions in a response.
message_response_base & addModal(const jsonifier::string &topTitleNew, const jsonifier::string &topCustomIdNew, const jsonifier::string &titleNew, const jsonifier::string &customIdNew, bool required, uint64_t minLength, uint64_t maxLength, text_input_style inputStyle, const jsonifier::string &label="", const jsonifier::string &placeholder="")
Adds a modal to the response message_data.
message_response_base & addContent(const jsonifier::string &dataPackage)
For setting the message content in a response.
message_response_base & addFile(const file &theFile)
Adds a file to the current collection of files for this message response.
message_response_base & addButton(bool disabled, const jsonifier::string &customIdNew, const jsonifier::string &buttonLabel, button_style buttonStyle, const jsonifier::string &emojiName="", snowflake emojiId=snowflake{}, const jsonifier::string &url="")
Adds a button to the response message_data.
message_response_base & addMessageEmbed(const embed_data &dataPackage)
For setting the embeds in a response.
message_response_base & addSelectMenu(bool disabled, const jsonifier::string &customIdNew, const jsonifier::vector< select_option_data > &options, const jsonifier::string &placeholder, uint64_t maxValues, uint64_t minValues, select_menu_type type, jsonifier::vector< channel_type > channelTypes=jsonifier::vector< channel_type >{})
Adds a select-menu to the response message_data.
message_response_base & addComponentRow(const action_row_data &dataPackage)
For setting the components in a response.
unordered_set< jsonifier::string > jsonifierExcludedKeys
Excluding keys from parsing/serializing.
snowflake id
This emoji's id.
jsonifier::string name
What is its name?
A class representing a snowflake identifier with various operations.
uint64_t id
The snowflake id.
A smart pointer class that provides unique ownership semantics.
DCA_INLINE void reset(pointer newPtr=nullptr)
Resets the managed pointer and invokes the deleter.
static user_cache_data getCachedUser(get_user_data dataPackage)
Collects a given user from the library's cache.
input_event_response_type
Input event response types.
button_style
Button styles.
audit_log_event
Audit log events.
text_input_style
Text input style for modals.
component_type
Component types.
DiscordCoreAPI_Dll jsonifier::string getTimeAndDate()
Acquires a timeStamp with the current time and date - suitable for use in message-embeds.
@ Edit_Interaction_Response
Interaction response edit.
@ Channel_Message_With_Source
Respond to an interaction with a message.
@ Action_Row
container for other components.
@ Role_Select
Select menu for roles.
@ Mentionable_Select
Select menu for mentionables (users and roles).
@ Channel_Select
Select menu for channels.
@ String_Select
Select menu for picking from defined text options.
@ User_Select
Select menu for users.
@ Text_Input
Text input object.
@ Sub_Command
Sub-command.
@ Sub_Command_Group
Sub-command group.
DCA_INLINE unique_ptr< value_type, deleter > makeUnique(arg_types &&... args)
Helper function to create a unique_ptr for a non-array object.
The main namespace for the forward-facing interfaces.
Application_command_data interaction data option.
Data structure representing an application_command_data's option.
int64_t minValue
If the option is an integer or number type, the minimum value permitted.
bool autocomplete
If autocomplete interactions are enabled for this string, integer, or number type option.
jsonifier::string description
A description of the current application_command_data option.
jsonifier::vector< channel_type > channelTypes
Set when the application_command_data option type is set to channel_data.
bool required
If the parameter is required or optional– default false.
jsonifier::vector< application_command_option_choice_data > choices
A vector of possible choices for the current application_command_data option.
jsonifier::vector< application_command_option_data > options
A vector of possible options for the current application_command_data option.
jsonifier::string name
Name of the current application_command_data option.
application_command_option_type type
The type of command option.
unordered_map< jsonifier::string, jsonifier::string > nameLocalizations
Dictionary for the name localizations field.
int64_t maxValue
If the option is an integer or number type, the maximum value permitted.
unordered_map< jsonifier::string, jsonifier::string > descriptionLocalizations
Dictionary for the description localizations field.
jsonifier::string iconUrl
Icon url.
jsonifier::string name
Name.
jsonifier::string url
Url.
jsonifier::string proxyIconUrl
Proxy icon url.
unordered_set< jsonifier::string > jsonifierExcludedKeys
For excluding certain keys from parsing/serialization.
uint64_t height
Image height.
unordered_set< jsonifier::string > jsonifierExcludedKeys
For excluding certain keys from parsing/serialization.
jsonifier::string proxyUrl
Proxy url.
uint64_t width
Image width.
Data representing a file to be sent via multipart-form data.
Interaction application_command_data callback data.
jsonifier::vector< action_row_data > components
Message components.
jsonifier::string title
The title of the popup modal.
jsonifier::vector< file > files
Files for uploading.
jsonifier::vector< attachment_data > attachments
Array of partial attachment objects attachment objects with filename and description.
jsonifier::string customId
A developer-defined identifier for the component, max 100 characters.
allowed_mentions_data allowedMentions
Allowed mentions data.
unordered_set< jsonifier::string > jsonifierExcludedKeys
Keys to exclude from parsing/serializing.
jsonifier::string content
Message content.
jsonifier::vector< application_command_option_choice_data > choices
Autocomplete choices(max of 25 choices).
jsonifier::vector< embed_data > embeds
Message embeds.
Interaction response data.
interaction_callback_data data
Interaction application_command_data callback data.