DiscordCoreAPI
A Discord bot library written in C++, with custom asynchronous coroutines.
Loading...
Searching...
No Matches
ChannelEntities.cpp
Go to the documentation of this file.
1/*
2 MIT License
3
4 DiscordCoreAPI, A bot library for Discord, written in C++, and featuring explicit multithreading through the usage of custom, asynchronous C++ CoRoutines.
5
6 Copyright 2022, 2023 Chris M. (RealTimeChris)
7
8 Permission is hereby granted, free of charge, to any person obtaining a copy
9 of this software and associated documentation files (the "Software"), to deal
10 in the Software without restriction, including without limitation the rights
11 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 copies of the Software, and to permit persons to whom the Software is
13 furnished to do so, subject to the following conditions:
14
15 The above copyright notice and this permission notice shall be included in all
16 copies or substantial portions of the Software.
17
18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 SOFTWARE.
25*/
26/// ChannelEntities.cpp - Source file for the classes related classes and structs.
27/// May 13, 2021
28/// https://discordcoreapi.com
29/// \file ChannelEntities.cpp
30
34
35namespace jsonifier {
36
37 template<> struct core<DiscordCoreAPI::EditChannelPermissionOverwritesData> {
39 static constexpr auto parseValue = objectVal("allow", &ValueType::allow, "deny", &ValueType::deny, "channel_id", &ValueType::channelId, "reason", &ValueType::reason,
40 "type", &ValueType::type, "id", &ValueType::roleOrUserId);
41 };
42
43 template<> struct core<DiscordCoreAPI::CreateChannelInviteData> {
45 static constexpr auto parseValue = objectVal("channel_id", &ValueType::channelId, "max_uses", &ValueType::maxUses, "max_age", &ValueType::maxAge, "temporary",
46 &ValueType::temporary, "unique", &ValueType::unique, "target_type", &ValueType::targetType, "target_user_id", &ValueType::targetUserId, "target_application_id",
47 &ValueType::targetApplicationId, "reason", &ValueType::reason);
48 };
49
50 template<> struct core<DiscordCoreAPI::CreateGuildChannelData> {
52 static constexpr auto parseValue = objectVal("name", &ValueType::name, "type", &ValueType::type, "position", &ValueType::position, "parent_id", &ValueType::parentId,
53 "permission_overwrites", &ValueType::permissionOverwrites, "nsfw", &ValueType::nsfw, "rate_limit_per_user", &ValueType::rateLimitPerUser, "topic", &ValueType::topic,
54 "user_limit", &ValueType::userLimit, "bitrate", &ValueType::bitrate, "default_auto_archive_duration", &ValueType::defaultAutoArchiveDuration, "guild_id",
55 &ValueType::guildId, "reason", &ValueType::reason);
56 };
57
58 template<> struct core<DiscordCoreAPI::ModifyGuildChannelPositionData> {
60 static constexpr auto parseValue =
61 objectVal("id", &ValueType::id, "position", &ValueType::position, "parent_id", &ValueType::parentId, "lock_permissions", &ValueType::lockPermissions);
62 };
63
64 template<> struct core<DiscordCoreAPI::ModifyGuildChannelPositionsData> {
66 static constexpr auto parseValue = arrayVal(&ValueType::modifyChannelData);
67 };
68
69 template<> struct core<DiscordCoreAPI::ModifyChannelData> {
70 using ValueType = DiscordCoreAPI::ModifyChannelData;
71 static constexpr auto parseValue = objectVal("channel_id", &ValueType::channelId, "channel_data", &ValueType::channelData, "reason", &ValueType::reason);
72 };
73
74 template<> struct core<DiscordCoreAPI::CreateDMChannelData> {
76 static constexpr auto parseValue = objectVal("user_id", &ValueType::userId);
77 };
78
79 template<> struct core<DiscordCoreAPI::FollowNewsChannelData> {
81 static constexpr auto parseValue = objectVal("channel_id", &ValueType::channelId, "target_channel_id", &ValueType::targetChannelId);
82 };
83
84 template<> struct core<DiscordCoreAPI::UpdateChannelData> {
85 using ValueType = DiscordCoreAPI::UpdateChannelData;
86 static constexpr auto parseValue = objectVal("permission_overwrites", &ValueType::permissionOverwrites, "default_auto_archive_duration",
87 &ValueType::defaultAutoArchiveDuration, "video_quality_mode", &ValueType::videoQualityMode, "rate_limit_per_user", &ValueType::rateLimitPerUser, "bitrate",
88 &ValueType::bitrate, "parent_id", &ValueType::parentId, "rtc_region", &ValueType::rtcRgion, "user_limit", &ValueType::userLimit, "topic", &ValueType::topic, "position",
89 &ValueType::position, "type", &ValueType::type, "name", &ValueType::name, "nsfw", &ValueType::nsfw);
90 };
91}
92
93namespace DiscordCoreAPI {
94
95 ChannelData::ChannelData(Snowflake newId) {
96 id = newId;
97 }
98
99 ChannelCacheData& ChannelCacheData::operator=(const ChannelData& other) {
100 if (other.permissionOverwrites.size() > 0) {
101 permissionOverwrites = other.permissionOverwrites;
102 }
103 setFlagValue(ChannelFlags::Managed, other.managed);
104 setFlagValue(ChannelFlags::NSFW, other.nsfw);
105 if (static_cast<int64_t>(other.flags) != 0) {
106 flags = other.flags;
107 }
108 if (other.memberCount != 0) {
109 memberCount = other.memberCount;
110 }
111 if (other.parentId != 0) {
112 parentId = other.parentId;
113 }
114 if (other.position != 0) {
115 position = other.position;
116 }
117 if (other.guildId != 0) {
118 guildId = other.guildId;
119 }
120 if (other.ownerId != 0) {
121 ownerId = other.ownerId;
122 }
123 if (other.topic != "") {
124 topic = other.topic;
125 }
126 if (other.name != "") {
127 name = other.name;
128 }
129 if (other.id != 0) {
130 id = other.id;
131 }
132 type = other.type;
133 return *this;
134 }
135
136 ChannelCacheData::ChannelCacheData(const ChannelData& other) {
137 *this = other;
138 }
139
140 ChannelCacheData& ChannelCacheData::operator=(ChannelData&& other) {
141 if (other.permissionOverwrites.size() > 0) {
142 permissionOverwrites = std::move(other.permissionOverwrites);
143 }
144 setFlagValue(ChannelFlags::Managed, other.managed);
145 setFlagValue(ChannelFlags::NSFW, other.nsfw);
146 if (static_cast<int64_t>(other.flags) != 0) {
147 flags = other.flags;
148 }
149 if (other.memberCount != 0) {
150 memberCount = other.memberCount;
151 }
152 if (other.topic != "") {
153 topic = std::move(other.topic);
154 }
155 if (other.name != "") {
156 name = std::move(other.name);
157 }
158 if (other.parentId != 0) {
159 parentId = other.parentId;
160 }
161 if (other.position != 0) {
162 position = other.position;
163 }
164 if (other.guildId != 0) {
165 guildId = other.guildId;
166 }
167 if (other.ownerId != 0) {
168 ownerId = other.ownerId;
169 }
170 if (other.id != 0) {
171 id = other.id;
172 }
173 type = other.type;
174 return *this;
175 }
176
177 ChannelCacheData::operator ChannelData() {
178 ChannelData returnData{};
179 returnData.managed = getFlagValue(ChannelFlags::Managed);
180 returnData.permissionOverwrites = permissionOverwrites;
181 returnData.nsfw = getFlagValue(ChannelFlags::NSFW);
182 returnData.topic = topic.operator std::string();
183 returnData.name = name.operator std::string();
184 returnData.memberCount = memberCount;
185 returnData.parentId = parentId;
186 returnData.position = position;
187 returnData.guildId = guildId;
188 returnData.ownerId = ownerId;
189 returnData.flags = flags;
190 returnData.type = type;
191 returnData.id = id;
192 return returnData;
193 }
194
195 ChannelCacheData::ChannelCacheData(ChannelData&& other) {
196 *this = std::move(other);
197 }
198
199 std::string ChannelData::getIconUrl() {
200 std::string stringNew{ "https://cdn.discordapp.com/" };
201 stringNew += "splashes/" + id.operator std::string() + "/" + icon + ".png";
202 return stringNew;
203 }
204
205 ModifyChannelData::ModifyChannelData(ChannelData newData) {
206 channelData.permissionOverwrites = newData.permissionOverwrites;
207 channelData.nsfw = newData.getFlagValue(ChannelFlags::NSFW);
208 channelData.rateLimitPerUser = newData.rateLimitPerUser;
209 channelData.userLimit = newData.userLimit;
210 channelData.rtcRgion = newData.rtcRegion;
211 channelData.position = newData.position;
212 channelData.parentId = newData.parentId;
213 channelData.topic = newData.topic;
214 channelData.name = newData.name;
215 channelData.type = newData.type;
216 };
217
218 void Channels::initialize(DiscordCoreInternal::HttpsClient* client, ConfigManager* configManagerNew) {
219 Channels::doWeCacheChannelsBool = configManagerNew->doWeCacheChannels();
220 Channels::httpsClient = client;
221 }
222
224 DiscordCoreInternal::HttpsWorkloadData workload{ DiscordCoreInternal::HttpsWorkloadType::Get_Channel };
225 co_await NewThreadAwaitable<ChannelData>();
226 workload.workloadClass = DiscordCoreInternal::HttpsWorkloadClass::Get;
227 workload.relativePath = "/channels/" + dataPackage.channelId;
228 workload.callStack = "Channels::getChannelAsync()";
229 ChannelData data{ dataPackage.channelId };
230 if (cache.contains(data.id)) {
231 data = cache[data.id];
232 }
233 Channels::httpsClient->submitWorkloadAndGetResult(std::move(workload), data);
234 if (doWeCacheChannelsBool) {
235 insertChannel(static_cast<ChannelCacheData>(data));
236 }
237 co_return data;
238 }
239
241 ChannelData data{ dataPackage.channelId };
242 if (!Channels::cache.contains(data.id)) {
243 return Channels::getChannelAsync(dataPackage).get();
244 } else {
245 return cache[data.id];
246 }
247 }
248
250 DiscordCoreInternal::HttpsWorkloadData workload{ DiscordCoreInternal::HttpsWorkloadType::Patch_Channel };
251 co_await NewThreadAwaitable<ChannelData>();
252 workload.workloadClass = DiscordCoreInternal::HttpsWorkloadClass::Patch;
253 workload.relativePath = "/channels/" + dataPackage.channelId;
254 parser.serializeJson(dataPackage, workload.content);
255 workload.callStack = "Channels::modifyChannelAsync()";
256 if (dataPackage.reason != "") {
257 workload.headersToInsert["X-Audit-Log-Reason"] = dataPackage.reason;
258 }
259 ChannelData data{ dataPackage.channelId };
260 if (cache.contains(data.id)) {
261 data = cache[data.id];
262 }
263 Channels::httpsClient->submitWorkloadAndGetResult(std::move(workload), data);
264 if (doWeCacheChannelsBool) {
265 insertChannel(static_cast<ChannelCacheData>(data));
266 }
267 co_return data;
268 }
269
271 DiscordCoreInternal::HttpsWorkloadData workload{ DiscordCoreInternal::HttpsWorkloadType::Delete_Channel };
272 co_await NewThreadAwaitable<void>();
273 workload.workloadClass = DiscordCoreInternal::HttpsWorkloadClass::Delete;
274 workload.relativePath = "/channels/" + dataPackage.channelId;
275 workload.callStack = "Channels::deleteOrCloseAChannelAsync()";
276 if (dataPackage.reason != "") {
277 workload.headersToInsert["X-Audit-Log-Reason"] = dataPackage.reason;
278 }
279 Channels::httpsClient->submitWorkloadAndGetResult(std::move(workload));
280 co_return;
281 }
282
284 DiscordCoreInternal::HttpsWorkloadData workload{ DiscordCoreInternal::HttpsWorkloadType::Put_Channel_Permission_Overwrites };
285 co_await NewThreadAwaitable<void>();
286 workload.workloadClass = DiscordCoreInternal::HttpsWorkloadClass::Put;
287 workload.relativePath = "/channels/" + dataPackage.channelId + "/permissions/" + dataPackage.roleOrUserId;
288 parser.serializeJson(dataPackage, workload.content);
289 workload.callStack = "Channels::editChannelPermissionOverwritesAsync()";
290 if (dataPackage.reason != "") {
291 workload.headersToInsert["X-Audit-Log-Reason"] = dataPackage.reason;
292 }
293 Channels::httpsClient->submitWorkloadAndGetResult(std::move(workload));
294 co_return;
295 }
296
298 DiscordCoreInternal::HttpsWorkloadData workload{ DiscordCoreInternal::HttpsWorkloadType::Get_Channel_Invites };
299 co_await NewThreadAwaitable<jsonifier::vector<InviteData>>();
300 workload.workloadClass = DiscordCoreInternal::HttpsWorkloadClass::Get;
301 workload.relativePath = "/channels/" + dataPackage.channelId + "/invites";
302 workload.callStack = "Channels::getChannelInvitesAsync()";
303 jsonifier::vector<InviteData> returnData{};
304 Channels::httpsClient->submitWorkloadAndGetResult(std::move(workload), returnData);
305 co_return returnData;
306 }
307
309 DiscordCoreInternal::HttpsWorkloadData workload{ DiscordCoreInternal::HttpsWorkloadType::Post_Channel_Invite };
310 co_await NewThreadAwaitable<InviteData>();
311 workload.workloadClass = DiscordCoreInternal::HttpsWorkloadClass::Post;
312 workload.relativePath = "/channels/" + dataPackage.channelId + "/invites";
313 parser.serializeJson(dataPackage, workload.content);
314 workload.callStack = "Channels::createChannelInviteAsync()";
315 if (dataPackage.reason != "") {
316 workload.headersToInsert["X-Audit-Log-Reason"] = dataPackage.reason;
317 }
318 InviteData returnData{};
319 Channels::httpsClient->submitWorkloadAndGetResult(std::move(workload), returnData);
320 co_return returnData;
321 }
322
324 DiscordCoreInternal::HttpsWorkloadData workload{ DiscordCoreInternal::HttpsWorkloadType::Delete_Channel_Permission_Overwrites };
325 co_await NewThreadAwaitable<void>();
326 workload.workloadClass = DiscordCoreInternal::HttpsWorkloadClass::Delete;
327 workload.relativePath = "/channels/" + dataPackage.channelId + "/permissions/" + dataPackage.roleOrUserId;
328 workload.callStack = "Channels::deleteChannelPermissionOverwritesAsync()";
329 if (dataPackage.reason != "") {
330 workload.headersToInsert["X-Audit-Log-Reason"] = dataPackage.reason;
331 }
332 Channels::httpsClient->submitWorkloadAndGetResult(std::move(workload));
333 co_return;
334 }
335
337 DiscordCoreInternal::HttpsWorkloadData workload{ DiscordCoreInternal::HttpsWorkloadType::Post_Follow_News_Channel };
338 co_await NewThreadAwaitable<ChannelData>();
339 workload.workloadClass = DiscordCoreInternal::HttpsWorkloadClass::Post;
340 workload.relativePath = "/channels/" + dataPackage.channelId + "/followers";
341 parser.serializeJson(dataPackage, workload.content);
342 workload.callStack = "Channels::followNewsChannelAsync()";
343 ChannelData returnData{};
344 Channels::httpsClient->submitWorkloadAndGetResult(std::move(workload), returnData);
345 co_return returnData;
346 }
347
349 DiscordCoreInternal::HttpsWorkloadData workload{ DiscordCoreInternal::HttpsWorkloadType::Post_Trigger_Typing_Indicator };
350 co_await NewThreadAwaitable<void>();
351 workload.workloadClass = DiscordCoreInternal::HttpsWorkloadClass::Post;
352 workload.relativePath = "/channels/" + dataPackage.channelId + "/typing";
353 workload.callStack = "Channels::triggerTypingIndicatorAsync()";
354 Channels::httpsClient->submitWorkloadAndGetResult(std::move(workload));
355 co_return;
356 }
357
359 DiscordCoreInternal::HttpsWorkloadData workload{ DiscordCoreInternal::HttpsWorkloadType::Get_Guild_Channels };
360 co_await NewThreadAwaitable<jsonifier::vector<ChannelData>>();
361 workload.workloadClass = DiscordCoreInternal::HttpsWorkloadClass::Get;
362 workload.relativePath = "/guilds/" + dataPackage.guildId + "/channels";
363 workload.callStack = "Channels::getGuildChannelsAsync()";
364 jsonifier::vector<ChannelData> returnData{};
365 Channels::httpsClient->submitWorkloadAndGetResult(std::move(workload), returnData);
366 co_return returnData;
367 }
368
370 DiscordCoreInternal::HttpsWorkloadData workload{ DiscordCoreInternal::HttpsWorkloadType::Post_Guild_Channel };
371 co_await NewThreadAwaitable<ChannelData>();
372 workload.workloadClass = DiscordCoreInternal::HttpsWorkloadClass::Post;
373 workload.relativePath = "/guilds/" + dataPackage.guildId + "/channels";
374 parser.serializeJson(dataPackage, workload.content);
375 workload.callStack = "Channels::createGuildChannelAsync()";
376 if (dataPackage.reason != "") {
377 workload.headersToInsert["X-Audit-Log-Reason"] = dataPackage.reason;
378 }
379 ChannelData returnData{};
380 Channels::httpsClient->submitWorkloadAndGetResult(std::move(workload), returnData);
381 co_return returnData;
382 }
383
385 DiscordCoreInternal::HttpsWorkloadData workload{ DiscordCoreInternal::HttpsWorkloadType::Patch_Guild_Channel_Positions };
386 co_await NewThreadAwaitable<void>();
387 workload.workloadClass = DiscordCoreInternal::HttpsWorkloadClass::Patch;
388 workload.relativePath = "/guilds/" + dataPackage.guildId + "/channels";
389 parser.serializeJson(dataPackage, workload.content);
390 workload.callStack = "Channels::modifyGuildChannelPositionsAsync()";
391 if (dataPackage.reason != "") {
392 workload.headersToInsert["X-Audit-Log-Reason"] = dataPackage.reason;
393 }
394 Channels::httpsClient->submitWorkloadAndGetResult(std::move(workload));
395 co_return;
396 }
397
399 DiscordCoreInternal::HttpsWorkloadData workload{ DiscordCoreInternal::HttpsWorkloadType::Post_Create_User_Dm };
400 co_await NewThreadAwaitable<ChannelData>();
401 workload.workloadClass = DiscordCoreInternal::HttpsWorkloadClass::Post;
402 workload.relativePath = "/users/@me/channels";
403 workload.callStack = "Channels::createDMChannelAsync()";
404 parser.serializeJson(dataPackage, workload.content);
405 ChannelData returnData{};
406 Channels::httpsClient->submitWorkloadAndGetResult(std::move(workload), returnData);
407 co_return returnData;
408 }
409
411 DiscordCoreInternal::HttpsWorkloadData workload{ DiscordCoreInternal::HttpsWorkloadType::Get_Voice_Regions };
412 co_await NewThreadAwaitable<jsonifier::vector<VoiceRegionData>>();
413 workload.workloadClass = DiscordCoreInternal::HttpsWorkloadClass::Get;
414 workload.relativePath = "/voice/regions";
415 workload.callStack = "Channels::getVoiceRegionsAsync()";
416 jsonifier::vector<VoiceRegionData> returnData{};
417 Channels::httpsClient->submitWorkloadAndGetResult(std::move(workload), returnData);
418 co_return returnData;
419 }
420
421 void Channels::removeChannel(const ChannelCacheData& channelId) {
422 Channels::cache.erase(channelId);
423 };
424
425 bool Channels::doWeCacheChannels() {
426 return Channels::doWeCacheChannelsBool;
427 }
428
429 ObjectCache<ChannelCacheData> Channels::cache{};
430 DiscordCoreInternal::HttpsClient* Channels::httpsClient{};
431 bool Channels::doWeCacheChannelsBool{};
432}
For collecting a Channel from Discord's servers.
Snowflake channelId
The id of the ChannelData to acquire.
For deleting or closing a Channel.
Snowflake channelId
The id of the ChannelData to close/delete.
std::string reason
The reason for deleting/closing the ChannelData.
For editing the PermissionTypes overwrites of a given Channel, for a given Role or UserData.
Snowflake roleOrUserId
The RoleData or UserData Snowflake to modify the permissions for.
std::string reason
Reason for editing the permission overwrites.
Snowflake channelId
The ChannelData id of the desired ChannelData to modify the permissions for.
For collecting the invites to a given Channel.
For creating an invite to a given Channel.
std::string reason
Reason for creating the invite.
Snowflake channelId
The id of the ChannelData to create the invite for.
For deleting the PermissionTypes overwrites of a given Channel for a given Role or UserData.
Snowflake channelId
The id of the ChannelData to modify permissions for.
Snowflake roleOrUserId
The RoleData or UserData id for whom to delete the PermissionTypes overwrites.
std::string reason
Reason for deleting these permission overwrites.
For following a news ChannelData.
For triggering the typing indicator in a given Channel.
For acquiring a list of Channels from a chosen Guild.
Snowflake guildId
The Guild from which to collect the Channels from.
For creating a new ChannelData within a chosen Guild.
std::string reason
Reason for creating the ChannelData.
Snowflake guildId
The Guild within which to create the ChannelData.
For modifying the ChannelData position responseData of a single ChannelData.
For modifying the current positions of one or more Channels in the Guild.
Snowflake guildId
Guild within which to re-order the ChannelData positions.
std::string reason
Reason for re-ordering the ChannelData positions.
For collecting a direct-messaging ChannelData.
For modifying a Channel's properties.
std::string reason
A reason for modifying the ChannelData.
Snowflake channelId
The id of the ChannelData to modify.
UpdateChannelData channelData
The responseData of the ChannelData to be updated.
static CoRoutine< void > deleteChannelPermissionOverwritesAsync(DeleteChannelPermissionOverwritesData dataPackage)
Delete the given std::string overwrites for a given User or RoleData.
static CoRoutine< jsonifier::vector< InviteData > > getChannelInvitesAsync(GetChannelInvitesData dataPackage)
Collects a vector of the invites to a given Channel.
static CoRoutine< ChannelData > followNewsChannelAsync(FollowNewsChannelData dataPackage)
Follows a given new ChannelData with another ChannelData.
static CoRoutine< ChannelData > createGuildChannelAsync(CreateGuildChannelData dataPackage)
Creates a new ChannelData within a chosen Guild.
static CoRoutine< void > modifyGuildChannelPositionsAsync(ModifyGuildChannelPositionsData dataPackage)
Re-orders the ChannelData positions, within a chosen Guild.
static CoRoutine< void > deleteOrCloseChannelAsync(DeleteOrCloseChannelData dataPackage)
Delete a Channel, or close a protected message.
static CoRoutine< jsonifier::vector< VoiceRegionData > > getVoiceRegionsAsync()
Collect a list of voice regions that are usable for the RTC-Region option of a given Channel.
static CoRoutine< jsonifier::vector< ChannelData > > getGuildChannelsAsync(GetGuildChannelsData dataPackage)
Collects a list of Channels from a chosen Guild.
static CoRoutine< ChannelData > getChannelAsync(GetChannelData dataPackage)
Collects a Channel from the Discord servers.
static ChannelCacheData getCachedChannel(GetChannelData dataPackage)
Collects a Channel from the library's cache.
static CoRoutine< ChannelData > modifyChannelAsync(ModifyChannelData dataPackage)
Modifies a Channel's properties.
static CoRoutine< void > triggerTypingIndicatorAsync(TriggerTypingIndicatorData dataPackage)
Triggers the typing indicator for the bot in the given Channel.
static CoRoutine< void > editChannelPermissionOverwritesAsync(EditChannelPermissionOverwritesData dataPackage)
Edit the given std::string overwrites for a given User or RoleData.
static CoRoutine< ChannelData > createDMChannelAsync(CreateDMChannelData dataPackage)
Collect a direct-MessageData Channel between the bot and the UserData.
static CoRoutine< InviteData > createChannelInviteAsync(CreateChannelInviteData dataPackage)
Creates an invite to a selected ChannelData.
A CoRoutine - representing a potentially asynchronous operation/function.
Definition: CoRoutine.hpp:88
bool managed
For group DM channels: whether the channel is managed by an application via the gdm....
std::string icon
Icon hash of the group DM.
Data structure representing a single ChannelData.
uint32_t memberCount
Count of members active in the ChannelData.
ChannelType type
The type of the ChannelData.
jsonifier::string name
Name of the ChannelData.
Snowflake guildId
Snowflake of the ChannelData's Guild, if applicable.
ChannelFlags flags
Flags combined as a bitmask.
Snowflake parentId
Snowflake of the ChannelData's parent ChannelData/category.
jsonifier::string topic
ChannelData topic.
Snowflake ownerId
Snowflake of the ChannelData's owner.
uint32_t position
The position of the ChannelData, in the Guild's ChannelData list.
jsonifier::vector< OverWriteData > permissionOverwrites
Permission overwrites.
For updating/modifying a given Channel's properties.
uint64_t id
The Snowflake ID.
Definition: Base.hpp:870