DiscordCoreAPI
A Discord bot library written in C++, with custom asynchronous coroutines.
Loading...
Searching...
No Matches
GuildEntities.cpp
Go to the documentation of this file.
1/*
2 DiscordCoreAPI, A bot library for Discord, written in C++, and featuring explicit multithreading through the usage of custom, asynchronous C++ CoRoutines.
3
4 Copyright 2021, 2022, 2023 Chris M. (RealTimeChris)
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
10
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public
17 License along with this library; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
19 USA
20*/
21/// GuildEntities.hpp - Header for the Guild classes and structs.
22/// May 12, 2021
23/// https://discordcoreapi.com
24/// \file GuildEntities.cpp
25
34
35namespace Jsonifier {
36
37 template<> struct Core<DiscordCoreAPI::CreateGuildData> {
38 using ValueType = DiscordCoreAPI::CreateGuildData;
39 static constexpr auto parseValue = object("default_message_notifications", &ValueType::defaultMessageNotifications, "explicit_content_filter",
40 &ValueType::explicitContentFilter, "system_channel_flags", &ValueType::systemChannelFlags, "verification_level",
41 &ValueType::verificationLevel, "afk_timeout", &ValueType::afkTimeout, "region", &ValueType::region, "name", &ValueType::name, "icon",
42 "channels", &ValueType::channels, "system_channel_id", &ValueType::systemChannelId, "roles", &ValueType::roles, "afk_channel_id",
43 &ValueType::afkChannelId);
44 };
45
46 template<> struct Core<DiscordCoreAPI::ModifyGuildData> {
47 using ValueType = DiscordCoreAPI::ModifyGuildData;
48 static constexpr auto parseValue = object("default_message_notifications", &ValueType::defaultMessageNotifications, "explicit_content_filter",
49 &ValueType::explicitContentFilter, "system_channel_flags", &ValueType::systemChannelFlags, "verification_level",
50 &ValueType::verificationLevel, "features", &ValueType::features, "public_updates_channel_id", &ValueType::publicUpdatesChannelId,
51 "afk_timeout", &ValueType::afkTimeout, "preferred_locale", &ValueType::preferredLocale, "discovery_splash", &ValueType::discoverySplash,
52 "system_channel_id", &ValueType::systemChannelId, "rules_channel_id", &ValueType::rulesChannelId, "description", &ValueType::description,
53 "afk_channel_id", &ValueType::afkChannelId, "banner", &ValueType::banner, "splash", &ValueType::splash, "reason", &ValueType::reason,
54 "owner_id", &ValueType::ownerId, "guild_id", &ValueType::guildId, "icon", &ValueType::icon, "name", &ValueType::name);
55 };
56
57 template<> struct Core<DiscordCoreAPI::CreateGuildBanData> {
58 using ValueType = DiscordCoreAPI::CreateGuildBanData;
59 static constexpr auto parseValue = object("delete_message_days", &ValueType::deleteMessageDays, "member", &ValueType::guildMemberId, "reason",
60 &ValueType::reason, "guild_id", &ValueType::guildId);
61 };
62
63 template<> struct Core<DiscordCoreAPI::ModifyGuildWelcomeScreenData> {
65 static constexpr auto parseValue = object("welcome_channels", &ValueType::welcomeChannels, "description", &ValueType::description, "guild_id",
66 &ValueType::guildId, "enabled", &ValueType::enabled, "reason", &ValueType::reason);
67 };
68
69 template<> struct Core<DiscordCoreAPI::GetGuildPruneCountData> {
71 static constexpr auto parseValue =
72 object("include_roles", &ValueType::includeRoles, "guild_id", &ValueType::guildId, "days", &ValueType::days);
73 };
74
75 template<> struct Core<DiscordCoreAPI::BeginGuildPruneData> {
77 static constexpr auto parseValue = object("include_roles", &ValueType::includeRoles, "compute_prune_count", &ValueType::computePruneCount,
78 "reason", &ValueType::reason, "guild_id", &ValueType::guildId, "days", &ValueType::days);
79 };
80
81 template<> struct Core<DiscordCoreAPI::ModifyGuildTemplateData> {
83 static constexpr auto parseValue = object("template_code", &ValueType::templateCode, "description", &ValueType::description, "guild_id",
84 &ValueType::guildId, "name", &ValueType::name);
85 };
86
87 template<> struct Core<DiscordCoreAPI::CreateGuildTemplateData> {
89 static constexpr auto parseValue = object("description", &ValueType::description, "guild_id", &ValueType::guildId, "name", &ValueType::name);
90 };
91
92 template<> struct Core<DiscordCoreAPI::CreateGuildFromGuildTemplateData> {
94 static constexpr auto parseValue =
95 object("template_code", &ValueType::templateCode, "image_data", &ValueType::imageData, "name", &ValueType::name);
96 };
97
98 template<> struct Core<DiscordCoreAPI::ModifyGuildWidgetData> {
100 static constexpr auto parseValue =
101 object("widget_data", &ValueType::widgetData, "reason", &ValueType::reason, "guild_id", &ValueType::guildId);
102 };
103
104
105}
106
107namespace DiscordCoreAPI {
108
109 Guild& Guild::operator=(GuildData&& other) noexcept {
110 if (this != &other) {
111 voiceConnectionPtr = other.voiceConnectionPtr;
112 discordCoreClient = other.discordCoreClient;
113 for (auto& value: other.channels) {
114 Channel data{};
115 data.id = value;
116 channels.emplace_back(std::move(data));
117 }
118 for (auto& value: other.members) {
119 GuildMember data{};
120 data.guildId = id;
121 data.user.id = value;
122 members.emplace_back(std::move(data));
123 }
124 for (auto& value: other.roles) {
125 Role data{};
126 data.id = value;
127 roles.emplace_back(std::move(data));
128 }
129 for (auto& value: other.emoji) {
130 EmojiData data{};
131 data.id = value;
132 emoji.emplace_back(std::move(data));
133 }
134 for (auto& value: other.guildScheduledEvents) {
135 GuildScheduledEvent data{};
136 data.id = value;
137 guildScheduledEvents.emplace_back(std::move(data));
138 }
139 for (auto& value: other.presences) {
140 PresenceUpdateData data{};
141 data.user.id = value.user.id;
142 presences.emplace(data.user.id, std::move(data));
143 }
144 for (auto& value: other.stageInstances) {
145 StageInstance data{};
146 data.id = value;
147 stageInstances.emplace_back(std::move(data));
148 }
149 for (auto& value: other.stickers) {
150 Sticker data{};
151 data.id = value;
152 stickers.emplace_back(std::move(data));
153 }
154 for (auto& value: other.threads) {
155 Thread data{};
156 data.id = value;
157 threads.emplace_back(std::move(data));
158 }
159 joinedAt = std::move(other.joinedAt);
160 ownerId = std::move(other.ownerId);
161 memberCount = other.memberCount;
162 icon = std::move(other.icon);
163 name = std::move(other.name);
164 flags = other.flags;
165 id = other.id;
166 }
167 return *this;
168 }
169
170 Guild::Guild(GuildData&& other) noexcept {
171 *this = std::move(other);
172 }
173
174 Guild& Guild::operator=(const GuildData& other) noexcept {
175 if (this != &other) {
176 voiceConnectionPtr = other.voiceConnectionPtr;
177 discordCoreClient = other.discordCoreClient;
178 for (auto& value: other.channels) {
179 Channel data{};
180 data.id = value;
181 channels.emplace_back(data);
182 }
183 for (auto& value: other.members) {
184 GuildMember data{};
185 data.guildId = id;
186 data.user.id = value;
187 members.emplace_back(data);
188 }
189 for (auto& value: other.roles) {
190 Role data{};
191 data.id = value;
192 roles.emplace_back(data);
193 }
194 for (auto& value: other.emoji) {
195 EmojiData data{};
196 data.id = value;
197 emoji.emplace_back(data);
198 }
199 for (auto& value: other.guildScheduledEvents) {
200 GuildScheduledEvent data{};
201 data.id = value;
202 guildScheduledEvents.emplace_back(data);
203 }
204 for (auto& value: other.presences) {
205 PresenceUpdateData data{};
206 data.user.id = value.user.id;
207 presences.emplace(data.user.id, data);
208 }
209 for (auto& value: other.stageInstances) {
210 StageInstance data{};
211 data.id = value;
212 stageInstances.emplace_back(data);
213 }
214 for (auto& value: other.stickers) {
215 Sticker data{};
216 data.id = value;
217 stickers.emplace_back(data);
218 }
219 for (auto& value: other.threads) {
220 Thread data{};
221 data.id = value;
222 threads.emplace_back(data);
223 }
224 memberCount = other.memberCount;
225 joinedAt = other.joinedAt;
226 ownerId = other.ownerId;
227 flags = other.flags;
228 icon = other.icon;
229 name = other.name;
230 id = other.id;
231 }
232 return *this;
233 }
234
235 Guild::Guild(const GuildData& other) noexcept {
236 *this = other;
237 }
238
239 GuildData& GuildData::operator=(GuildCacheData&& other) noexcept {
240 voiceConnectionPtr = other.voiceConnectionPtr;
241 discordCoreClient = other.discordCoreClient;
242 for (auto& value: other.voiceStates) {
243 voiceStates.emplace_back(std::move(value.id));
244 }
245 for (auto& value: other.channels) {
246 Snowflake data{};
247 data = value.id;
248 channels.emplace_back(std::move(data));
249 }
250 for (auto& value: other.members) {
251 members.emplace_back(std::move(value.user.id));
252 }
253 for (auto& value: other.roles) {
254 Snowflake data{};
255 data = value.id;
256 roles.emplace_back(std::move(data));
257 }
258 for (auto& value: other.emoji) {
259 Snowflake data{};
260 data = value.id;
261 emoji.emplace_back(std::move(data));
262 }
263 for (auto& value: other.guildScheduledEvents) {
264 Snowflake data{};
265 data = value.id;
266 guildScheduledEvents.emplace_back(std::move(data));
267 }
268 for (auto& value: other.presences) {
269 PresenceUpdateData data{};
270 data.user.id = value.user.id;
271 presences.emplace_back(std::move(data));
272 }
273 for (auto& value: other.stageInstances) {
274 Snowflake data{};
275 data = value.id;
276 stageInstances.emplace_back(std::move(data));
277 }
278 for (auto& value: other.stickers) {
279 Snowflake data{};
280 data = value.id;
281 stickers.emplace_back(std::move(data));
282 }
283 for (auto& value: other.threads) {
284 Snowflake data{};
285 data = value.id;
286 threads.emplace_back(std::move(data));
287 }
288 joinedAt = std::move(other.joinedAt);
289 ownerId = std::move(other.ownerId);
290 memberCount = other.memberCount;
291 icon = std::move(other.icon);
292 name = std::move(other.name);
293 flags = other.flags;
294 id = other.id;
295 return *this;
296 }
297
298 GuildData::GuildData(GuildCacheData&& other) noexcept {
299 *this = std::move(other);
300 }
301
302 GuildData& GuildData::operator=(const GuildCacheData& other) noexcept {
303 voiceConnectionPtr = other.voiceConnectionPtr;
304 discordCoreClient = other.discordCoreClient;
305 for (auto& value: other.voiceStates) {
306 voiceStates.emplace_back(std::move(value.id));
307 }
308 for (auto& value: other.channels) {
309 Snowflake data{};
310 data = value.id;
311 channels.emplace_back(std::move(data));
312 }
313 for (auto& value: other.members) {
314 members.emplace_back(std::move(value.user.id));
315 }
316 for (auto& value: other.roles) {
317 Snowflake data{};
318 data = value.id;
319 roles.emplace_back(data);
320 }
321 for (auto& value: other.emoji) {
322 Snowflake data{};
323 data = value.id;
324 emoji.emplace_back(data);
325 }
326 for (auto& value: other.guildScheduledEvents) {
327 Snowflake data{};
328 data = value.id;
329 guildScheduledEvents.emplace_back(data);
330 }
331 for (auto& value: other.presences) {
332 PresenceUpdateData data{};
333 data.user.id = value.user.id;
334 presences.emplace_back(data);
335 }
336 for (auto& value: other.stageInstances) {
337 Snowflake data{};
338 data = value.id;
339 stageInstances.emplace_back(data);
340 }
341 for (auto& value: other.stickers) {
342 Snowflake data{};
343 data = value.id;
344 stickers.emplace_back(data);
345 }
346 for (auto& value: other.threads) {
347 Snowflake data{};
348 data = value.id;
349 threads.emplace_back(data);
350 }
351 joinedAt = other.joinedAt;
352 ownerId = other.ownerId;
353 memberCount = other.memberCount;
354 icon = other.icon;
355 name = other.name;
356 flags = other.flags;
357 id = other.id;
358 return *this;
359 }
360
361 GuildData::GuildData(const GuildCacheData& other) noexcept {
362 *this = other;
363 }
364
365 std::string Guild::getDiscoverySplashUrl() noexcept {
366 std::string stringNew{ "https://cdn.discordapp.com/" };
367 stringNew += "discovery-splashes/" + id + "/" + discoverySplash.operator std::string() + ".png";
368 return stringNew;
369 }
370
371 std::string Guild::getBannerUrl() noexcept {
372 std::string stringNew{ "https://cdn.discordapp.com/" };
373 stringNew += "banners/" + id + "/" + banner.operator std::string() + ".png";
374 return stringNew;
375 }
376
377 std::string Guild::getSplashUrl() noexcept {
378 std::string stringNew{ "https://cdn.discordapp.com/" };
379 stringNew += "splashes/" + id + "/" + splash.operator std::string() + ".png";
380 return stringNew;
381 }
382
383 ModifyGuildData::ModifyGuildData(Guild dataPackage) {
384 premiumProgressBarEnabled = getBool<GuildFlags>(dataPackage.flags, GuildFlags::Premium_Progress_Bar_Enabled);
385 defaultMessageNotifications = dataPackage.defaultMessageNotifications;
386 publicUpdatesChannelId = dataPackage.publicUpdatesChannelId;
387 explicitContentFilter = dataPackage.explicitContentFilter;
388 systemChannelFlags = dataPackage.systemChannelFlags;
389 verificationLevel = dataPackage.verificationLevel;
390 preferredLocale = dataPackage.preferredLocale;
391 systemChannelId = dataPackage.systemChannelId;
392 rulesChannelId = dataPackage.rulesChannelId;
393 afkChannelId = dataPackage.afkChannelId;
394 description = dataPackage.description;
395 afkTimeout = dataPackage.afkTimeOut;
396 for (auto& value: dataPackage.features) {
397 features.emplace_back(value);
398 }
399 ownerId = dataPackage.ownerId;
400 guildId = dataPackage.id;
401 name = dataPackage.name;
402 }
403
404 void Guilds::initialize(DiscordCoreInternal::HttpsClient* client, DiscordCoreClient* discordCoreClientNew, ConfigManager* configManagerNew) {
405 Guilds::doWeCacheGuildsBool = configManagerNew->doWeCacheGuilds();
406 Guilds::discordCoreClient = discordCoreClientNew;
407 Guilds::httpsClient = client;
408 }
409
411 DiscordCoreInternal::HttpsWorkloadData workload{ DiscordCoreInternal::HttpsWorkloadType::Get_Guild_Audit_Logs };
412 co_await NewThreadAwaitable<AuditLogData>();
413 workload.workloadClass = DiscordCoreInternal::HttpsWorkloadClass::Get;
414 workload.relativePath = "/guilds/" + dataPackage.guildId + "/audit-logs";
415 if (dataPackage.userId != 0) {
416 workload.relativePath += "?user_id=" + dataPackage.userId;
417 if (std::to_string(static_cast<int32_t>(dataPackage.actionType)) != "") {
418 workload.relativePath += "&action_type=" + std::to_string(static_cast<int32_t>(dataPackage.actionType));
419 }
420 if (dataPackage.limit != 0) {
421 workload.relativePath += "&limit=" + std::to_string(dataPackage.limit);
422 }
423 if (dataPackage.before != 0) {
424 workload.relativePath += "&before=" + dataPackage.before;
425 }
426 } else if (std::to_string(static_cast<int32_t>(dataPackage.actionType)) != "") {
427 workload.relativePath += "?action_type=" + std::to_string(static_cast<int32_t>(dataPackage.actionType));
428 if (dataPackage.limit != 0) {
429 workload.relativePath += "&limit=" + std::to_string(dataPackage.limit);
430 }
431 if (dataPackage.before != 0) {
432 workload.relativePath += "&before=" + dataPackage.before;
433 }
434 } else if (dataPackage.limit != 0) {
435 workload.relativePath += "?limit=" + std::to_string(dataPackage.limit);
436 if (dataPackage.before != 0) {
437 workload.relativePath += "&before=" + dataPackage.before;
438 }
439 } else if (dataPackage.before != 0) {
440 workload.relativePath += "?before=" + dataPackage.before;
441 }
442 workload.callStack = "Guilds::getAuditLogDataAsync()";
443 AuditLogData returnData{};
444 Guilds::httpsClient->submitWorkloadAndGetResult<AuditLogData>(workload, returnData);
445 co_return returnData;
446 }
447
449 DiscordCoreInternal::HttpsWorkloadData workload{ DiscordCoreInternal::HttpsWorkloadType::Post_Guild };
450 co_await NewThreadAwaitable<Guild>();
451 workload.workloadClass = DiscordCoreInternal::HttpsWorkloadClass::Post;
452 workload.relativePath = "/guilds";
453 Jsonifier::JsonifierCore parser{};
454 parser.serializeJson(dataPackage, workload.content);
455 workload.callStack = "Guilds::createGuildAsync()";
456 Guild returnData{};
457 Guilds::httpsClient->submitWorkloadAndGetResult<GuildData>(workload, returnData);
458 returnData.discordCoreClient = Guilds::discordCoreClient;
459 co_return returnData;
460 }
461
463 co_await NewThreadAwaitable<GuildDataVector>();
464 GuildDataVector guildVector{};
465 for (auto& value: Guilds::getCache()) {
466 value.discordCoreClient = Guilds::discordCoreClient;
467 guildVector.emplace_back(value);
468 }
469 co_return guildVector;
470 }
471
473 DiscordCoreInternal::HttpsWorkloadData workload{ DiscordCoreInternal::HttpsWorkloadType::Get_Guild };
474 co_await NewThreadAwaitable<Guild>();
475 workload.workloadClass = DiscordCoreInternal::HttpsWorkloadClass::Get;
476 workload.relativePath = "/guilds/" + dataPackage.guildId + "?with_counts=true";
477 workload.callStack = "Guilds::getGuildAsync()";
478 GuildData data{};
479 Guilds::httpsClient->submitWorkloadAndGetResult<GuildData>(workload, data);
480 if (Guilds::getCache().contains(dataPackage.guildId)) {
481 data = Guilds::getCache().find(dataPackage.guildId);
482 } else {
483 Guilds::insertGuild(std::move(data));
484 }
485 data.discordCoreClient = Guilds::discordCoreClient;
486 co_return data;
487 }
488
490 Guild data{};
491 data.id = dataPackage.guildId;
492 if (!Guilds::getCache().contains(dataPackage.guildId)) {
493 auto guild = Guilds::getGuildAsync({ .guildId = dataPackage.guildId }).get();
494 guild.discordCoreClient = Guilds::discordCoreClient;
495 return guild;
496 } else {
497 return Guilds::getCache().find(dataPackage.guildId);
498 }
499 }
500
502 DiscordCoreInternal::HttpsWorkloadData workload{ DiscordCoreInternal::HttpsWorkloadType::Get_Guild_Preview };
503 co_await NewThreadAwaitable<GuildPreviewData>();
504 workload.workloadClass = DiscordCoreInternal::HttpsWorkloadClass::Get;
505 workload.relativePath = "/guilds/" + dataPackage.guildId + "/preview";
506 workload.callStack = "Guilds::getGuildPreviewAsync()";
507 GuildPreviewData returnData{};
508 Guilds::httpsClient->submitWorkloadAndGetResult<GuildPreviewData>(workload, returnData);
509 co_return returnData;
510 }
511
513 DiscordCoreInternal::HttpsWorkloadData workload{ DiscordCoreInternal::HttpsWorkloadType::Patch_Guild };
514 co_await NewThreadAwaitable<Guild>();
515 workload.workloadClass = DiscordCoreInternal::HttpsWorkloadClass::Patch;
516 workload.relativePath = "/guilds/" + dataPackage.guildId;
517 Jsonifier::JsonifierCore parser{};
518 parser.serializeJson(dataPackage, workload.content);
519 workload.callStack = "Guilds::modifyGuildAsync()";
520 if (dataPackage.reason != "") {
521 workload.headersToInsert["X-Audit-Log-Reason"] = dataPackage.reason;
522 }
523 Guild data{};
524 Guilds::httpsClient->submitWorkloadAndGetResult<GuildData>(workload, data);
525 data.discordCoreClient = Guilds::discordCoreClient;
526 if (Guilds::getCache().contains(dataPackage.guildId)) {
527 data = Guilds::getCache().find(dataPackage.guildId);
528 } else {
529 Guilds::insertGuild(std::move(data));
530 }
531 co_return data;
532 }
533
535 DiscordCoreInternal::HttpsWorkloadData workload{ DiscordCoreInternal::HttpsWorkloadType::Delete_Guild };
536 co_await NewThreadAwaitable<void>();
537 workload.workloadClass = DiscordCoreInternal::HttpsWorkloadClass::Delete;
538 workload.relativePath = "/guilds/" + dataPackage.guildId;
539 workload.callStack = "Guilds::deleteGuildAsync()";
540 Guilds::httpsClient->submitWorkloadAndGetResult<void>(workload);
541 co_return;
542 }
543
545 DiscordCoreInternal::HttpsWorkloadData workload{ DiscordCoreInternal::HttpsWorkloadType::Get_Guild_Bans };
546 co_await NewThreadAwaitable<std::vector<BanData>>();
547 workload.workloadClass = DiscordCoreInternal::HttpsWorkloadClass::Get;
548 workload.relativePath = "/guilds/" + dataPackage.guildId + "/bans";
549 if (dataPackage.after != 0) {
550 workload.relativePath += "?after=" + dataPackage.after;
551 if (dataPackage.before != 0) {
552 workload.relativePath += "&before=" + dataPackage.before;
553 }
554 if (dataPackage.limit != 0) {
555 workload.relativePath += "&limit=" + std::to_string(dataPackage.limit);
556 }
557 } else if (dataPackage.before != 0) {
558 workload.relativePath += "?before=" + dataPackage.before;
559 if (dataPackage.limit != 0) {
560 workload.relativePath += "&limit=" + std::to_string(dataPackage.limit);
561 }
562 } else if (dataPackage.limit != 0) {
563 workload.relativePath += "?limit=" + std::to_string(dataPackage.limit);
564 }
565 workload.callStack = "Guilds::getGuildBansAsync()";
566 BanDataVector returnData{};
567 Guilds::httpsClient->submitWorkloadAndGetResult<BanDataVector>(workload, returnData);
568 co_return returnData;
569 }
570
572 DiscordCoreInternal::HttpsWorkloadData workload{ DiscordCoreInternal::HttpsWorkloadType::Get_Guild_Ban };
573 co_await NewThreadAwaitable<BanData>();
574 workload.workloadClass = DiscordCoreInternal::HttpsWorkloadClass::Get;
575 workload.relativePath = "/guilds/" + dataPackage.guildId + "/bans/" + dataPackage.userId;
576 workload.callStack = "Guilds::getGuildBanAsync()";
577 BanData data{};
578 Guilds::httpsClient->submitWorkloadAndGetResult<BanData>(workload, data);
579 co_return data;
580 }
581
583 DiscordCoreInternal::HttpsWorkloadData workload{ DiscordCoreInternal::HttpsWorkloadType::Put_Guild_Ban };
584 co_await NewThreadAwaitable<void>();
585 workload.workloadClass = DiscordCoreInternal::HttpsWorkloadClass::Put;
586 workload.relativePath = "/guilds/" + dataPackage.guildId + "/bans/" + dataPackage.guildMemberId;
587 Jsonifier::JsonifierCore parser{};
588 parser.serializeJson(dataPackage, workload.content);
589 workload.callStack = "Guilds::createGuildBanAsync()";
590 if (dataPackage.reason != "") {
591 workload.headersToInsert["X-Audit-Log-Reason"] = dataPackage.reason;
592 }
593 Guilds::httpsClient->submitWorkloadAndGetResult<void>(workload);
594 co_return;
595 }
596
598 DiscordCoreInternal::HttpsWorkloadData workload{ DiscordCoreInternal::HttpsWorkloadType::Delete_Guild_Ban };
599 co_await NewThreadAwaitable<void>();
600 workload.workloadClass = DiscordCoreInternal::HttpsWorkloadClass::Delete;
601 workload.relativePath = "/guilds/" + dataPackage.guildId + "/bans/" + dataPackage.userId;
602 workload.callStack = "Guilds::removeGuildBanAsync()";
603 if (dataPackage.reason != "") {
604 workload.headersToInsert["X-Audit-Log-Reason"] = dataPackage.reason;
605 }
606 Guilds::httpsClient->submitWorkloadAndGetResult<void>(workload);
607 co_return;
608 }
609
611 DiscordCoreInternal::HttpsWorkloadData workload{ DiscordCoreInternal::HttpsWorkloadType::Get_Guild_Prune_Count };
612 co_await NewThreadAwaitable<GuildPruneCountData>();
613 workload.workloadClass = DiscordCoreInternal::HttpsWorkloadClass::Get;
614 workload.relativePath = "/guilds/" + dataPackage.guildId + "/prune";
615 workload.callStack = "Guilds::getGuildPruneCountAsync()";
616 if (dataPackage.days != 0) {
617 workload.relativePath += "?days=" + std::to_string(dataPackage.days);
618 if (dataPackage.includeRoles.size() > 0) {
619 workload.relativePath += "&include_roles=";
620 for (int32_t x = 0; x < dataPackage.includeRoles.size(); ++x) {
621 workload.relativePath += dataPackage.includeRoles[x];
622 if (x < dataPackage.includeRoles.size() - 1) {
623 workload.relativePath += ",";
624 }
625 }
626 }
627 } else if (dataPackage.includeRoles.size() > 0) {
628 workload.relativePath += "?include_roles=";
629 for (int32_t x = 0; x < dataPackage.includeRoles.size(); ++x) {
630 workload.relativePath += dataPackage.includeRoles[x];
631 if (x < dataPackage.includeRoles.size() - 1) {
632 workload.relativePath += ",";
633 }
634 }
635 }
636 GuildPruneCountData returnData{};
637 Guilds::httpsClient->submitWorkloadAndGetResult<GuildPruneCountData>(workload, returnData);
638 co_return returnData;
639 }
640
642 DiscordCoreInternal::HttpsWorkloadData workload{ DiscordCoreInternal::HttpsWorkloadType::Post_Guild_Prune };
643 co_await NewThreadAwaitable<GuildPruneCountData>();
644 workload.workloadClass = DiscordCoreInternal::HttpsWorkloadClass::Post;
645 workload.relativePath = "/guilds/" + dataPackage.guildId + "/prune";
646 Jsonifier::JsonifierCore parser{};
647 parser.serializeJson(dataPackage, workload.content);
648 workload.callStack = "Guilds::beginGuildPruneAsync()";
649 if (dataPackage.reason != "") {
650 workload.headersToInsert["X-Audit-Log-Reason"] = dataPackage.reason;
651 }
652 GuildPruneCountData returnData{};
653 Guilds::httpsClient->submitWorkloadAndGetResult<GuildPruneCountData>(workload, returnData);
654 co_return returnData;
655 }
656
658 DiscordCoreInternal::HttpsWorkloadData workload{ DiscordCoreInternal::HttpsWorkloadType::Get_Guild_Voice_Regions };
659 co_await NewThreadAwaitable<std::vector<VoiceRegionData>>();
660 workload.workloadClass = DiscordCoreInternal::HttpsWorkloadClass::Get;
661 workload.relativePath = "/guilds/" + dataPackage.guildId + "/regions";
662 workload.callStack = "Guilds::getGuildVoiceRegionsAsync()";
663 VoiceRegionDataVector returnData{};
664 Guilds::httpsClient->submitWorkloadAndGetResult<VoiceRegionDataVector>(workload, returnData);
665 co_return returnData;
666 }
667
669 DiscordCoreInternal::HttpsWorkloadData workload{ DiscordCoreInternal::HttpsWorkloadType::Get_Guild_Invites };
670 co_await NewThreadAwaitable<std::vector<InviteData>>();
671 workload.workloadClass = DiscordCoreInternal::HttpsWorkloadClass::Get;
672 workload.relativePath = "/guilds/" + dataPackage.guildId + "/invites";
673 workload.callStack = "Guilds::getGuildInvitesAsync()";
674 InviteDataVector returnData{};
675 Guilds::httpsClient->submitWorkloadAndGetResult<InviteDataVector>(workload, returnData);
676 co_return returnData;
677 }
678
680 DiscordCoreInternal::HttpsWorkloadData workload{ DiscordCoreInternal::HttpsWorkloadType::Get_Guild_Integrations };
681 co_await NewThreadAwaitable<std::vector<IntegrationData>>();
682 workload.workloadClass = DiscordCoreInternal::HttpsWorkloadClass::Get;
683 workload.relativePath = "/guilds/" + dataPackage.guildId + "/integrations";
684 workload.callStack = "Guilds::getGuildIntegrationsAsync()";
685 IntegrationDataVector returnData{};
686 Guilds::httpsClient->submitWorkloadAndGetResult<IntegrationDataVector>(workload, returnData);
687 co_return returnData;
688 }
689
691 DiscordCoreInternal::HttpsWorkloadData workload{ DiscordCoreInternal::HttpsWorkloadType::Delete_Guild_Integration };
692 co_await NewThreadAwaitable<void>();
693 workload.workloadClass = DiscordCoreInternal::HttpsWorkloadClass::Delete;
694 workload.relativePath = "/guilds/" + dataPackage.guildId + "/integrations/" + dataPackage.integrationId;
695 workload.callStack = "Guilds::deleteGuildIntegrationAsync()";
696 if (dataPackage.reason != "") {
697 workload.headersToInsert["X-Audit-Log-Reason"] = dataPackage.reason;
698 }
699 Guilds::httpsClient->submitWorkloadAndGetResult<void>(workload);
700 co_return;
701 }
702
704 DiscordCoreInternal::HttpsWorkloadData workload{ DiscordCoreInternal::HttpsWorkloadType::Get_Guild_Widget_Settings };
705 co_await NewThreadAwaitable<GuildWidgetData>();
706 workload.workloadClass = DiscordCoreInternal::HttpsWorkloadClass::Get;
707 workload.relativePath = "/guilds/" + dataPackage.guildId + "/widget";
708 workload.callStack = "Guilds::getGuildWidgetSettingsAsync()";
709 GuildWidgetData returnData{};
710 Guilds::httpsClient->submitWorkloadAndGetResult<GuildWidgetData>(workload, returnData);
711 co_return returnData;
712 }
713
715 DiscordCoreInternal::HttpsWorkloadData workload{ DiscordCoreInternal::HttpsWorkloadType::Patch_Guild_Widget };
716 co_await NewThreadAwaitable<GuildWidgetData>();
717 workload.workloadClass = DiscordCoreInternal::HttpsWorkloadClass::Patch;
718 workload.relativePath = "/guilds/" + dataPackage.guildId + "/widget";
719 Jsonifier::JsonifierCore parser{};
720 parser.serializeJson(dataPackage, workload.content);
721 workload.callStack = "Guilds::modifyGuildWidgetAsync()";
722 if (dataPackage.reason != "") {
723 workload.headersToInsert["X-Audit-Log-Reason"] = dataPackage.reason;
724 }
725 GuildWidgetData returnData{};
726 Guilds::httpsClient->submitWorkloadAndGetResult<GuildWidgetData>(workload, returnData);
727 co_return returnData;
728 }
729
731 DiscordCoreInternal::HttpsWorkloadData workload{ DiscordCoreInternal::HttpsWorkloadType::Get_Guild_Widget };
732 co_await NewThreadAwaitable<GuildWidgetData>();
733 workload.workloadClass = DiscordCoreInternal::HttpsWorkloadClass::Get;
734 workload.relativePath = "/guilds/" + dataPackage.guildId + "/widget.json";
735 workload.callStack = "Guilds::getGuildWidgetAsync()";
736 GuildWidgetData returnData{};
737 Guilds::httpsClient->submitWorkloadAndGetResult<GuildWidgetData>(workload, returnData);
738 co_return returnData;
739 }
740
742 DiscordCoreInternal::HttpsWorkloadData workload{ DiscordCoreInternal::HttpsWorkloadType::Get_Vanity_Invite };
743 co_await NewThreadAwaitable<InviteData>();
744 workload.workloadClass = DiscordCoreInternal::HttpsWorkloadClass::Get;
745 workload.relativePath = "/guilds/" + dataPackage.guildId + "/vanity-url";
746 workload.callStack = "Guilds::getGuildVanityInviteAsync()";
747 InviteData returnData{};
748 Guilds::httpsClient->submitWorkloadAndGetResult<InviteData>(workload, returnData);
749 co_return returnData;
750 }
751
753 DiscordCoreInternal::HttpsWorkloadData workload{ DiscordCoreInternal::HttpsWorkloadType::Get_Guild_Widget_Image };
754 co_await NewThreadAwaitable<GuildWidgetImageData>();
755 workload.workloadClass = DiscordCoreInternal::HttpsWorkloadClass::Get;
756 workload.relativePath = "/guilds/" + dataPackage.guildId + "/widget.png";
757 switch (dataPackage.widgetStlye) {
759 workload.relativePath += "?style=shield";
760 break;
761 }
763 workload.relativePath += "?style=banner1";
764 break;
765 }
767 workload.relativePath += "?style=banner2";
768 break;
769 }
771 workload.relativePath += "?style=banner3";
772 break;
773 }
775 workload.relativePath += "?style=banner4";
776 break;
777 }
778 }
779 workload.callStack = "Guilds::getGuildWidgetImageAsync()";
780 GuildWidgetImageData returnData{};
781 Guilds::httpsClient->submitWorkloadAndGetResult<GuildWidgetImageData>(workload, returnData);
782 co_return returnData;
783 }
784
786 DiscordCoreInternal::HttpsWorkloadData workload{ DiscordCoreInternal::HttpsWorkloadType::Get_Guild_Welcome_Screen };
787 co_await NewThreadAwaitable<WelcomeScreenData>();
788 workload.workloadClass = DiscordCoreInternal::HttpsWorkloadClass::Get;
789 workload.relativePath = "/guilds/" + dataPackage.guildId + "/welcome-screen";
790 workload.callStack = "Guilds::getGuildWelcomeScreenAsync()";
791 WelcomeScreenData returnData{};
792 Guilds::httpsClient->submitWorkloadAndGetResult<WelcomeScreenData>(workload, returnData);
793 co_return returnData;
794 }
795
797 DiscordCoreInternal::HttpsWorkloadData workload{ DiscordCoreInternal::HttpsWorkloadType::Patch_Guild_Welcome_Screen };
798 co_await NewThreadAwaitable<WelcomeScreenData>();
799 workload.workloadClass = DiscordCoreInternal::HttpsWorkloadClass::Patch;
800 workload.relativePath = "/guilds/" + dataPackage.guildId + "/welcome-screen";
801 Jsonifier::JsonifierCore parser{};
802 parser.serializeJson(dataPackage, workload.content);
803 workload.callStack = "Guilds::modifyGuildWelcomeScreenAsync()";
804 if (dataPackage.reason != "") {
805 workload.headersToInsert["X-Audit-Log-Reason"] = dataPackage.reason;
806 }
807 WelcomeScreenData returnData{};
808 Guilds::httpsClient->submitWorkloadAndGetResult<WelcomeScreenData>(workload, returnData);
809 co_return returnData;
810 };
811
813 DiscordCoreInternal::HttpsWorkloadData workload{ DiscordCoreInternal::HttpsWorkloadType::Get_Guild_Template };
814 co_await NewThreadAwaitable<GuildTemplateData>();
815 workload.workloadClass = DiscordCoreInternal::HttpsWorkloadClass::Get;
816 workload.relativePath = "/guilds/templates/" + dataPackage.templateCode;
817 workload.callStack = "Guilds::getGuildTemplateAsync()";
818 GuildTemplateData returnData{};
819 Guilds::httpsClient->submitWorkloadAndGetResult<GuildTemplateData>(workload, returnData);
820 co_return returnData;
821 }
822
824 DiscordCoreInternal::HttpsWorkloadData workload{ DiscordCoreInternal::HttpsWorkloadType::Post_Guild_From_Guild_Template };
825 co_await NewThreadAwaitable<Guild>();
826 workload.workloadClass = DiscordCoreInternal::HttpsWorkloadClass::Post;
827 workload.relativePath = "/guilds/templates/" + dataPackage.templateCode;
828 Jsonifier::JsonifierCore parser{};
829 parser.serializeJson(dataPackage, workload.content);
830 workload.callStack = "Guilds::createGuildFromGuildTemplateAsync()";
831 Guild returnData{};
832 Guilds::httpsClient->submitWorkloadAndGetResult<GuildData>(workload, returnData);
833 returnData.discordCoreClient = Guilds::discordCoreClient;
834 co_return std::move(returnData);
835 }
836
838 DiscordCoreInternal::HttpsWorkloadData workload{ DiscordCoreInternal::HttpsWorkloadType::Get_Guild_Templates };
839 co_await NewThreadAwaitable<std::vector<GuildTemplateData>>();
840 workload.workloadClass = DiscordCoreInternal::HttpsWorkloadClass::Get;
841 workload.relativePath = "/guilds/" + dataPackage.guildId + "/templates";
842 workload.callStack = "Guilds::getGuildTemplatesAsync()";
843 GuildTemplateDataVector returnData{};
844 Guilds::httpsClient->submitWorkloadAndGetResult<GuildTemplateDataVector>(workload, returnData);
845 co_return returnData;
846 }
847
849 DiscordCoreInternal::HttpsWorkloadData workload{ DiscordCoreInternal::HttpsWorkloadType::Post_Guild_Template };
850 co_await NewThreadAwaitable<GuildTemplateData>();
851 workload.workloadClass = DiscordCoreInternal::HttpsWorkloadClass::Post;
852 workload.relativePath = "/guilds/" + dataPackage.guildId + "/templates";
853 Jsonifier::JsonifierCore parser{};
854 parser.serializeJson(dataPackage, workload.content);
855 workload.callStack = "Guilds::createGuildTemplateAsync()";
856 GuildTemplateData returnData{};
857 Guilds::httpsClient->submitWorkloadAndGetResult<GuildTemplateData>(workload, returnData);
858 co_return returnData;
859 }
860
862 DiscordCoreInternal::HttpsWorkloadData workload{ DiscordCoreInternal::HttpsWorkloadType::Put_Guild_Template };
863 co_await NewThreadAwaitable<GuildTemplateData>();
864 workload.workloadClass = DiscordCoreInternal::HttpsWorkloadClass::Put;
865 workload.relativePath = "/guilds/" + dataPackage.guildId + "/templates/" + dataPackage.templateCode;
866 workload.callStack = "Guilds::syncGuildTemplateAsync()";
867 GuildTemplateData returnData{};
868 Guilds::httpsClient->submitWorkloadAndGetResult<GuildTemplateData>(workload, returnData);
869 co_return returnData;
870 }
871
873 DiscordCoreInternal::HttpsWorkloadData workload{ DiscordCoreInternal::HttpsWorkloadType::Patch_Guild_Template };
874 co_await NewThreadAwaitable<GuildTemplateData>();
875 workload.workloadClass = DiscordCoreInternal::HttpsWorkloadClass::Patch;
876 workload.relativePath = "/guilds/" + dataPackage.guildId + "/templates/" + dataPackage.templateCode;
877 Jsonifier::JsonifierCore parser{};
878 parser.serializeJson(dataPackage, workload.content);
879 workload.callStack = "Guilds::modifyGuildTemplateAsync()";
880 GuildTemplateData returnData{};
881 Guilds::httpsClient->submitWorkloadAndGetResult<GuildTemplateData>(workload, returnData);
882 co_return returnData;
883 }
884
886 DiscordCoreInternal::HttpsWorkloadData workload{ DiscordCoreInternal::HttpsWorkloadType::Delete_Guild_Template };
887 co_await NewThreadAwaitable<void>();
888 workload.workloadClass = DiscordCoreInternal::HttpsWorkloadClass::Delete;
889 workload.relativePath = "/guilds/" + dataPackage.guildId + "/templates/" + dataPackage.templateCode;
890 workload.callStack = "Guilds::deleteGuildTemplateAsync()";
891 Guilds::httpsClient->submitWorkloadAndGetResult<void>(workload);
892 co_return;
893 }
894
896 DiscordCoreInternal::HttpsWorkloadData workload{ DiscordCoreInternal::HttpsWorkloadType::Get_Invite };
897 co_await NewThreadAwaitable<InviteData>();
898 workload.workloadClass = DiscordCoreInternal::HttpsWorkloadClass::Get;
899 workload.relativePath = "/invites/" + dataPackage.inviteId;
900 if (dataPackage.withCount) {
901 workload.relativePath += "?with_counts=true";
902 if (dataPackage.withExpiration) {
903 workload.relativePath += "&with_expiration=true";
904 }
905 if (dataPackage.guildScheduledEventId != 0) {
906 workload.relativePath += "&guild_scheduled_event_id=" + dataPackage.guildScheduledEventId;
907 }
908 } else if (dataPackage.withExpiration) {
909 workload.relativePath += "?with_expiration=true";
910 if (dataPackage.guildScheduledEventId != 0) {
911 workload.relativePath += "&guild_scheduled_event_id=" + dataPackage.guildScheduledEventId;
912 }
913 } else if (dataPackage.guildScheduledEventId != 0) {
914 workload.relativePath += "?guild_scheduled_event_id=" + dataPackage.guildScheduledEventId;
915 }
916
917 workload.callStack = "Guilds::getInviteAsync()";
918 InviteData returnData{};
919 Guilds::httpsClient->submitWorkloadAndGetResult<InviteData>(workload, returnData);
920 co_return returnData;
921 }
922
924 DiscordCoreInternal::HttpsWorkloadData workload{ DiscordCoreInternal::HttpsWorkloadType::Delete_Invite };
925 co_await NewThreadAwaitable<void>();
926 workload.workloadClass = DiscordCoreInternal::HttpsWorkloadClass::Delete;
927 workload.relativePath = "/invites/" + dataPackage.inviteId;
928 workload.callStack = "Guilds::deleteInviteAsync()";
929 if (dataPackage.reason != "") {
930 workload.headersToInsert["X-Audit-Log-Reason"] = dataPackage.reason;
931 }
932 Guilds::httpsClient->submitWorkloadAndGetResult<void>(workload);
933 co_return;
934 }
935
937 DiscordCoreInternal::HttpsWorkloadData workload{ DiscordCoreInternal::HttpsWorkloadType::Get_Current_User_Guilds };
938 co_await NewThreadAwaitable<GuildDataVector>();
939 workload.workloadClass = DiscordCoreInternal::HttpsWorkloadClass::Get;
940 workload.relativePath = "/users/@me/guilds";
941 if (dataPackage.after != 0) {
942 workload.relativePath += "?after=" + dataPackage.after;
943 if (dataPackage.before != 0) {
944 workload.relativePath += "&before=" + dataPackage.before;
945 }
946 if (dataPackage.limit != 0) {
947 workload.relativePath += "&limit=" + std::to_string(dataPackage.limit);
948 }
949 } else if (dataPackage.before != 0) {
950 workload.relativePath += "?before=" + dataPackage.before;
951 if (dataPackage.limit != 0) {
952 workload.relativePath += "&limit=" + std::to_string(dataPackage.limit);
953 }
954 } else if (dataPackage.limit != 0) {
955 workload.relativePath += "?limit=" + std::to_string(dataPackage.limit);
956 }
957 workload.callStack = "Users::getCurrentUserGuildsAsync()";
958 GuildDataVector returnData{};
959 Guilds::httpsClient->submitWorkloadAndGetResult<GuildDataVector>(workload, returnData);
960 for (auto& value: returnData) {
961 value.discordCoreClient = Guilds::discordCoreClient;
962 }
963 co_return std::move(returnData);
964 }
965
967 DiscordCoreInternal::HttpsWorkloadData workload{ DiscordCoreInternal::HttpsWorkloadType::Delete_Leave_Guild };
968 co_await NewThreadAwaitable<void>();
969 workload.workloadClass = DiscordCoreInternal::HttpsWorkloadClass::Delete;
970 workload.relativePath = "/users/@me/guilds/" + dataPackage.guildId;
971 workload.callStack = "Guilds::leaveGuildAsync()";
972 Guilds::httpsClient->submitWorkloadAndGetResult<void>(workload);
973 co_return;
974 }
975
976 StopWatch stopWatch{ 5s };
977 void Guilds::insertGuild(const GuildData& guild) {
978 if (guild.id == 0) {
979 return;
980 }
981 if (Guilds::doWeCacheGuilds()) {
982 GuildData newGuild{ guild };
983 newGuild.discordCoreClient = Guilds::discordCoreClient;
984 Guilds::getCache().emplace(std::forward<GuildData>(newGuild));
985
986 if (Guilds::getCache().count() % 1 == 0) {
987 std::cout << "THE GUILD COUNT: " << Guilds::getCache().count() << ", TOTAL TIME: " << stopWatch.totalTimePassed().count()
988 << std::endl;
989 }
990 }
991 }
992
993 void Guilds::insertGuild(GuildData&& guild) {
994 if (guild.id == 0) {
995 return;
996 }
997 if (Guilds::doWeCacheGuilds()) {
998 guild.discordCoreClient = Guilds::discordCoreClient;
999 Guilds::getCache().emplace(std::forward<GuildData>(guild));
1000
1001 if (Guilds::getCache().count() % 1 == 0) {
1002 std::cout << "THE GUILD COUNT: " << Guilds::getCache().count() << ", TOTAL TIME: " << stopWatch.totalTimePassed().count()
1003 << std::endl;
1004 }
1005 }
1006 }
1007
1008 void Guilds::removeGuild(const Snowflake guildId) {
1009 Guilds::getCache().erase(guildId);
1010 };
1011
1012 ObjectCache<Snowflake, GuildData>& Guilds::getCache() {
1013 return Guilds::cache;
1014 }
1015
1016 bool Guilds::doWeCacheGuilds() {
1017 return Guilds::doWeCacheGuildsBool;
1018 }
1019
1020 DiscordCoreInternal::HttpsClient* Guilds::httpsClient{};
1021 DiscordCoreClient* Guilds::discordCoreClient{};
1022 ObjectCache<Snowflake, GuildData> Guilds::cache{};
1023 bool Guilds::doWeCacheGuildsBool{};
1024
1025}
IconHash discoverySplash
Link to the discovery image's splash.
Snowflake id
The identifier "snowflake" of the given entity.
DiscordCoreClient * discordCoreClient
A pointer to the DiscordCoreClient.
IconHash banner
Url to the Guild's banner.
IconHash splash
Url to the Guild's splash.
@ Premium_Progress_Bar_Enabled
Premium progress bar enabled.
The main namespace for this library.
A CoRoutine - representing a potentially asynchronous operation/function.
Definition: CoRoutine.hpp:52
Data representing a single Guild preview.
Data structure representing a single Guild.
Represents a Guild Template.
A discord Guild. Used to connect to/disconnect from voice.
For geting a Guild's audit logs.
Snowflake guildId
The guiild id for the Guild which you wish to query the log of.
Snowflake before
Entries that preceded a specific audit log entry ID.
Snowflake userId
The User for whom to look for the actions of.
AuditLogEvent actionType
The action type to acquire audit-logs for.
int32_t limit
The maximum number of actions to acquire from the log.
For getting a Guild from the library's cache or a Discord server.
Snowflake guildId
The id of the Guild to acquire.
For acquiring a Guild preview of a chosen Guild.
Snowflake guildId
The id of the Guild's preview to acquire.
Snowflake guildId
The Guild you would like to delete.
For getting a list of Guild bans.
Snowflake before
Consider only users before given user id.
Snowflake guildId
The Guild from which to collect the list of bans.
Snowflake after
Consider only users after given user id null.
uint64_t limit
Number of users to return ( up to maximum 1000 ).
For getting a single Guild Ban.
Snowflake guildId
The Guild from which to collect the Ban from.
Snowflake userId
The User for whom to collect the Ban of.
For banning a current GuildMember.
std::string reason
The reason for the ban.
Snowflake guildMemberId
The id of the member to be banned.
Snowflake guildId
The id of the Guild from which to ban the member.
For removing a previous created Ban.
Snowflake guildId
The Guild from which to erase the Ban.
std::string reason
The reason for removing this Ban.
Snowflake userId
The user Snowflake of the user who's ban to erase.
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.
std::vector< Snowflake > includeRoles
Roles to be included in the prune.
For pruning a number of GuildMembers from the Guild.
std::string reason
Whether 'pruned' is returned, discouraged for large guilds.
Snowflake guildId
Guild within which to perform the prune.
For collecting a list of Guild voice regions.
Snowflake guildId
The Guild for which to collect the voice regions from.
For geting all of the current invites from a Guild.
Snowflake guildId
The id of the Guild you wish to acquire.
For deleting a Guild integration.
Snowflake integrationId
The integration's id which we are going to delete.
std::string reason
Reason for deleting the integration.
Snowflake guildId
The Guild from which to delete the integration from.
For collecting a Guild's widget settings.
Snowflake guildId
The Guild from which to collect the widget from.
For modifying a Guild's widget.
Snowflake guildId
The Guild for which to modify the widget of.
std::string reason
Reason for modifying the widget.
For collecting a Guild's widget.
Snowflake guildId
The Guild from which to collect the widget 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 Guild's widget image.
Snowflake guildId
The Guild for which to collect the widget image from.
WidgetStyleOptions widgetStlye
The style of widget image to collect.
For collecting a Guild's welcome screen.
Snowflake guildId
The Guild for which to collect the widget image from.
For modifying a Guild's welcome screen.
Snowflake guildId
The Guild for which to modify the welcome screen of.
std::string reason
The reason for modifying the welcome screen.
For collecting a Guild's template.
std::string templateCode
Code for the desired Template.
For creating a Guild from a Guild template.
std::string templateCode
Code for the desired Template to use.
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 creating a Guild Template.
Snowflake guildId
Guild within which you wuold like to create the template.
For syncing a Guild Template.
Snowflake guildId
Guild for which you would like to sync the template of.
std::string templateCode
Template code for which template you would like to sync.
For modifying a Guild Template.
Snowflake guildId
Guild within which you would like to modify the Template.
For deleting a Guild Template.
Snowflake guildId
The Guild within which you would like to delete the Template.
std::string templateCode
The template which you would like to delete.
For geting a single invite's responseData from a Guild.
Snowflake inviteId
The id of the invite you wish to acquire.
Snowflake guildScheduledEventId
The Guild scheduled event to include with the invite.
bool withExpiration
Collect expiration time/date?
bool withCount
Collect usage etc counts?
For deleting a single Guild Invite.
Snowflake inviteId
The Invite which you would like to delete.
std::string reason
Reason for deleting the Invite.
For collecting a list of Guild's that the Bot is in.
Snowflake before
Get guilds before this Guild ID.
uint32_t limit
Max number of guilds to return (1 - 200).
Snowflake after
Get guilds after this Guild ID.
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.
std::vector< std::string > features
Array of Guild feature strings enabled Guild features.
AfkTimeOutDurations afkTimeout
Afk timeout in seconds.
bool premiumProgressBarEnabled
Whether or not the progress bar is enabled.
std::string name
Desired name of the Guild.
Snowflake afkChannelId
Snowflake for afk channels.
ExplicitContentFilterLevel explicitContentFilter
Explicit content filter level.
Snowflake rulesChannelId
The id of the Channel where Community guilds display rules and /or guidelines.
Snowflake guildId
Snowflake of the chosen Guild to modify.
VerificationLevel verificationLevel
Verification level.
std::string reason
Reason for modifying the Guild.
Snowflake systemChannelId
Base64 16 : 9 png / jpeg image for the Guild discovery splash(when the server has the DISCOVERABLE fe...
std::string preferredLocale
The preferred locale of a Community Guild used in server discovery.
Snowflake publicUpdatesChannelId
The id of the Channel where admins and moderators of Community guilds receive notices from Discord.
std::string description
The description for the Guild, if the Guild is discoverable.
Snowflake ownerId
User id to transfer Guild ownership to (must be owner).
DefaultMessageNotificationLevel defaultMessageNotifications
Default message notification level.
SystemChannelFlags systemChannelFlags
System Channel flags.
static CoRoutine< GuildTemplateData > createGuildTemplateAsync(CreateGuildTemplateData dataPackage)
Creates a Guild Template.
static CoRoutine< void > deleteGuildAsync(DeleteGuildData dataPackage)
Deletes a chosen Guild.
static CoRoutine< GuildTemplateData > syncGuildTemplateAsync(SyncGuildTemplateData dataPackage)
Syncs a Guild Template.
static CoRoutine< GuildDataVector > getCurrentUserGuildsAsync(GetCurrentUserGuildsData dataPackage)
Collects a list of Guilds that the Bot is in.
static CoRoutine< GuildWidgetData > modifyGuildWidgetAsync(ModifyGuildWidgetData dataPackage)
Modifies the Guild widget for a particular server.
static CoRoutine< GuildTemplateData > modifyGuildTemplateAsync(ModifyGuildTemplateData dataPackage)
Modifies a Guild Template.
static CoRoutine< WelcomeScreenData > modifyGuildWelcomeScreenAsync(ModifyGuildWelcomeScreenData dataPackage)
Modifies the Guild welcome screen.
static CoRoutine< WelcomeScreenData > getGuildWelcomeScreenAsync(GetGuildWelcomeScreenData dataPackage)
Gets the Guild welcome screen for a particular server.
static CoRoutine< void > removeGuildBanAsync(RemoveGuildBanData dataPackage)
Removes a previously created ban.
static CoRoutine< std::vector< GuildData > > getAllGuildsAsync()
Returns all of the Guilds that the current bot is in.
static CoRoutine< GuildPruneCountData > getGuildPruneCountAsync(GetGuildPruneCountData dataPackage)
For collecting the Guild prune count.
static CoRoutine< Guild > createGuildFromGuildTemplateAsync(CreateGuildFromGuildTemplateData dataPackage)
Creates a Guild from the Guild Template.
static CoRoutine< std::vector< InviteData > > getGuildInvitesAsync(GetGuildInvitesData dataPackage)
Gets multiple invites from the Discord servers.
static GuildData getCachedGuild(GetGuildData dataPackage)
Collects a Guild from the library's cache.
static CoRoutine< Guild > modifyGuildAsync(ModifyGuildData dataPackage)
Modifies a chosen Guild's properties.
static CoRoutine< InviteData > getGuildVanityInviteAsync(GetGuildVanityInviteData dataPackage)
Gets the vanity invite responseData from a particular server.
static CoRoutine< void > deleteGuildTemplateAsync(DeleteGuildTemplateData dataPackage)
Deletes a Guild Template.
static CoRoutine< void > leaveGuildAsync(LeaveGuildData dataPackage)
Removes the bot from a chosen Guild.
static CoRoutine< BanData > getGuildBanAsync(GetGuildBanData dataPackage)
Collects a single Ban from a chosen Guild.
static CoRoutine< Guild > getGuildAsync(GetGuildData dataPackage)
Collects a Guild from the Discord servers.
static CoRoutine< GuildWidgetImageData > getGuildWidgetImageAsync(GetGuildWidgetImageData dataPackage)
Gets the Guild widget image for a particular server.
static CoRoutine< std::vector< IntegrationData > > getGuildIntegrationsAsync(GetGuildIntegrationsData dataPackage)
Gets the list of Guild integrations for a particular server.
static CoRoutine< InviteData > getInviteAsync(GetInviteData dataPackage)
Gets an invite from the Discord servers.
static CoRoutine< std::vector< VoiceRegionData > > getGuildVoiceRegionsAsync(GetGuildVoiceRegionsData dataPackage)
Gets the list of voice regions for a particular server.
static CoRoutine< std::vector< GuildTemplateData > > getGuildTemplatesAsync(GetGuildTemplatesData dataPackage)
Collects a list of Guild Templates from a chosen Guild.
static CoRoutine< std::vector< BanData > > getGuildBansAsync(GetGuildBansData dataPackage)
Collects a list of Bans from a chosen Guild.
static CoRoutine< GuildPruneCountData > beginGuildPruneAsync(BeginGuildPruneData dataPackage)
For performing a pruning of the GuildMembers of the Guild, based on days of inactivity.
static CoRoutine< void > deleteInviteAsync(DeleteInviteData dataPackage)
Deletes an invite from the Discord servers.
static CoRoutine< GuildWidgetData > getGuildWidgetSettingsAsync(GetGuildWidgetSettingsData dataPackage)
Gets the Guild widget's settings for a particular server.
static CoRoutine< GuildTemplateData > getGuildTemplateAsync(GetGuildTemplateData dataPackage)
Gets the Guild Template from a particular server.
static CoRoutine< GuildPreviewData > getGuildPreviewAsync(GetGuildPreviewData dataPackage)
Acquires the preview Data of a chosen Guild.
static CoRoutine< GuildWidgetData > getGuildWidgetAsync(GetGuildWidgetData dataPackage)
Gets the Guild widget for a particular server.
static CoRoutine< AuditLogData > getGuildAuditLogsAsync(GetGuildAuditLogsData dataPackage)
Gets an audit log from the Discord servers.
static CoRoutine< Guild > createGuildAsync(CreateGuildData dataPackage)
Creates a new Guild.
static CoRoutine< void > deleteGuildIntegrationAsync(DeleteGuildIntegrationData dataPackage)
Deletes an integration from a Guild.
static CoRoutine< void > createGuildBanAsync(CreateGuildBanData dataPackage)
Bans a GuildMember.