DiscordCoreAPI
A Discord bot library written in C++, with custom asynchronous coroutines.
Loading...
Searching...
No Matches
MessageEntities.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 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/// MessageEntities.cpp - Source file for the message related classes and structs.
22/// May 13, 2021
23/// https://discordcoreapi.com
24/// \file MessageEntities.cpp
25
30
31namespace DiscordCoreAPI {
32
33 CoRoutine<MessageCollectorReturnData> MessageCollector::collectMessages(int32_t quantityToCollect, int32_t msToCollectForNew,
34 ObjectFilter<MessageData> filteringFunctionNew) {
35 co_await NewThreadAwaitable<MessageCollectorReturnData>();
36 this->quantityOfMessageToCollect = quantityToCollect;
37 this->filteringFunction = filteringFunctionNew;
38 this->msToCollectFor = msToCollectForNew;
39 this->collectorId = std::to_string(std::chrono::duration_cast<Milliseconds>(HRClock::now().time_since_epoch()).count());
40 MessageCollector::objectsBuffersMap[this->collectorId] = &this->objectsBuffer;
41 this->run();
42 co_return std::move(this->objectReturnData);
43 }
44
45 void MessageCollector::run() {
46 int64_t startingTime = static_cast<int64_t>(std::chrono::duration_cast<Milliseconds>(HRClock::now().time_since_epoch()).count());
47 int64_t elapsedTime{};
48 while (elapsedTime < this->msToCollectFor) {
49 Message message{};
50 waitForTimeToPass<MessageData>(this->objectsBuffer, message, static_cast<int32_t>(this->msToCollectFor - elapsedTime));
51 if (this->filteringFunction(message)) {
52 this->objectReturnData.messages.emplace_back(message);
53 }
54 if (static_cast<int32_t>(this->objectReturnData.messages.size()) >= this->quantityOfMessageToCollect) {
55 break;
56 }
57
58 elapsedTime = std::chrono::duration_cast<Milliseconds>(HRClock::now().time_since_epoch()).count() - startingTime;
59 }
60 }
61
62 MessageCollector::~MessageCollector() {
63 if (MessageCollector::objectsBuffersMap.contains(this->collectorId)) {
64 MessageCollector::objectsBuffersMap.erase(this->collectorId);
65 }
66 };
67
68 Message::Message(Value jsonData) {
69 this->referencedMessage = std::make_unique<MessageDataOld>();
70
71 this->content = getString(jsonData, "content");
72
73 this->channelId = getId(jsonData, "channel_id");
74
75 this->guildId = getId(jsonData, "guild_id");
76
77 this->id = getId(jsonData, "id");
78
79 Value object{};
80 if (!getObject(object, "author", jsonData)) {
81 this->author = UserData{ object };
82 }
83
84 if (jsonData["member"].get(object) == ErrorCode::Success) {
85 this->member = GuildMemberData{ object };
86 }
87
88 this->timeStamp = getString(jsonData, "timestamp");
89
90 this->editedTimestamp = getString(jsonData, "edited_timestamp");
91
92 this->tts = getBool(jsonData, "tts");
93
94 this->mentionEveryone = getBool(jsonData, "mention_everyone");
95
96 Array arrayValue{};
97 if (!getArray(arrayValue, "mentions", jsonData)) {
98 for (JsonifierResult<Value> value: arrayValue) {
99 UserData newData{ value.value() };
100 this->mentions.emplace_back(std::move(newData));
101 }
102 }
103
104 if (!getArray(arrayValue, "mention_roles", jsonData)) {
105 for (JsonifierResult<Value> value: arrayValue) {
106 this->mentionRoles.emplace_back(value.getString().value());
107 }
108 }
109
110 if (!getArray(arrayValue, "mention_channels", jsonData)) {
111 for (JsonifierResult<Value> value: arrayValue) {
112 ChannelMentionData newData{ value.value() };
113 this->mentionChannels.emplace_back(std::move(newData));
114 }
115 }
116
117 if (!getArray(arrayValue, "attachments", jsonData)) {
118 for (JsonifierResult<Value> value: arrayValue) {
119 AttachmentData newData{ value.value() };
120 this->attachments.emplace_back(std::move(newData));
121 }
122 }
123
124 if (!getArray(arrayValue, "embeds", jsonData)) {
125 for (JsonifierResult<Value> value: arrayValue) {
126 EmbedData newData{ value.value() };
127 this->embeds.emplace_back(std::move(newData));
128 }
129 }
130
131 if (!getArray(arrayValue, "reactions", jsonData)) {
132 for (JsonifierResult<Value> value: arrayValue) {
133 ReactionData newData{ value.value() };
134 this->reactions.emplace_back(std::move(newData));
135 }
136 }
137
138 this->nonce = getString(jsonData, "nonce");
139
140 this->pinned = getBool(jsonData, "pinned");
141
142 this->webHookId = getId(jsonData, "webhook_id");
143
144 this->type = static_cast<MessageType>(getUint8(jsonData, "type"));
145
146 if (!getObject(object, "activity", jsonData)) {
147 this->activity = MessageActivityData{ object };
148 }
149
150 if (!getObject(object, "application", jsonData)) {
151 this->application = ApplicationData{ object };
152 }
153
154 this->applicationId = getId(jsonData, "application_id");
155
156 if (!getObject(object, "message_reference", jsonData)) {
157 this->messageReference = MessageReferenceData{ object };
158 }
159
160 this->flags = getUint32(jsonData, "flags");
161
162 if (!getArray(arrayValue, "sticker_items", jsonData)) {
163 for (JsonifierResult<Value> value: arrayValue) {
164 StickerItemData newData{ value.value() };
165 this->stickerItems.emplace_back(std::move(newData));
166 }
167 }
168
169 if (!getArray(arrayValue, "stickers", jsonData)) {
170 for (JsonifierResult<Value> value: arrayValue) {
171 StickerData newData{ value.value() };
172 this->stickers.emplace_back(std::move(newData));
173 }
174 }
175
176 if (!getObject(object, "interaction", jsonData)) {
177 this->interaction = MessageInteractionData{ object };
178 }
179
180 if (!getArray(arrayValue, "components", jsonData)) {
181 for (JsonifierResult<Value> value: arrayValue) {
182 ActionRowData newData{ value.value() };
183 this->components.emplace_back(std::move(newData));
184 }
185 }
186
187 if (!getObject(object, "thread", jsonData)) {
188 this->thread = ChannelData{ object };
189 }
190 }
191
192 MessageVector::MessageVector(Value jsonData) {
193 if (jsonData.type().value() != JsonType::Null) {
194 Array arrayValue{};
195 if (!getArray(arrayValue, jsonData)) {
196 for (JsonifierResult<Value> value: arrayValue) {
197 Message newData{ value.value() };
198 this->messages.emplace_back(std::move(newData));
199 }
200 }
201 }
202 }
203
204 CreateMessageData::CreateMessageData(const Snowflake channelIdNew) {
205 this->channelId = channelIdNew;
206 }
207
208 CreateMessageData::CreateMessageData(RespondToInputEventData dataPackage) {
209 this->channelId = dataPackage.channelId;
210 this->addAllowedMentions(dataPackage.allowedMentions);
211 for (auto& value: dataPackage.components) {
212 this->components.emplace_back(value);
213 }
214 this->addContent(dataPackage.content);
215 for (auto& value: dataPackage.embeds) {
216 this->embeds.emplace_back(value);
217 }
218 this->tts = dataPackage.tts;
219 }
220
221 CreateMessageData::CreateMessageData(InputEventData dataPackage) {
222 this->channelId = dataPackage.getChannelData().id;
223 }
224
225 CreateMessageData::operator Serializer() {
226 Serializer data{};
227 for (auto& value: this->attachments) {
228 data["attachments"].emplaceBack(value.operator Serializer());
229 }
230 if (this->messageReference.messageId != 0) {
231 data["message_reference"] = this->messageReference.operator Serializer();
232 }
233 if (this->components.size() == 0) {
234 data["components"].emplaceBack(ActionRowData{});
235 data["components"].getValue<Jsonifier::Serializer::ArrayType>().clear();
236 } else {
237 for (auto& value: this->components) {
238 data["components"].emplaceBack(value.operator Serializer());
239 }
240 }
241 if (this->allowedMentions.parse.size() > 0 || this->allowedMentions.roles.size() > 0 || this->allowedMentions.users.size() > 0) {
242 data["allowed_mentions"] = this->allowedMentions.operator Serializer();
243 }
244 for (auto& value: this->stickerIds) {
245 data["sticker_ids"].emplaceBack(value);
246 }
247 if (this->embeds.size() == 0) {
248 data["embeds"].emplaceBack(EmbedData{});
249 data["embeds"].getValue<Jsonifier::Serializer::ArrayType>().clear();
250 } else {
251 for (auto& value: this->embeds) {
252 data["embeds"].emplaceBack(value.operator Serializer());
253 }
254 }
255 if (this->content != "") {
256 data["content"] = this->content;
257 }
258 data["flags"] = this->flags;
259 data["tts"] = this->tts;
260 return data;
261 }
262
263 SendDMData::SendDMData(RespondToInputEventData dataPackage) {
264 this->targetUserId = dataPackage.targetUserId;
265 this->addAllowedMentions(dataPackage.allowedMentions);
266 for (auto& value: dataPackage.components) {
267 this->components.emplace_back(value);
268 }
269 this->addContent(dataPackage.content);
270 for (auto& value: dataPackage.embeds) {
271 this->embeds.emplace_back(value);
272 }
273 this->channelId = dataPackage.targetUserId;
274 this->tts = dataPackage.tts;
275 }
276
277 EditMessageData::EditMessageData(InputEventData dataPackage) {
278 this->channelId = dataPackage.getChannelData().id;
279 this->messageId = dataPackage.getMessageData().id;
280 }
281
282 EditMessageData::EditMessageData(RespondToInputEventData dataPackage) {
283 this->allowedMentions = dataPackage.allowedMentions;
284 this->channelId = dataPackage.channelId;
285 this->messageId = dataPackage.messageId;
286 for (auto& value: dataPackage.components) {
287 this->components.emplace_back(value);
288 }
289 this->content = dataPackage.content;
290 for (auto& value: dataPackage.embeds) {
291 this->embeds.emplace_back(value);
292 }
293 }
294
295 EditMessageData::operator Serializer() {
296 Serializer data{};
297 for (auto& value: this->attachments) {
298 data["attachments"].emplaceBack(value.operator Serializer());
299 }
300 if (this->components.size() == 0) {
301 data["components"].emplaceBack(ActionRowData{});
302 data["components"].getValue<Jsonifier::Serializer::ArrayType>().clear();
303 } else {
304 for (auto& value: this->components) {
305 data["components"].emplaceBack(value.operator Serializer());
306 }
307 }
308 if (this->allowedMentions.parse.size() > 0 || this->allowedMentions.roles.size() > 0 || this->allowedMentions.users.size() > 0) {
309 data["allowed_mentions"] = this->allowedMentions.operator Serializer();
310 }
311 if (this->embeds.size() == 0) {
312 data["embeds"].emplaceBack(EmbedData{});
313 data["embeds"].getValue<Jsonifier::Serializer::ArrayType>().clear();
314 } else {
315 for (auto& value: this->embeds) {
316 data["embeds"].emplaceBack(value.operator Serializer());
317 }
318 }
319 if (this->content != "") {
320 data["content"] = this->content;
321 }
322 data["flags"] = this->flags;
323 data["tts"] = this->tts;
324 return data;
325 }
326
327 DeleteMessagesBulkData::operator Serializer() {
328 Serializer data{};
329 for (auto& value: this->messageIds) {
330 data["messages"].emplaceBack(value.operator std::string());
331 }
332 return data;
333 }
334
335 MessageVector::operator std::vector<Message>() {
336 return this->messages;
337 }
338
339 void Messages::initialize(DiscordCoreInternal::HttpsClient* client) {
340 Messages::httpsClient = client;
341 }
342
344 DiscordCoreInternal::HttpsWorkloadData workload{ DiscordCoreInternal::HttpsWorkloadType::Get_Messages };
345 co_await NewThreadAwaitable<std::vector<Message>>();
346 workload.workloadClass = DiscordCoreInternal::HttpsWorkloadClass::Get;
347 workload.relativePath = "/channels/" + dataPackage.channelId + "/messages";
348 if (dataPackage.aroundThisId != 0) {
349 workload.relativePath += "?around=" + std::to_string(dataPackage.aroundThisId);
350 if (dataPackage.limit != 0) {
351 workload.relativePath += "&limit=" + std::to_string(dataPackage.limit);
352 } else {
353 workload.relativePath += "&limit=1";
354 }
355 } else if (dataPackage.beforeThisId != 0) {
356 workload.relativePath += "?before=" + dataPackage.beforeThisId;
357 if (dataPackage.limit != 0) {
358 workload.relativePath += "&limit=" + std::to_string(dataPackage.limit);
359 } else {
360 workload.relativePath += "&limit=1";
361 }
362 } else if (dataPackage.afterThisId != 0) {
363 workload.relativePath += "?after=" + dataPackage.afterThisId;
364 if (dataPackage.limit != 0) {
365 workload.relativePath += "&limit=" + std::to_string(dataPackage.limit);
366 } else {
367 workload.relativePath += "&limit=1";
368 }
369 } else {
370 if (dataPackage.limit != 0) {
371 workload.relativePath += "?limit=" + std::to_string(dataPackage.limit);
372 } else {
373 workload.relativePath += "&limit=1";
374 }
375 }
376 workload.callStack = "Messages::getMessagesAsync()";
377 MessageVector returnValue{};
378 co_return Messages::httpsClient->submitWorkloadAndGetResult<MessageVector>(workload, &returnValue);
379 }
380
382 DiscordCoreInternal::HttpsWorkloadData workload{ DiscordCoreInternal::HttpsWorkloadType::Get_Message };
383 co_await NewThreadAwaitable<Message>();
384 workload.workloadClass = DiscordCoreInternal::HttpsWorkloadClass::Get;
385 workload.relativePath = "/channels/" + dataPackage.channelId + "/messages/" + dataPackage.id;
386 workload.callStack = "Messages::getMessageAsync()";
387 Message returnValue{};
388 co_return Messages::httpsClient->submitWorkloadAndGetResult<Message>(workload, &returnValue);
389 }
390
392 DiscordCoreInternal::HttpsWorkloadData workload{ DiscordCoreInternal::HttpsWorkloadType::Post_Message };
393 co_await NewThreadAwaitable<Message>();
394 workload.workloadClass = DiscordCoreInternal::HttpsWorkloadClass::Post;
395 workload.relativePath = "/channels/" + dataPackage.channelId + "/messages";
396 if (dataPackage.files.size() > 0) {
397 workload.payloadType = DiscordCoreInternal::PayloadType::Multipart_Form;
398 auto serializer = dataPackage.operator Serializer();
399 serializer.refreshString(JsonifierSerializeType::Json);
400 workload.content = constructMultiPartData(serializer.operator std::string(), dataPackage.files);
401 } else {
402 auto serializer = dataPackage.operator Serializer();
403 serializer.refreshString(JsonifierSerializeType::Json);
404 workload.content = serializer.operator std::string();
405 }
406 workload.callStack = "Messages::createMessageAsync()";
407 Message returnValue{};
408 co_return Messages::httpsClient->submitWorkloadAndGetResult<Message>(workload, &returnValue);
409 }
410
412 DiscordCoreInternal::HttpsWorkloadData workload{ DiscordCoreInternal::HttpsWorkloadType::Crosspost_Message };
413 co_await NewThreadAwaitable<Message>();
414 workload.workloadClass = DiscordCoreInternal::HttpsWorkloadClass::Post;
415 workload.relativePath = "/channels/" + dataPackage.channelId + "/messages/" + dataPackage.messageId + "/crosspost";
416 workload.callStack = "Messages::crosspostMessageAsync()";
417 Message returnValue{};
418 co_return Messages::httpsClient->submitWorkloadAndGetResult<Message>(workload, &returnValue);
419 }
420
422 DiscordCoreInternal::HttpsWorkloadData workload{ DiscordCoreInternal::HttpsWorkloadType::Patch_Message };
423 co_await NewThreadAwaitable<Message>();
424 workload.workloadClass = DiscordCoreInternal::HttpsWorkloadClass::Patch;
425 workload.relativePath = "/channels/" + dataPackage.channelId + "/messages/" + dataPackage.messageId;
426 if (dataPackage.files.size() > 0) {
427 workload.payloadType = DiscordCoreInternal::PayloadType::Multipart_Form;
428 auto serializer = dataPackage.operator Serializer();
429 serializer.refreshString(JsonifierSerializeType::Json);
430 workload.content = constructMultiPartData(serializer.operator std::string(), dataPackage.files);
431 } else {
432 auto serializer = dataPackage.operator Serializer();
433 serializer.refreshString(JsonifierSerializeType::Json);
434 workload.content = serializer.operator std::string();
435 }
436 workload.callStack = "Messages::editMessageAsync()";
437 Message returnValue{};
438 co_return Messages::httpsClient->submitWorkloadAndGetResult<Message>(workload, &returnValue);
439 }
440
442 DiscordCoreInternal::HttpsWorkloadData workload{};
443 bool hasTimeElapsedNew = dataPackage.timeStamp.hasTimeElapsed(14, 0, 0);
444 if (!hasTimeElapsedNew) {
445 workload = DiscordCoreInternal::HttpsWorkloadType::Delete_Message;
446 } else {
447 workload = DiscordCoreInternal::HttpsWorkloadType::Delete_Message_Old;
448 }
449 co_await NewThreadAwaitable<void>();
450 if (dataPackage.timeDelay > 0) {
451 std::this_thread::sleep_for(Milliseconds{ dataPackage.timeDelay });
452 }
453 workload.workloadClass = DiscordCoreInternal::HttpsWorkloadClass::Delete;
454 workload.relativePath = "/channels/" + dataPackage.channelId + "/messages/" + dataPackage.messageId;
455 workload.callStack = "Messages::deleteMessageAsync()";
456 if (dataPackage.reason != "") {
457 workload.headersToInsert["X-Audit-Log-Reason"] = dataPackage.reason;
458 }
459 Messages::httpsClient->submitWorkloadAndGetResult<void>(workload);
460 co_return;
461 }
462
464 DiscordCoreInternal::HttpsWorkloadData workload{ DiscordCoreInternal::HttpsWorkloadType::Bulk_Delete_Messages };
465 co_await NewThreadAwaitable<void>();
466 workload.workloadClass = DiscordCoreInternal::HttpsWorkloadClass::Post;
467 workload.relativePath = "/channels/" + dataPackage.channelId + "/messages/bulk-delete";
468 auto serializer = dataPackage.operator Serializer();
469 serializer.refreshString(JsonifierSerializeType::Json);
470 workload.content = serializer.operator std::string();
471 workload.callStack = "Messages::deleteMessagesBulkAsync()";
472 if (dataPackage.reason != "") {
473 workload.headersToInsert["X-Audit-Log-Reason"] = dataPackage.reason;
474 }
475 co_return Messages::httpsClient->submitWorkloadAndGetResult<void>(workload);
476 }
477
479 DiscordCoreInternal::HttpsWorkloadData workload{ DiscordCoreInternal::HttpsWorkloadType::Get_Pinned_Messages };
480 co_await NewThreadAwaitable<std::vector<Message>>();
481 workload.workloadClass = DiscordCoreInternal::HttpsWorkloadClass::Get;
482 workload.relativePath = "/channels/" + dataPackage.channelId + "/pins";
483 workload.callStack = "Messages::getPinnedMessagesAsync()";
484 MessageVector returnValue{};
485 co_return Messages::httpsClient->submitWorkloadAndGetResult<MessageVector>(workload, &returnValue);
486 }
487
489 DiscordCoreInternal::HttpsWorkloadData workload{ DiscordCoreInternal::HttpsWorkloadType::Put_Pin_Message };
490 co_await NewThreadAwaitable<void>();
491 workload.workloadClass = DiscordCoreInternal::HttpsWorkloadClass::Put;
492 workload.relativePath = "/channels/" + dataPackage.channelId + "/pins/" + dataPackage.messageId;
493 workload.callStack = "Messages::pinMessageAsync()";
494 if (dataPackage.reason != "") {
495 workload.headersToInsert["X-Audit-Log-Reason"] = dataPackage.reason;
496 }
497 co_return Messages::httpsClient->submitWorkloadAndGetResult<void>(workload);
498 }
499
501 DiscordCoreInternal::HttpsWorkloadData workload{ DiscordCoreInternal::HttpsWorkloadType::Delete_Pin_Message };
502 co_await NewThreadAwaitable<void>();
503 workload.workloadClass = DiscordCoreInternal::HttpsWorkloadClass::Delete;
504 workload.relativePath = "/channels/" + dataPackage.channelId + "/pins/" + dataPackage.messageId;
505 workload.callStack = "Messages::unpinMessageAsync()";
506 if (dataPackage.reason != "") {
507 workload.headersToInsert["X-Audit-Log-Reason"] = dataPackage.reason;
508 }
509 co_return Messages::httpsClient->submitWorkloadAndGetResult<void>(workload);
510 }
511
512 DiscordCoreInternal::HttpsClient* Messages::httpsClient{ nullptr };
513}
std::function< bool(OTy)> ObjectFilter
Typedef for the message filter.
Definition: Utilities.hpp:1283
MessageType
Message types.
The main namespace for this library.
A CoRoutine - representing a potentially asynchronous operation/function.
Definition: CoRoutine.hpp:52
TimeStamp editedTimestamp
The time at which it was edited.
std::vector< std::string > mentionRoles
std::vector of "mention roles" ids.
std::vector< UserData > mentions
Array of User data, for individual's that were mentioned.
bool mentionEveryone
Does the Message mention everyone?
Snowflake webHookId
WebHook id of the Message, if applicable.
MessageInteractionData interaction
Message Interaction data.
MessageReferenceData messageReference
Message reference data.
ChannelData thread
The Thread that the Message was sent in, if applicable.
TimeStamp timeStamp
The timeStamp of when the Message was created.
GuildMemberData member
The author's Guild member data.
std::string content
The Message's content.
Snowflake channelId
The Channel it was sent in.
Snowflake guildId
The id of the Guild the Message was sent in.
std::vector< StickerItemData > stickerItems
Array of Message Sticker item data.
std::vector< ChannelMentionData > mentionChannels
array of Channel mention data.
UserData author
The author's User data.
std::vector< ActionRowData > components
Array of action row data.
std::vector< AttachmentData > attachments
Array of attachment data.
std::vector< EmbedData > embeds
Array of Message embeds.
std::vector< StickerData > stickers
Array of Message Sticker data.
Snowflake applicationId
Application id.
bool tts
Is it a text-to-speech Message?
ApplicationData application
Application data.
MessageActivityData activity
Message activity data.
std::unique_ptr< MessageDataOld > referencedMessage
The referenced Message, to reply to.
MessageResponseBase & addContent(const std::string &dataPackage)
For setting the Message content in a response.
MessageResponseBase & addAllowedMentions(AllowedMentionsData dataPackage)
For setting the allowable mentions in a response.
std::vector< MessageData > messages
A vector of collected Objects.
CoRoutine< MessageCollectorReturnData > collectMessages(int32_t quantityToCollect, int32_t msToCollectForNew, ObjectFilter< MessageData > filteringFunctionNew)
Begin waiting for Messages.
For getting a collection of Messages.
Snowflake channelId
Channel from which to collect the Messages.
uint64_t aroundThisId
Around this id.
Snowflake beforeThisId
Before this id.
Snowflake afterThisId
After this id.
int32_t limit
Limit of Messages to collect.
Snowflake id
The id of the Message to collect.
Snowflake channelId
The Channel from which to collect the Message.
Snowflake messageId
Id of the message to be crossposted.
Snowflake channelId
Channel within which to crosspost the Message from.
int32_t timeDelay
Number of Milliseconds to wait before deleting the Message.
Snowflake messageId
The message Id of the Message to delete.
Snowflake channelId
The channel Id of the Message to delete.
TimeStamp timeStamp
The created-at timeStamp of the original message.
std::string reason
The reason for deleting the Message.
For deleting a bulk of Messages.
std::string reason
The reason for deleting the Messages.
Snowflake channelId
Channel within which to delete the Messages.
For getting a collection of pinned Messages.
Snowflake channelId
The Channel from which to collect pinned Messages.
For pinning a single Message.
Snowflake channelId
The Channel within which to pin the Message.
Snowflake messageId
The Message which you would like to pin.
std::string reason
Reason for pinning this Message.
For unpinning a single Message.
std::string reason
Reason for pinning this Message.
Snowflake messageId
The Message which you would like to unpin.
Snowflake channelId
The Channel within which to unpin the Message.
static CoRoutine< void > deleteMessagesBulkAsync(DeleteMessagesBulkData dataPackage)
Deletes a collection of Messages.
static CoRoutine< std::vector< Message > > getMessagesAsync(GetMessagesData dataPackage)
Collects a collection of Message from the Discord servers.
static CoRoutine< Message > createMessageAsync(CreateMessageData dataPackage)
Creates a new Message.
static CoRoutine< std::vector< Message > > getPinnedMessagesAsync(GetPinnedMessagesData dataPackage)
Collects a collection of pinned Messages from the Discord servers.
static CoRoutine< void > deleteMessageAsync(DeleteMessageData dataPackage)
Deletes a Message.
static CoRoutine< Message > getMessageAsync(GetMessageData dataPackage)
Collects a Message from the Discord servers.
static CoRoutine< void > pinMessageAsync(PinMessageData dataPackage)
Pins a Message to a given Channel.
static CoRoutine< Message > crosspostMessageAsync(CrosspostMessageData dataPackage)
Crossposts a message from a News Channel to the following Channels.
static CoRoutine< void > unpinMessageAsync(UnpinMessageData dataPackage)
Unpins a Message from a given Channel.
static CoRoutine< Message > editMessageAsync(EditMessageData dataPackage)
Edit a Message.