44 static constexpr auto parseValue = createObject(
"default_message_notifications", &value_type::defaultMessageNotifications,
"explicit_content_filter",
45 &value_type::explicitContentFilter,
"system_channel_flags", &value_type::systemChannelFlags,
"verification_level", &value_type::verificationLevel,
"afk_timeout",
46 &value_type::afkTimeout,
"region", &value_type::region,
"name", &value_type::name,
"icon",
"channels", &value_type::channels,
"system_channel_id",
47 &value_type::systemChannelId,
"roles", &value_type::roles,
"afk_channel_id", &value_type::afkChannelId);
52 static constexpr auto parseValue =
53 createObject(
"default_message_notifications", &value_type::defaultMessageNotifications,
"explicit_content_filter", &value_type::explicitContentFilter,
54 "system_channel_flags", &value_type::systemChannelFlags,
"verification_level", &value_type::verificationLevel,
"features", &value_type::features,
55 "public_updates_channel_id", &value_type::publicUpdatesChannelId,
"afk_timeout", &value_type::afkTimeout,
"preferred_locale", &value_type::preferredLocale,
56 "discovery_splash", &value_type::discoverySplash,
"system_channel_id", &value_type::systemChannelId,
"rules_channel_id", &value_type::rulesChannelId,
"description",
57 &value_type::description,
"afk_channel_id", &value_type::afkChannelId,
"banner", &value_type::banner,
"splash", &value_type::splash,
"reason", &value_type::reason,
58 "owner_id", &value_type::ownerId,
"guild_id", &value_type::guildId,
"icon", &value_type::icon,
"name", &value_type::name);
63 static constexpr auto parseValue = createObject(
"delete_message_days", &value_type::deleteMessageDays,
"member", &value_type::guildMemberId,
"reason", &value_type::reason,
64 "guild_id", &value_type::guildId);
69 static constexpr auto parseValue = createObject(
"welcome_channels", &value_type::welcomeChannels,
"description", &value_type::description,
"guild_id", &value_type::guildId,
70 "enabled", &value_type::enabled,
"reason", &value_type::reason);
75 static constexpr auto parseValue = createObject(
"include_roles", &value_type::includeRoles,
"guild_id", &value_type::guildId,
"days", &value_type::days);
80 static constexpr auto parseValue = createObject(
"include_roles", &value_type::includeRoles,
"compute_prune_count", &value_type::computePruneCount,
"reason",
81 &value_type::reason,
"guild_id", &value_type::guildId,
"days", &value_type::days);
86 static constexpr auto parseValue =
87 createObject(
"template_code", &value_type::templateCode,
"description", &value_type::description,
"guild_id", &value_type::guildId,
"name", &value_type::name);
92 static constexpr auto parseValue = createObject(
"description", &value_type::description,
"guild_id", &value_type::guildId,
"name", &value_type::name);
95 template<>
struct core<
discord_core_api::create_guild_from_guild_template_data> {
97 static constexpr auto parseValue = createObject(
"template_code", &value_type::templateCode,
"image_data", &value_type::imageData,
"name", &value_type::name);
102 static constexpr auto parseValue = createObject(
"widget_data", &value_type::widgetData,
"reason", &value_type::reason,
"guild_id", &value_type::guildId);
110 guild_data::guild_data(snowflake newId) {
114 guild_cache_data::guild_cache_data(snowflake newId) {
118 discord_core_client* guild_cache_data::getDiscordCoreClient() {
119 return discord_core_client::getInstance();
122 discord_core_client* guild_data::getDiscordCoreClient() {
123 return discord_core_client::getInstance();
126 guild_cache_data& guild_cache_data::operator=(
const guild_data& other) {
132 if (discord_core_client::getInstance()) {
134 if (other.voiceConnection) {
137 if (
static_cast<int64_t
>(other.flags) != 0) {
140 for (
auto& value: other.channels) {
143 for (
auto& value: other.members) {
144 members.emplace_back(value.user.id);
146 for (
auto& value: other.roles) {
147 roles.emplace_back(value.id);
149 for (
auto& value: other.emoji) {
150 emoji.emplace_back(value.id);
152 if (other.discoverySplash !=
"") {
155 if (other.memberCount != 0) {
158 if (other.discovery !=
"") {
161 if (other.ownerId != 0) {
164 if (other.banner !=
"") {
167 if (other.splash !=
"") {
170 if (other.icon !=
"") {
173 if (other.name !=
"") {
182 guild_cache_data::guild_cache_data(
const guild_data& other) {
186 guild_cache_data& guild_cache_data::operator=(guild_data&& other)
noexcept {
192 if (other.discoverySplash !=
"") {
193 discoverySplash = std::move(other.discoverySplash);
195 if (other.voiceConnection) {
196 voiceConnection = other.voiceConnection;
198 if (
static_cast<int64_t
>(other.flags) != 0) {
201 if (other.discovery !=
"") {
202 discovery = std::move(other.discovery);
204 for (
auto& value: other.channels) {
205 channels.emplace_back(value.id);
207 for (
auto& value: other.members) {
208 members.emplace_back(value.user.id);
210 for (
auto& value: other.roles) {
211 roles.emplace_back(value.id);
213 for (
auto& value: other.emoji) {
214 emoji.emplace_back(value.id);
216 if (other.memberCount != 0) {
217 memberCount = other.memberCount;
219 if (other.banner !=
"") {
220 banner = std::move(other.banner);
222 if (other.splash !=
"") {
223 splash = std::move(other.splash);
225 if (other.icon !=
"") {
226 icon = std::move(other.icon);
228 if (other.name !=
"") {
229 name = std::move(other.name);
231 if (other.ownerId != 0) {
232 ownerId = other.ownerId;
240 guild_cache_data::operator guild_data() {
241 guild_data returnData{};
242 returnData.voiceConnection = voiceConnection;
243 for (
auto& value: channels) {
244 if (channels::doWeCacheChannels()) {
247 channel_data newChannel{};
248 newChannel.id = value;
249 returnData.channels.emplace_back(newChannel);
252 for (
auto& value: members) {
253 if (guild_members::doWeCacheGuildMembers()) {
256 guild_member_data newChannel{};
257 newChannel.guildId = id;
258 newChannel.user.id = value;
259 returnData.members.emplace_back(newChannel);
262 for (
auto& value: roles) {
263 if (roles::doWeCacheRoles()) {
267 newChannel.id = value;
268 returnData.roles.emplace_back(newChannel);
271 for (
auto& value: emoji) {
272 emoji_data newValue{};
274 returnData.emoji.emplace_back(std::move(newValue));
281 returnData.discoverySplash = discoverySplash;
282 returnData.memberCount = memberCount;
283 returnData.discovery = discovery;
284 returnData.ownerId = ownerId;
285 returnData.banner = banner;
286 returnData.splash = splash;
287 returnData.flags = flags;
288 returnData.icon = icon;
289 returnData.name = name;
294 guild_cache_data::guild_cache_data(guild_data&& other)
noexcept {
295 *
this = std::move(other);
298 modify_guild_data::modify_guild_data(
const guild_data dataPackage) {
310 for (
auto& value: dataPackage.features) {
315 name = dataPackage.name;
318 void guilds::initialize(discord_core_internal::https_client* client, config_manager* configManagerNew) {
319 guilds::doWeCacheGuildsBool = configManagerNew->doWeCacheGuilds();
320 guilds::httpsClient = client;
321 stopWatchNew.reset();
325 discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Get_Guild_Audit_Logs };
326 co_await newThreadAwaitable<audit_log_data>();
327 workload.workloadClass = discord_core_internal::https_workload_class::Get;
328 workload.relativePath =
"/guilds/" + dataPackage.
guildId +
"/audit-logs";
329 if (dataPackage.
userId != 0) {
330 workload.relativePath +=
"?user_id=" + dataPackage.
userId;
331 if (jsonifier::toString(
static_cast<uint64_t
>(dataPackage.
actionType)) !=
"") {
332 workload.relativePath +=
"&action_type=" + jsonifier::toString(
static_cast<uint64_t
>(dataPackage.
actionType));
334 if (dataPackage.
limit != 0) {
335 workload.relativePath +=
"&limit=" + jsonifier::toString(dataPackage.
limit);
337 if (dataPackage.
before != 0) {
338 workload.relativePath +=
"&before=" + dataPackage.
before;
340 }
else if (jsonifier::toString(
static_cast<uint64_t
>(dataPackage.
actionType)) !=
"") {
341 workload.relativePath +=
"?action_type=" + jsonifier::toString(
static_cast<uint64_t
>(dataPackage.
actionType));
342 if (dataPackage.
limit != 0) {
343 workload.relativePath +=
"&limit=" + jsonifier::toString(dataPackage.
limit);
345 if (dataPackage.
before != 0) {
346 workload.relativePath +=
"&before=" + dataPackage.
before;
348 }
else if (dataPackage.
limit != 0) {
349 workload.relativePath +=
"?limit=" + jsonifier::toString(dataPackage.
limit);
350 if (dataPackage.
before != 0) {
351 workload.relativePath +=
"&before=" + dataPackage.
before;
353 }
else if (dataPackage.
before != 0) {
354 workload.relativePath +=
"?before=" + dataPackage.
before;
356 workload.callStack =
"guilds::getAuditLogDataAsync()";
358 guilds::httpsClient->submitWorkloadAndGetResult(std::move(workload), returnData);
359 co_return returnData;
363 discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Post_Guild };
364 co_await newThreadAwaitable<guild_data>();
365 workload.workloadClass = discord_core_internal::https_workload_class::Post;
366 workload.relativePath =
"/guilds";
367 parser.serializeJson<
true>(dataPackage, workload.content);
368 workload.callStack =
"guilds::createGuildAsync()";
370 guilds::httpsClient->submitWorkloadAndGetResult(std::move(workload), returnData);
371 co_return returnData;
375 jsonifier::vector<guild_data> returnData{};
376 for (
auto& value: guilds::cache) {
377 returnData.emplace_back(*value);
383 discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Get_Guild };
384 co_await newThreadAwaitable<guild_data>();
385 workload.workloadClass = discord_core_internal::https_workload_class::Get;
386 workload.relativePath =
"/guilds/" + dataPackage.
guildId +
"?with_counts=true";
387 workload.callStack =
"guilds::getGuildAsync()";
390 if (cache.contains(data.id)) {
391 data = cache[data.id];
393 guilds::httpsClient->submitWorkloadAndGetResult(std::move(workload), data);
394 if (doWeCacheGuildsBool) {
401 if (guilds::cache.contains(dataPackage.
guildId)) {
402 return cache[dataPackage.
guildId];
409 discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Get_Guild_Preview };
410 co_await newThreadAwaitable<guild_preview_data>();
411 workload.workloadClass = discord_core_internal::https_workload_class::Get;
412 workload.relativePath =
"/guilds/" + dataPackage.
guildId +
"/preview";
413 workload.callStack =
"guilds::getGuildPreviewAsync()";
415 guilds::httpsClient->submitWorkloadAndGetResult(std::move(workload), returnData);
416 co_return returnData;
420 discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Patch_Guild };
421 co_await newThreadAwaitable<guild_data>();
422 workload.workloadClass = discord_core_internal::https_workload_class::Patch;
423 workload.relativePath =
"/guilds/" + dataPackage.
guildId;
424 parser.serializeJson<
true>(dataPackage, workload.content);
425 workload.callStack =
"guilds::modifyGuildAsync()";
426 if (dataPackage.
reason !=
"") {
427 workload.headersToInsert[
"x-audit-log-reason"] = dataPackage.
reason;
430 if (cache.contains(data.id)) {
431 data = cache[data.id];
433 guilds::httpsClient->submitWorkloadAndGetResult(std::move(workload), data);
434 if (doWeCacheGuildsBool) {
441 discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Delete_Guild };
442 co_await newThreadAwaitable<void>();
443 workload.workloadClass = discord_core_internal::https_workload_class::Delete;
444 workload.relativePath =
"/guilds/" + dataPackage.
guildId;
445 workload.callStack =
"guilds::deleteGuildAsync()";
446 guilds::httpsClient->submitWorkloadAndGetResult(std::move(workload));
451 discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Get_Guild_Bans };
452 co_await newThreadAwaitable<jsonifier::vector<ban_data>>();
453 workload.workloadClass = discord_core_internal::https_workload_class::Get;
454 workload.relativePath =
"/guilds/" + dataPackage.
guildId +
"/bans";
455 if (dataPackage.
after != 0) {
456 workload.relativePath +=
"?after=" + dataPackage.
after;
457 if (dataPackage.
before != 0) {
458 workload.relativePath +=
"&before=" + dataPackage.
before;
460 if (dataPackage.
limit != 0) {
461 workload.relativePath +=
"&limit=" + jsonifier::toString(dataPackage.
limit);
463 }
else if (dataPackage.
before != 0) {
464 workload.relativePath +=
"?before=" + dataPackage.
before;
465 if (dataPackage.
limit != 0) {
466 workload.relativePath +=
"&limit=" + jsonifier::toString(dataPackage.
limit);
468 }
else if (dataPackage.
limit != 0) {
469 workload.relativePath +=
"?limit=" + jsonifier::toString(dataPackage.
limit);
471 workload.callStack =
"guilds::getGuildBansAsync()";
472 jsonifier::vector<ban_data> returnData{};
473 guilds::httpsClient->submitWorkloadAndGetResult(std::move(workload), returnData);
474 co_return returnData;
478 discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Get_Guild_Ban };
479 co_await newThreadAwaitable<ban_data>();
480 workload.workloadClass = discord_core_internal::https_workload_class::Get;
481 workload.relativePath =
"/guilds/" + dataPackage.
guildId +
"/bans/" + dataPackage.
userId;
482 workload.callStack =
"guilds::getGuildBanAsync()";
484 guilds::httpsClient->submitWorkloadAndGetResult(std::move(workload), data);
485 co_return std::move(data);
489 discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Put_Guild_Ban };
490 co_await newThreadAwaitable<void>();
491 workload.workloadClass = discord_core_internal::https_workload_class::Put;
492 workload.relativePath =
"/guilds/" + dataPackage.
guildId +
"/bans/" + dataPackage.
guildMemberId;
493 parser.serializeJson<
true>(dataPackage, workload.content);
494 workload.callStack =
"guilds::createGuildBanAsync()";
495 if (dataPackage.
reason !=
"") {
496 workload.headersToInsert[
"x-audit-log-reason"] = dataPackage.
reason;
498 guilds::httpsClient->submitWorkloadAndGetResult(std::move(workload));
503 discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Delete_Guild_Ban };
504 co_await newThreadAwaitable<void>();
505 workload.workloadClass = discord_core_internal::https_workload_class::Delete;
506 workload.relativePath =
"/guilds/" + dataPackage.
guildId +
"/bans/" + dataPackage.
userId;
507 workload.callStack =
"guilds::removeGuildBanAsync()";
508 if (dataPackage.
reason !=
"") {
509 workload.headersToInsert[
"x-audit-log-reason"] = dataPackage.
reason;
511 guilds::httpsClient->submitWorkloadAndGetResult(std::move(workload));
516 discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Get_Guild_Prune_Count };
517 co_await newThreadAwaitable<guild_prune_count_data>();
518 workload.workloadClass = discord_core_internal::https_workload_class::Get;
519 workload.relativePath =
"/guilds/" + dataPackage.
guildId +
"/prune";
520 workload.callStack =
"guilds::getGuildPruneCountAsync()";
521 if (dataPackage.
days != 0) {
522 workload.relativePath +=
"?days=" + jsonifier::toString(dataPackage.
days);
524 workload.relativePath +=
"&include_roles=";
525 for (uint64_t x = 0; x < dataPackage.
includeRoles.size(); ++x) {
526 workload.relativePath += dataPackage.
includeRoles.at(x).operator jsonifier::string();
528 workload.relativePath +=
",";
533 workload.relativePath +=
"?include_roles=";
534 for (uint64_t x = 0; x < dataPackage.
includeRoles.size(); ++x) {
535 workload.relativePath += dataPackage.
includeRoles.at(x).operator jsonifier::string();
537 workload.relativePath +=
",";
542 guilds::httpsClient->submitWorkloadAndGetResult(std::move(workload), returnData);
543 co_return returnData;
547 discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Post_Guild_Prune };
548 co_await newThreadAwaitable<guild_prune_count_data>();
549 workload.workloadClass = discord_core_internal::https_workload_class::Post;
550 workload.relativePath =
"/guilds/" + dataPackage.
guildId +
"/prune";
551 parser.serializeJson<
true>(dataPackage, workload.content);
552 workload.callStack =
"guilds::beginGuildPruneAsync()";
553 if (dataPackage.
reason !=
"") {
554 workload.headersToInsert[
"x-audit-log-reason"] = dataPackage.
reason;
557 guilds::httpsClient->submitWorkloadAndGetResult(std::move(workload), returnData);
558 co_return returnData;
562 discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Get_Guild_Voice_Regions };
563 co_await newThreadAwaitable<jsonifier::vector<voice_region_data>>();
564 workload.workloadClass = discord_core_internal::https_workload_class::Get;
565 workload.relativePath =
"/guilds/" + dataPackage.
guildId +
"/regions";
566 workload.callStack =
"guilds::getGuildVoiceRegionsAsync()";
567 jsonifier::vector<voice_region_data> returnData{};
568 guilds::httpsClient->submitWorkloadAndGetResult(std::move(workload), returnData);
569 co_return returnData;
573 discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Get_Guild_Invites };
574 co_await newThreadAwaitable<jsonifier::vector<invite_data>>();
575 workload.workloadClass = discord_core_internal::https_workload_class::Get;
576 workload.relativePath =
"/guilds/" + dataPackage.
guildId +
"/invites";
577 workload.callStack =
"guilds::getGuildInvitesAsync()";
578 jsonifier::vector<invite_data> returnData{};
579 guilds::httpsClient->submitWorkloadAndGetResult(std::move(workload), returnData);
581 co_return returnData;
585 discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Get_Guild_Integrations };
586 co_await newThreadAwaitable<jsonifier::vector<integration_data>>();
587 workload.workloadClass = discord_core_internal::https_workload_class::Get;
588 workload.relativePath =
"/guilds/" + dataPackage.guildId +
"/integrations";
589 workload.callStack =
"guilds::getGuildIntegrationsAsync()";
590 jsonifier::vector<integration_data> returnData{};
591 guilds::httpsClient->submitWorkloadAndGetResult(std::move(workload), returnData);
592 co_return returnData;
596 discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Delete_Guild_Integration };
597 co_await newThreadAwaitable<void>();
598 workload.workloadClass = discord_core_internal::https_workload_class::Delete;
599 workload.relativePath =
"/guilds/" + dataPackage.
guildId +
"/integrations/" + dataPackage.
integrationId;
600 workload.callStack =
"guilds::deleteGuildIntegrationAsync()";
601 if (dataPackage.
reason !=
"") {
602 workload.headersToInsert[
"x-audit-log-reason"] = dataPackage.
reason;
604 guilds::httpsClient->submitWorkloadAndGetResult(std::move(workload));
609 discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Get_Guild_Widget_Settings };
610 co_await newThreadAwaitable<guild_widget_data>();
611 workload.workloadClass = discord_core_internal::https_workload_class::Get;
612 workload.relativePath =
"/guilds/" + dataPackage.
guildId +
"/widget";
613 workload.callStack =
"guilds::getGuildWidgetSettingsAsync()";
615 guilds::httpsClient->submitWorkloadAndGetResult(std::move(workload), returnData);
616 co_return returnData;
620 discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Patch_Guild_Widget };
621 co_await newThreadAwaitable<guild_widget_data>();
622 workload.workloadClass = discord_core_internal::https_workload_class::Patch;
623 workload.relativePath =
"/guilds/" + dataPackage.
guildId +
"/widget";
624 parser.serializeJson<
true>(dataPackage, workload.content);
625 workload.callStack =
"guilds::modifyGuildWidgetAsync()";
626 if (dataPackage.
reason !=
"") {
627 workload.headersToInsert[
"x-audit-log-reason"] = dataPackage.
reason;
630 guilds::httpsClient->submitWorkloadAndGetResult(std::move(workload), returnData);
631 co_return returnData;
635 discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Get_Guild_Widget };
636 co_await newThreadAwaitable<guild_widget_data>();
637 workload.workloadClass = discord_core_internal::https_workload_class::Get;
638 workload.relativePath =
"/guilds/" + dataPackage.
guildId +
"/widget.json";
639 workload.callStack =
"guilds::getGuildWidgetAsync()";
641 guilds::httpsClient->submitWorkloadAndGetResult(std::move(workload), returnData);
642 co_return returnData;
646 discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Get_Vanity_Invite };
647 co_await newThreadAwaitable<invite_data>();
648 workload.workloadClass = discord_core_internal::https_workload_class::Get;
649 workload.relativePath =
"/guilds/" + dataPackage.
guildId +
"/vanity-url";
650 workload.callStack =
"guilds::getGuildVanityInviteAsync()";
652 guilds::httpsClient->submitWorkloadAndGetResult(std::move(workload), returnData);
653 co_return returnData;
657 discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Get_Guild_Widget_Image };
658 co_await newThreadAwaitable<guild_widget_image_data>();
659 workload.workloadClass = discord_core_internal::https_workload_class::Get;
660 workload.relativePath =
"/guilds/" + dataPackage.
guildId +
"/widget.png";
663 workload.relativePath +=
"?style=shield";
667 workload.relativePath +=
"?style=banner1";
671 workload.relativePath +=
"?style=banner2";
675 workload.relativePath +=
"?style=banner3";
679 workload.relativePath +=
"?style=banner4";
683 workload.callStack =
"guilds::getGuildWidgetImageAsync()";
685 guilds::httpsClient->submitWorkloadAndGetResult(std::move(workload), returnData);
686 co_return returnData;
690 discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Get_Guild_Welcome_Screen };
691 co_await newThreadAwaitable<welcome_screen_data>();
692 workload.workloadClass = discord_core_internal::https_workload_class::Get;
693 workload.relativePath =
"/guilds/" + dataPackage.
guildId +
"/welcome-screen";
694 workload.callStack =
"guilds::getGuildWelcomeScreenAsync()";
696 guilds::httpsClient->submitWorkloadAndGetResult(std::move(workload), returnData);
697 co_return returnData;
701 discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Patch_Guild_Welcome_Screen };
702 co_await newThreadAwaitable<welcome_screen_data>();
703 workload.workloadClass = discord_core_internal::https_workload_class::Patch;
704 workload.relativePath =
"/guilds/" + dataPackage.
guildId +
"/welcome-screen";
705 parser.serializeJson<
true>(dataPackage, workload.content);
706 workload.callStack =
"guilds::modifyGuildWelcomeScreenAsync()";
707 if (dataPackage.
reason !=
"") {
708 workload.headersToInsert[
"x-audit-log-reason"] = dataPackage.
reason;
711 guilds::httpsClient->submitWorkloadAndGetResult(std::move(workload), returnData);
712 co_return returnData;
716 discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Get_Guild_Template };
717 co_await newThreadAwaitable<guild_template_data>();
718 workload.workloadClass = discord_core_internal::https_workload_class::Get;
719 workload.relativePath =
"/guilds/templates/" + dataPackage.
templateCode;
720 workload.callStack =
"guilds::getGuildTemplateAsync()";
722 guilds::httpsClient->submitWorkloadAndGetResult(std::move(workload), returnData);
723 co_return returnData;
727 discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Post_Guild_From_Guild_Template };
728 co_await newThreadAwaitable<guild_data>();
729 workload.workloadClass = discord_core_internal::https_workload_class::Post;
730 workload.relativePath =
"/guilds/templates/" + dataPackage.
templateCode;
731 parser.serializeJson<
true>(dataPackage, workload.content);
732 workload.callStack =
"guilds::createGuildFromGuildTemplateAsync()";
734 guilds::httpsClient->submitWorkloadAndGetResult(std::move(workload), returnData);
735 co_return returnData;
739 discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Get_Guild_Templates };
740 co_await newThreadAwaitable<jsonifier::vector<guild_template_data>>();
741 workload.workloadClass = discord_core_internal::https_workload_class::Get;
742 workload.relativePath =
"/guilds/" + dataPackage.
guildId +
"/templates";
743 workload.callStack =
"guilds::getGuildTemplatesAsync()";
744 jsonifier::vector<guild_template_data> returnData{};
745 guilds::httpsClient->submitWorkloadAndGetResult(std::move(workload), returnData);
746 co_return returnData;
750 discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Post_Guild_Template };
751 co_await newThreadAwaitable<guild_template_data>();
752 workload.workloadClass = discord_core_internal::https_workload_class::Post;
753 workload.relativePath =
"/guilds/" + dataPackage.
guildId +
"/templates";
754 parser.serializeJson<
true>(dataPackage, workload.content);
755 workload.callStack =
"guilds::createGuildTemplateAsync()";
757 guilds::httpsClient->submitWorkloadAndGetResult(std::move(workload), returnData);
758 co_return returnData;
762 discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Put_Guild_Template };
763 co_await newThreadAwaitable<guild_template_data>();
764 workload.workloadClass = discord_core_internal::https_workload_class::Put;
765 workload.relativePath =
"/guilds/" + dataPackage.
guildId +
"/templates/" + dataPackage.
templateCode;
766 workload.callStack =
"guilds::syncGuildTemplateAsync()";
768 guilds::httpsClient->submitWorkloadAndGetResult(std::move(workload), returnData);
769 co_return returnData;
773 discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Patch_Guild_Template };
774 co_await newThreadAwaitable<guild_template_data>();
775 workload.workloadClass = discord_core_internal::https_workload_class::Patch;
776 workload.relativePath =
"/guilds/" + dataPackage.
guildId +
"/templates/" + dataPackage.templateCode;
777 parser.serializeJson<
true>(dataPackage, workload.content);
778 workload.callStack =
"guilds::modifyGuildTemplateAsync()";
780 guilds::httpsClient->submitWorkloadAndGetResult(std::move(workload), returnData);
781 co_return returnData;
785 discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Delete_Guild_Template };
786 co_await newThreadAwaitable<void>();
787 workload.workloadClass = discord_core_internal::https_workload_class::Delete;
788 workload.relativePath =
"/guilds/" + dataPackage.
guildId +
"/templates/" + dataPackage.
templateCode;
789 workload.callStack =
"guilds::deleteGuildTemplateAsync()";
790 guilds::httpsClient->submitWorkloadAndGetResult(std::move(workload));
795 discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Get_Invite };
796 co_await newThreadAwaitable<invite_data>();
797 workload.workloadClass = discord_core_internal::https_workload_class::Get;
798 workload.relativePath =
"/invites/" + dataPackage.
inviteId;
800 workload.relativePath +=
"?with_counts=true";
802 workload.relativePath +=
"&with_expiration=true";
808 workload.relativePath +=
"?with_expiration=true";
816 workload.callStack =
"guilds::getInviteAsync()";
818 guilds::httpsClient->submitWorkloadAndGetResult(std::move(workload), returnData);
819 co_return returnData;
823 discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Delete_Invite };
824 co_await newThreadAwaitable<void>();
825 workload.workloadClass = discord_core_internal::https_workload_class::Delete;
826 workload.relativePath =
"/invites/" + dataPackage.
inviteId;
827 workload.callStack =
"guilds::deleteInviteAsync()";
828 if (dataPackage.
reason !=
"") {
829 workload.headersToInsert[
"x-audit-log-reason"] = dataPackage.
reason;
831 guilds::httpsClient->submitWorkloadAndGetResult(std::move(workload));
836 discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Get_Current_User_Guilds };
837 co_await newThreadAwaitable<jsonifier::vector<guild_data>>();
838 workload.workloadClass = discord_core_internal::https_workload_class::Get;
839 workload.relativePath =
"/users/@me/guilds";
840 if (dataPackage.
after != 0) {
841 workload.relativePath +=
"?after=" + dataPackage.
after;
842 if (dataPackage.
before != 0) {
843 workload.relativePath +=
"&before=" + dataPackage.
before;
845 if (dataPackage.
limit != 0) {
846 workload.relativePath +=
"&limit=" + jsonifier::toString(dataPackage.
limit);
848 }
else if (dataPackage.
before != 0) {
849 workload.relativePath +=
"?before=" + dataPackage.
before;
850 if (dataPackage.
limit != 0) {
851 workload.relativePath +=
"&limit=" + jsonifier::toString(dataPackage.
limit);
853 }
else if (dataPackage.
limit != 0) {
854 workload.relativePath +=
"?limit=" + jsonifier::toString(dataPackage.
limit);
856 workload.callStack =
"users::getCurrentUserGuildsAsync()";
857 jsonifier::vector<guild_data> returnData{};
858 guilds::httpsClient->submitWorkloadAndGetResult(std::move(workload), returnData);
859 co_return returnData;
863 discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Delete_Leave_Guild };
864 co_await newThreadAwaitable<void>();
865 workload.workloadClass = discord_core_internal::https_workload_class::Delete;
866 workload.relativePath =
"/users/@me/guilds/" + dataPackage.
guildId;
867 workload.callStack =
"guilds::leaveGuildAsync()";
868 guilds::httpsClient->submitWorkloadAndGetResult(std::move(workload));
873 return guilds::cache;
876 void guilds::removeGuild(
const guild_cache_data& guildId) {
877 guilds::cache.
erase(guildId);
880 bool guilds::doWeCacheGuilds() {
881 return guilds::doWeCacheGuildsBool;
884 discord_core_internal::https_client* guilds::httpsClient{};
885 object_cache<guild_cache_data> guilds::cache{};
886 bool guilds::doWeCacheGuildsBool{};
static channel_cache_data getCachedChannel(const get_channel_data dataPackage)
Collects a channel from the library's cache.
A co_routine - representing a potentially asynchronous operation/function.
Data structure representing a single guild, for the purposes of populating the cache.
jsonifier::vector< snowflake > members
Array of guild_members.
jsonifier::vector< snowflake > channels
Array of guild channels.
icon_hash icon
Url to the guild's icon.
icon_hash discoverySplash
Url to the guild's icon.
uint32_t memberCount
Member count.
snowflake ownerId
User_data id of the guild's owner.
voice_connection * voiceConnection
A pointer to the voice_connection, if present.
icon_hash splash
Url to the guild's icon.
jsonifier::vector< snowflake > emoji
Array of guild channels.
jsonifier::string name
The guild's name.
guild_flags flags
Guild flags.
jsonifier::vector< snowflake > roles
Array of guild roles.
icon_hash discovery
Url to the guild's icon.
icon_hash banner
Url to the guild's icon.
A discord guild. used to connect to/disconnect from voice.
static guild_member_cache_data getCachedGuildMember(const get_guild_member_data dataPackage)
Collects a guild_member from the library's cache.
static co_routine< void > deleteGuildAsync(const delete_guild_data dataPackage)
Deletes a chosen guild.
static co_routine< jsonifier::vector< guild_data > > getCurrentUserGuildsAsync(const get_current_user_guilds_data dataPackage)
Collects a list of guilds that the bot is in.
static co_routine< guild_widget_data > getGuildWidgetSettingsAsync(const get_guild_widget_settings_data dataPackage)
Gets the guild widget's settings for a particular server.
static co_routine< welcome_screen_data > modifyGuildWelcomeScreenAsync(const modify_guild_welcome_screen_data dataPackage)
Modifies the guild welcome screen.
static co_routine< guild_data > createGuildFromGuildTemplateAsync(const create_guild_from_guild_template_data dataPackage)
Creates a guild from the guild template.
static co_routine< jsonifier::vector< guild_template_data > > getGuildTemplatesAsync(const get_guild_templates_data dataPackage)
Collects a list of guild templates from a chosen guild.
static co_routine< guild_widget_data > getGuildWidgetAsync(const get_guild_widget_data dataPackage)
Gets the guild widget for a particular server.
static co_routine< guild_data > getGuildAsync(const get_guild_data dataPackage)
Collects a guild from the discord servers.
static co_routine< guild_prune_count_data > getGuildPruneCountAsync(const get_guild_prune_count_data dataPackage)
For collecting the guild prune count.
static co_routine< jsonifier::vector< integration_data > > getGuildIntegrationsAsync(const get_guild_integrations_data dataPackage)
Gets the list of guild integrations for a particular server.
static co_routine< guild_template_data > modifyGuildTemplateAsync(const modify_guild_template_data dataPackage)
Modifies a guild template.
static co_routine< void > removeGuildBanAsync(const remove_guild_ban_data dataPackage)
Removes a previously created ban.
static jsonifier::vector< guild_data > getAllGuildsAsync()
Returns all of the guilds that the current bot is in.
static co_routine< audit_log_data > getGuildAuditLogsAsync(const get_guild_audit_logs_data dataPackage)
Gets an audit log from the discord servers.
static co_routine< welcome_screen_data > getGuildWelcomeScreenAsync(const get_guild_welcome_screen_data dataPackage)
Gets the guild welcome screen for a particular server.
static co_routine< void > deleteGuildTemplateAsync(const delete_guild_template_data dataPackage)
Deletes a guild template.
static co_routine< void > leaveGuildAsync(const leave_guild_data dataPackage)
Removes the bot from a chosen guild.
static co_routine< invite_data > getGuildVanityInviteAsync(const get_guild_vanity_invite_data dataPackage)
Gets the vanity invite responseData from a particular server.
static co_routine< jsonifier::vector< invite_data > > getGuildInvitesAsync(const get_guild_invites_data dataPackage)
Gets multiple invites from the discord servers.
static co_routine< guild_data > modifyGuildAsync(const modify_guild_data dataPackage)
Modifies a chosen guild's properties.
static co_routine< void > createGuildBanAsync(const create_guild_ban_data dataPackage)
Bans a guild_member.
static co_routine< ban_data > getGuildBanAsync(const get_guild_ban_data dataPackage)
Collects a single ban from a chosen guild.
static co_routine< guild_widget_image_data > getGuildWidgetImageAsync(const get_guild_widget_image_data dataPackage)
Gets the guild widget image for a particular server.
static co_routine< void > deleteGuildIntegrationAsync(const delete_guild_integration_data dataPackage)
Deletes an integration from a guild.
static guild_cache_data getCachedGuild(const get_guild_data dataPackage)
Collects a guild from the library's cache.
static co_routine< guild_preview_data > getGuildPreviewAsync(const get_guild_preview_data dataPackage)
Acquires the preview data of a chosen guild.
static co_routine< jsonifier::vector< ban_data > > getGuildBansAsync(const get_guild_bans_data dataPackage)
Collects a list of bans from a chosen guild.
static co_routine< guild_template_data > getGuildTemplateAsync(const get_guild_template_data dataPackage)
Gets the guild template from a particular server.
static co_routine< guild_data > createGuildAsync(const create_guild_data dataPackage)
Creates a new guild.
static co_routine< invite_data > getInviteAsync(const get_invite_data dataPackage)
Gets an invite from the discord servers.
static co_routine< guild_template_data > syncGuildTemplateAsync(const sync_guild_template_data dataPackage)
Syncs a guild template.
static co_routine< jsonifier::vector< voice_region_data > > getGuildVoiceRegionsAsync(const get_guild_voice_regions_data dataPackage)
Gets the list of voice regions for a particular server.
static co_routine< guild_template_data > createGuildTemplateAsync(const create_guild_template_data dataPackage)
Creates a guild template.
static co_routine< void > deleteInviteAsync(const delete_invite_data dataPackage)
Deletes an invite from the discord servers.
static co_routine< guild_widget_data > modifyGuildWidgetAsync(const modify_guild_widget_data dataPackage)
Modifies the guild widget for a particular server.
static co_routine< guild_prune_count_data > beginGuildPruneAsync(const begin_guild_prune_data dataPackage)
For performing a pruning of the guild_members of the guild, based on days of inactivity.
A template class representing an object cache.
void erase(mapped_type_new &&key)
Remove an object from the cache using a key.
static role_cache_data getCachedRole(const get_role_data dataPackage)
Collects a given role from the library's cache.
uint64_t id
The snowflake id.
@ Large
Is it a large guild?
@ Unavailable
Unavailable.
@ Widget_enabled
Widget enabled.
@ Premium_Progress_Bar_Enabled
Premium progress bar enabled.
The main namespace for the forward-facing interfaces.
For pruning a number of guild_members from the guild.
snowflake guildId
Guild within which to perform the prune.
jsonifier::string reason
whether 'pruned' is returned, discouraged for large guilds.
For banning a current guild_member_data.
jsonifier::string reason
The reason for the ban.
snowflake guildId
The id of the guild from which to ban the member.
snowflake guildMemberId
The id of the member to be banned.
For creating a guild from a guild template.
jsonifier::string templateCode
code for the desired template to use.
For creating a guild template.
snowflake guildId
Guild within which you wuold like to create the template.
snowflake guildId
The guild you would like to delete.
For deleting a guild integration.
jsonifier::string reason
Reason for deleting the integration.
snowflake guildId
The guild from which to delete the integration from.
snowflake integrationId
The integration's id which we are going to delete.
For deleting a guild template.
snowflake guildId
The guild within which you would like to delete the template.
jsonifier::string templateCode
The template which you would like to delete.
For deleting a single guild invite.
snowflake inviteId
The invite which you would like to delete.
jsonifier::string reason
Reason for deleting the invite.
For collecting a list of guild's that the bot is in.
uint32_t limit
Max number of guilds to return (1 - 200).
snowflake before
Get guilds before this guild id.
snowflake after
Get guilds after this guild id.
For geting a guild's audit logs.
int32_t limit
The maximum number of actions to acquire from the log.
audit_log_event actionType
The action type to acquire audit-logs for.
snowflake guildId
The guiild id for the guild which you wish to query the log of.
snowflake userId
The user_data for whom to look for the actions of.
snowflake before
Entries that preceded a specific audit log entry id.
For getting a single guild ban.
snowflake guildId
The guild from which to collect the ban from.
snowflake userId
The user_data for whom to collect the ban of.
For getting a list of guild bans.
snowflake guildId
The guild from which to collect the list of bans.
snowflake after
consider only users after given user id null.
snowflake before
consider only users before given user id.
uint64_t limit
Number of users to return ( up to maximum 1000 ).
For getting a guild from the library's cache or a discord server.
snowflake guildId
The id of the guild to acquire.
For geting all of the current invites from a guild.
snowflake guildId
The id of the guild you wish to acquire.
For acquiring a guild preview of a chosen guild.
snowflake guildId
The id of the guild's preview to acquire.
For collecting the guild prune count.
snowflake guildId
The guild to be pruned.
int32_t days
The number of days beyond which to prune the user's for inactivity.
jsonifier::vector< snowflake > includeRoles
Roles to be included in the prune.
For collecting a guild's template.
jsonifier::string templateCode
code for the desired template.
For collecting a list of guild templates from a chosen guild.
snowflake guildId
Guild from which you would like to collect the templates from.
For geting the vanity invite responseData of a guild.
snowflake guildId
The id of the guild to acquire the vanity invite from.
For collecting a list of guild voice regions.
snowflake guildId
The guild for which to collect the voice regions from.
For collecting a guild's welcome screen.
snowflake guildId
The guild for which to collect the widget image from.
For geting a single invite's responseData from a guild.
snowflake guildScheduledEventId
The guild scheduled event to include with the invite.
snowflake inviteId
The id of the invite you wish to acquire.
bool withCount
collect usage etc counts?
bool withExpiration
collect expiration time/date?
Data representing a single guild preview.
Represents a guild template.
For leaving a particular guild.
snowflake guildId
The id of the guild you would like the bot to leave.
For modifying the properties of a chosen guild.
snowflake guildId
snowflake of the chosen guild to modify.
jsonifier::vector< jsonifier::string > features
Array of guild feature strings enabled guild features.
system_channel_flags systemChannelFlags
System channel_data flags.
snowflake systemChannelId
base64 16 : 9 png / jpeg image for the guild discovery splash(when the server has the discoverable fe...
jsonifier::string name
Desired name of the guild.
verification_level verificationLevel
Verification level.
snowflake afkChannelId
snowflake for afk channels.
snowflake ownerId
User_data id to transfer guild ownership to (must be owner).
jsonifier::string reason
Reason for modifying the guild.
jsonifier::string description
The description for the guild, if the guild is discoverable.
explicit_content_filter_level explicitContentFilter
Explicit content filter level.
snowflake rulesChannelId
The id of the channel_data where community guilds display rules and /or guidelines.
bool premiumProgressBarEnabled
Whether or not the progress bar is enabled.
jsonifier::string preferredLocale
The preferred locale of a community guild used in server discovery.
default_message_notification_level defaultMessageNotifications
Default message notification level.
snowflake publicUpdatesChannelId
The id of the channel_data where admins and moderators of community guilds receive notices from disco...
For modifying a guild template.
snowflake guildId
Guild within which you would like to modify the template.
For modifying a guild's welcome screen.
jsonifier::string reason
The reason for modifying the welcome screen.
snowflake guildId
The guild for which to modify the welcome screen of.
For removing a previous created ban.
jsonifier::string reason
The reason for removing this ban.
snowflake guildId
The guild from which to erase the ban.
snowflake userId
The user snowflake of the user who's ban to erase.
For syncing a guild template.
snowflake guildId
Guild for which you would like to sync the template of.
jsonifier::string templateCode
Template code for which template you would like to sync.