DiscordCoreAPI
A Discord bot library written in C++, with custom asynchronous coroutines.
Loading...
Searching...
No Matches
InteractionEntities.hpp
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/// InteractionEntities.hpp - Header for the interaction related classes and
27/// structs. May 28, 2021 Chris M.
28/// https://discordcoreapi.com
29/// \file InteractionEntities.hpp
30
31#pragma once
32
36
37namespace DiscordCoreAPI {
38
39 /**
40 * \addtogroup foundation_entities
41 * @{
42 */
43
44 using AutoCompleteEntryFunction = std::function<std::string(std::string)>;
45
46 class DiscordCoreAPI_Dll InteractionResponseBase {
47 public:
48 template<typename ValueType> friend struct jsonifier::core;
49
50 UnorderedSet<std::string_view> excludedKeys{};
51
52 /// @brief Adds a button to the response MessageData.
53 /// @param disabled Whether the button is active or not.
54 /// @param customIdNew A custom id to give for identifying the button.
55 /// @param buttonLabel A visible label for the button.
56 /// @param buttonStyle The style of the button.
57 /// @param emojiName An emoji name, if desired.
58 /// @param emojiId An emoji id, if desired.
59 /// @param url A url, if applicable.
60 InteractionResponseBase& addButton(bool disabled, const std::string& customIdNew, const std::string& buttonLabel, ButtonStyle buttonStyle,
61 const std::string& emojiName = "", Snowflake emojiId = Snowflake{}, const std::string& url = "");
62
63 /// @brief Adds a select-menu to the response MessageData.
64 /// @param disabled Whether the select-menu is active or not.
65 /// @param customIdNew A custom id to give for identifying the select-menu.
66 /// @param options A vector of select-menu-options to offer.
67 /// @param placeholder Custom placeholder text if nothing is selected, max 100 characters.
68 /// @param maxValues Maximum number of selections that are possible.
69 /// @param minValues Minimum required number of selections that are required.
70 InteractionResponseBase& addSelectMenu(bool disabled, const std::string& customIdNew, jsonifier::vector<SelectOptionData> options, const std::string& placeholder,
71 uint64_t maxValues, uint64_t minValues, SelectMenuType type, jsonifier::vector<ChannelType> channelTypes = jsonifier::vector<ChannelType>{});
72
73 /// @brief Adds a modal to the response MessageData.
74 /// @param topTitleNew A title for the modal.
75 /// @param topCustomIdNew A custom id to give for the modal.
76 /// @param titleNew A title for the modal's individual input.
77 /// @param customIdNew A custom id to give for the modal's individual input.
78 /// @param required Is it a required response?
79 /// @param minLength Minimum length.
80 /// @param maxLength Maximum length.
81 /// @param inputStyle The input style.
82 /// @param label A label for the modal.
83 /// @param placeholder A placeholder for the modal.
84 /// @returns RespondToInputEventData& A reference to this data structure.
85 InteractionResponseBase& addModal(const std::string& topTitleNew, const std::string& topCustomIdNew, const std::string& titleNew, const std::string& customIdNew,
86 bool required, uint64_t minLength, uint64_t maxLength, TextInputStyle inputStyle, const std::string& label = "", const std::string& placeholder = "");
87
88 /// @brief Adds a file to the current collection of files for this message response.
89 /// @param theFile The file to be added.
90 /// @returns MessageResponseBase& A reference to this data structure.
91 InteractionResponseBase& addFile(const File& theFile);
92
93 /// @brief For setting the allowable mentions in a response.
94 /// @param dataPackage An AllowedMentionsData structure.
95 InteractionResponseBase& addAllowedMentions(const AllowedMentionsData& dataPackage);
96
97 /// @brief For setting the components in a response.
98 /// @param dataPackage An ActionRowData structure.
99 InteractionResponseBase& addComponentRow(const ActionRowData& dataPackage);
100
101 /// @brief Sets the response type of the current MessageData.
102 /// @param type Interaction callback type.
103 InteractionResponseBase& setResponseType(InteractionCallbackType type);
104
105 /// @brief For setting the embeds in a response.
106 /// @param dataPackage An EmbedData structure.SendDMData
107 InteractionResponseBase& addMessageEmbed(const EmbedData& dataPackage);
108
109 /// @brief For setting the content in a response.
110 /// @param dataPackage A string, containing the content.
111 InteractionResponseBase& addContent(const std::string& dataPackage);
112
113 /// @brief For setting the tts status of a response.
114 /// @param enabledTTs A bool.
115 InteractionResponseBase& setTTSStatus(bool enabledTTs);
116
117 InteractionResponseBase& setFlags(uint64_t flag);
118
119 InteractionResponseData getInteractionResponseData();
120
121 void generateExcludedKeys();
122
123 virtual ~InteractionResponseBase() = default;
124
125 protected:
126 InteractionPackageData interactionPackage{};
127 MessagePackageData messagePackage{};
128 InteractionCallbackData data{};
130 };
131
132 /// @brief For creating an ephemeral Interaction response.
133 class DiscordCoreAPI_Dll CreateEphemeralInteractionResponseData : public InteractionResponseBase {
134 public:
136 friend class Interactions;
137 friend class InputEvents;
138
140
141 virtual ~CreateEphemeralInteractionResponseData() = default;
142 };
143
144 /// @brief For creating a deferred Interaction response.
145 class DiscordCoreAPI_Dll CreateDeferredInteractionResponseData : public InteractionResponseBase {
146 public:
148 friend class Interactions;
149 friend class InputEvents;
150
152
153 virtual ~CreateDeferredInteractionResponseData() = default;
154 };
155
156 /// @brief For creating an Interaction response.
157 class DiscordCoreAPI_Dll CreateInteractionResponseData : public InteractionResponseBase {
158 public:
159 template<typename ValueType> friend struct jsonifier::core;
160 friend class SelectMenuCollector;
161 friend class ButtonCollector;
162 friend class ModalCollector;
163 friend class Interactions;
164 friend class InputEvents;
165
167
169
171
173
175
176 virtual ~CreateInteractionResponseData() = default;
177 };
178
179 /// @brief For getting an Interaction response.
181 std::string interactionToken{};///< Interaction token.
182 Snowflake applicationId{};///< application id.
183 };
184
185 /// @brief For editing an Interaction response.
186 class DiscordCoreAPI_Dll EditInteractionResponseData : public EditWebHookData {
187 public:
188 template<typename ValueType> friend struct jsonifier::core;
189 friend class Interactions;
190 friend class InputEvents;
191
192 UnorderedSet<std::string_view> excludedKeys{};
193
195
196 void generateExcludedKeys();
197
198 virtual ~EditInteractionResponseData() = default;
199
200 protected:
201 InteractionPackageData interactionPackage{};
202 };
203
204 /// @brief For deleting an Interaction response.
205 struct DiscordCoreAPI_Dll DeleteInteractionResponseData {
206 friend class Interactions;
207 friend class InputEvents;
208
210
211 protected:
212 InteractionPackageData interactionPackage{};
213 uint32_t timeDelay{};
214 };
215
216 /// @brief For creating an ephemeral follow up MessageData.
217 class DiscordCoreAPI_Dll CreateEphemeralFollowUpMessageData : public ExecuteWebHookData {
218 public:
219 friend class CreateFollowUpMessageData;
220 friend class Interactions;
221 friend class InputEvents;
222
224
225 virtual ~CreateEphemeralFollowUpMessageData() = default;
226
227 protected:
228 InteractionPackageData interactionPackage{};
229 };
230
231 /// @brief For creating a follow up MessageData.
232 class DiscordCoreAPI_Dll CreateFollowUpMessageData : public ExecuteWebHookData {
233 public:
234 template<typename ValueType> friend struct jsonifier::core;
235 friend class SelectMenuCollector;
236 friend class ButtonCollector;
237 friend class Interactions;
238 friend class InputEvents;
239
240 UnorderedSet<std::string_view> excludedKeys{};
241
243
245
246 void generateExcludedKeys();
247
248 virtual ~CreateFollowUpMessageData() = default;
249
250 protected:
251 InteractionPackageData interactionPackage{};
252 };
253
254 /// @brief For getting a follow-up MessageData.
256 std::string interactionToken{};///< Interaction token.
257 Snowflake applicationId{};///< application id.
258 Snowflake messageId{};///< Message id.
259 };
260
261 /// @brief For editing a follow up MessageData.
262 class DiscordCoreAPI_Dll EditFollowUpMessageData : public EditWebHookData {
263 public:
264 template<typename ValueType> friend struct jsonifier::core;
265 friend class Interactions;
266 friend class InputEvents;
267
268 UnorderedSet<std::string_view> excludedKeys{};
269
271
272 virtual ~EditFollowUpMessageData() = default;
273
274 protected:
275 InteractionPackageData interactionPackage{};
276 MessagePackageData messagePackage{};
277 };
278
279 /// @brief For deleting a follow up MessageData.
280 struct DiscordCoreAPI_Dll DeleteFollowUpMessageData {
281 friend class Interactions;
282 friend class InputEvents;
283
285
286 protected:
287 InteractionPackageData interactionPackage{};
288 MessagePackageData messagePackage{};
289 uint32_t timeDelay{};
290 };
291
292 /**@}*/
293
294 /**
295 * \addtogroup main_endpoints
296 * @{
297 */
298
299 /// @brief An interface class for the Interaction related Discord endpoints.
300 class DiscordCoreAPI_Dll Interactions {
301 public:
302 friend class DiscordCoreInternal::BaseSocketAgent;
303 friend class DiscordCoreClient;
304 friend class EventManager;
305 friend class InputEvents;
306
307 static void initialize(DiscordCoreInternal::HttpsClient*);
308
309 /// @brief Creates a response to an input Interaction.
310 /// @param dataPackage A CreateInteractionResponseData structure.
311 /// @returns A CoRoutine containing a Message.
312 static CoRoutine<MessageData> createInteractionResponseAsync(CreateInteractionResponseData dataPackage);
313
314 /// @brief Collects an Interaction response.
315 /// @param dataPackage A GetInteractionResponseData structure.
316 /// @returns A CoRoutine containing an InteractionResponseData.
317 static CoRoutine<MessageData> getInteractionResponseAsync(GetInteractionResponseData dataPackage);
318
319 /// @brief Edits an Interaction response.
320 /// @param dataPackage A EditInteractionResponseData structure.
321 /// @returns A CoRoutine containing a Message.
322 static CoRoutine<MessageData> editInteractionResponseAsync(EditInteractionResponseData dataPackage);
323
324 /// @brief Deletes an Interaction respnose.
325 /// @param dataPackage A DeleteInteractionResponseData structure.
326 /// @returns A CoRoutine containing void.
327 static CoRoutine<void> deleteInteractionResponseAsync(DeleteInteractionResponseData dataPackage);
328
329 /// @brief Creates a follow up Message to an input Interaction.
330 /// @param dataPackage A CreateFollowUpMessageData structure.
331 /// @returns A CoRoutine containing a Message.
332 static CoRoutine<MessageData> createFollowUpMessageAsync(CreateFollowUpMessageData dataPackage);
333
334 /// @brief Creates a follow up Message to an input Interaction.
335 /// @param dataPackage A CreateFollowUpMessageData structure.
336 /// @returns A CoRoutine containing a Message.
337 static CoRoutine<MessageData> getFollowUpMessageAsync(GetFollowUpMessageData dataPackage);
338
339 /// @brief Edits a follow up MessageData.
340 /// @param dataPackage A EditFollowUpMessageData structure.
341 /// @returns A CoRoutine containing a Message.
342 static CoRoutine<MessageData> editFollowUpMessageAsync(EditFollowUpMessageData dataPackage);
343
344 /// @brief Deletes a follow up MessageData.
345 /// @param dataPackage A DeleteFollowUpMessageData structure.
346 /// @returns A CoRoutine containing void.
347 static CoRoutine<void> deleteFollowUpMessageAsync(DeleteFollowUpMessageData dataPackage);
348
349 protected:
350 static DiscordCoreInternal::HttpsClient* httpsClient;
351
352 static MessageData createInteractionResponse(CreateInteractionResponseData dataPackage);
353
354 static MessageData editInteractionResponse(EditInteractionResponseData dataPackage);
355
356 static MessageData createFollowUpMessage(CreateFollowUpMessageData dataPackage);
357
358 static MessageData editFollowUpMessage(EditFollowUpMessageData dataPackage);
359 };
360
361 /**@}*/
362
363 /**
364 * \addtogroup utilities
365 * @{
366 */
367
368 /// @brief Select menu response data.
370 inline operator InteractionData() {
371 return *interactionData;
372 }
373
374 inline SelectMenuResponseData& operator=(const SelectMenuResponseData& other) {
375 if (this != &other) {
377 selectionId = other.selectionId;
378 messageId = other.messageId;
379 channelId = other.channelId;
380 values = other.values;
381 userId = other.userId;
382 }
383 return *this;
384 }
385
387 *this = other;
388 }
389
390 inline SelectMenuResponseData& operator=(SelectMenuResponseData& other) {
391 if (this != &other) {
393 selectionId = other.selectionId;
394 messageId = other.messageId;
395 channelId = other.channelId;
396 values = other.values;
397 userId = other.userId;
398 }
399 return *this;
400 }
401
403 *this = other;
404 }
405
406 inline SelectMenuResponseData() = default;
407
408 UniquePtr<InteractionData> interactionData{ makeUnique<InteractionData>() };///< Interaction data.
409 jsonifier::vector<std::string> values{};///< A vector of the chosen values.
410 std::string selectionId{};///< Selection id.
411 Snowflake channelId{};///< The ChannelData id where it took place.
412 Snowflake messageId{};///< The Message id where it took place.
413 Snowflake userId{};///< The UserData id who selected the menu options.
414 };
415
416 /// SelectMenuCollector, for collecting select-menu input from one or more
417 /// @brief SelectMenuCollector, for collecting select-menu input from one
418 /// or more Users.
419 class DiscordCoreAPI_Dll SelectMenuCollector {
420 public:
421 friend class DiscordCoreClient;
422
423 static UnorderedMap<std::string, UnboundedMessageBlock<InteractionData>*> selectMenuInteractionBuffersMap;
424 static DiscordCoreInternal::TriggerEvent<void, InteractionData> selectMenuInteractionEventsMap;
425
426 /// @brief Constructor.
427 /// @param dataPackage An InputEventData structure, from the response that came from the submitted select-menu.
429
430 /// @brief Used to collect the select-menu inputs from one or more users.
431 /// @param getSelectMenuDataForAllNew Whether or not to collect select-menu input from a single target UserData or all potential users.
432 /// @param maxWaitTimeInMsNew The maximum amount of time to wait for new inputs, in milliseconds.
433 /// @param maxCollectedSelectMenuCountNew The maximum number of inputs to collect before stopping.
434 /// @param errorMessageDataNew The message-data for when an individual other than the selected individual attemps to use this interaction.
435 /// @param targetUserId The id of the single UserData to collect inputs from, if getSelectMenuDataForAllNew is set to false.
436 /// @returns A vector of SelectMenuResponseData.
437 CoRoutine<jsonifier::vector<SelectMenuResponseData>, false> collectSelectMenuData(bool getSelectMenuDataForAllNew, uint32_t maxWaitTimeInMsNew,
438 uint32_t maxCollectedSelectMenuCountNew, CreateInteractionResponseData errorMessageDataNew, Snowflake targetUserId = Snowflake{});
439
440 /// @brief Used to collect the select-menu inputs from one or more users.
441 /// @param triggerFunctionNew A std::function<bool(InteractionData)> to decide whether or not to trigger the event's main function.
442 /// @param functionNew Takes a DiscordCoreInternal::TriggerEventDelegate<void, InteractionData> as a function to be executed upon returning true from the "trigger-function".
443 void collectSelectMenuData(std::function<bool(InteractionData)> triggerFunctionNew, DiscordCoreInternal::TriggerEventDelegate<void, InteractionData> functionNew);
444
446
447 protected:
448 UnboundedMessageBlock<InteractionData> selectMenuIncomingInteractionBuffer{};
449 UniquePtr<InteractionData> interactionData{ makeUnique<InteractionData>() };
450 jsonifier::vector<SelectMenuResponseData> responseVector{};
451 CreateInteractionResponseData errorMessageData{};
452 uint32_t currentCollectedSelectMenuCount{};
453 jsonifier::vector<std::string> values{};
454 uint32_t maxCollectedSelectMenuCount{};
455 bool getSelectMenuDataForAll{};
456 std::string buffersMapKey{};
457 std::string selectMenuId{};
458 uint32_t maxTimeInMs{};
459 Snowflake channelId{};
460 Snowflake messageId{};
461 Snowflake userId{};
462 bool doWeQuit{};
463
464 void run();
465 };
466
467 /// @brief Button response data.
469 inline operator InteractionData() {
470 return *interactionData;
471 }
472
473 inline ButtonResponseData& operator=(const ButtonResponseData& other) {
474 if (this != &other) {
476 messageId = other.messageId;
477 channelId = other.channelId;
478 emojiName = other.emojiName;
479 buttonId = other.buttonId;
480 userId = other.userId;
481 }
482 return *this;
483 }
484
485 inline ButtonResponseData(const ButtonResponseData& other) {
486 *this = other;
487 }
488
489 inline ButtonResponseData& operator=(ButtonResponseData& other) {
490 if (this != &other) {
492 messageId = other.messageId;
493 channelId = other.channelId;
494 emojiName = other.emojiName;
495 buttonId = other.buttonId;
496 userId = other.userId;
497 }
498 return *this;
499 }
500
502 *this = other;
503 }
504
505 inline ButtonResponseData() = default;
506
507 UniquePtr<InteractionData> interactionData{ makeUnique<InteractionData>() };///< Interaction data.
508 std::string emojiName{};///< The emoji name, if applicable.
509 std::string buttonId{};///< The id of the button, for identification.
510 Snowflake channelId{};///< The ChannelData id where it took place.
511 Snowflake messageId{};///< The Message id where it took place.
512 Snowflake userId{};///< The UserData id who selected the menu options.
513 };
514
515 /// @brief ButtonCollector, for collecting button input from one or more Users.
516 class DiscordCoreAPI_Dll ButtonCollector {
517 public:
518 friend class DiscordCoreClient;
519
520 static UnorderedMap<std::string, UnboundedMessageBlock<InteractionData>*> buttonInteractionBuffersMap;
521 static DiscordCoreInternal::TriggerEvent<void, InteractionData> buttonInteractionEventsMap;
522
523 /// @brief Constructor.
524 /// @param dataPackage An InputEventData structure, from the response that came from the submitted button.
525 ButtonCollector(InputEventData& dataPackage);
526
527 /// @brief Used to collect the button inputs from one or more users.
528 /// @param getButtonDataForAllNew Whether or not to collect input from a single target UserData or all potential users.
529 /// @param maxWaitTimeInMsNew The maximum amount of time to wait for new inputs, in milliseconds.
530 /// @param maxNumberOfPressesNew The maximum number of inputs to collect before stopping.
531 /// @param errorMessageDataNew The message-data for when an individual other than the selected individual attemps to use this interaction.
532 /// @param targetUserId The id of the single UserData to collect inputs from, if getButtonDataForAllNew is set to false.
533 /// @returns A vector of ButtonResponseData.
534 CoRoutine<jsonifier::vector<ButtonResponseData>, false> collectButtonData(bool getButtonDataForAllNew, uint32_t maxWaitTimeInMsNew, uint32_t maxNumberOfPressesNew,
535 CreateInteractionResponseData errorMessageDataNew, Snowflake targetUserId = Snowflake{});
536
537 /// @brief Used to collect the button inputs from one or more users.
538 /// @param triggerFunctionNew A std::function<bool(InteractionData)> to decide whether or not to trigger the event's main function.
539 /// @param functionNew Takes a DiscordCoreInternal::TriggerEventDelegate<void, InteractionData> as a function to be executed upon returning true from the "trigger-function".
540 void collectButtonData(std::function<bool(InteractionData)> triggerFunctionNew, DiscordCoreInternal::TriggerEventDelegate<void, InteractionData> functionNew);
541
543
544 protected:
545 UniquePtr<InteractionData> interactionData{ makeUnique<InteractionData>() };
546 UnboundedMessageBlock<InteractionData> buttonIncomingInteractionBuffer{};
547 jsonifier::vector<ButtonResponseData> responseVector{};
548 CreateInteractionResponseData errorMessageData{};
549 jsonifier::vector<std::string> values{};
550 uint32_t currentCollectedButtonCount{};
551 uint32_t maxCollectedButtonCount{};
552 std::string buffersMapKey{};
553 bool getButtonDataForAll{};
554 uint32_t maxTimeInMs{};
555 std::string buttonId{};
556 Snowflake channelId{};
557 Snowflake messageId{};
558 Snowflake userId{};
559 bool doWeQuit{};
560
561 void run();
562 };
563
564 /// @brief Button response data.
566 inline operator InteractionData() {
567 return *interactionData;
568 }
569
570 inline ModalResponseData& operator=(const ModalResponseData& other) {
571 if (this != &other) {
574 channelId = other.channelId;
575 customId = other.customId;
576 userId = other.userId;
577 value = other.value;
578 }
579 return *this;
580 }
581
582 inline ModalResponseData(const ModalResponseData& other) {
583 *this = other;
584 }
585
586 inline ModalResponseData() = default;
587
588 UniquePtr<InteractionData> interactionData{ makeUnique<InteractionData>() };///< Interaction data.
589 std::string customIdSmall{};///< The customId of the particular input.
590 std::string customId{};///< The customId of the modal component.
591 Snowflake channelId{};///< The ChannelData id where it took place.
592 std::string value{};/// The input value of the modal component.
593 Snowflake userId{};///< The UserData id who selected the menu options.
594 };
595
596 /// @brief ModalCollector, for collecting modal text input from one or more Users.
597 class DiscordCoreAPI_Dll ModalCollector {
598 public:
599 friend class DiscordCoreClient;
600
601 static UnorderedMap<std::string, UnboundedMessageBlock<InteractionData>*> modalInteractionBuffersMap;
602 static DiscordCoreInternal::TriggerEvent<void, InteractionData> modalInteractionEventsMap;
603
604 /// @brief Constructor.
605 /// @param dataPackage An InputEventData structure, from the response that came from the submitted button.
606 ModalCollector(InputEventData& dataPackage);
607
608 /// @brief Used to collect the button inputs from one or more users.
609 /// @param maxWaitTimeInMsNew The maximum amount of time to wait for new inputs, in milliseconds.
610 /// @returns A vector of ButtonResponseData.
611 CoRoutine<ModalResponseData, false> collectModalData(uint32_t maxWaitTimeInMsNew);
612
613 /// @brief Used to collect the modal from one or more users.
614 /// @param triggerFunctionNew A std::function<bool(InteractionData)> to decide whether or not to trigger the event's main function.
615 /// @param functionNew Takes a DiscordCoreInternal::TriggerEventDelegate<void, InteractionData> as a function to be executed upon returning true from the "trigger-function".
616 void collectModalData(std::function<bool(InteractionData)> triggerFunctionNew, DiscordCoreInternal::TriggerEventDelegate<void, InteractionData> functionNew);
617
619
620 protected:
621 UnboundedMessageBlock<InteractionData> modalIncomingInteractionBuffer{};
622 CreateInteractionResponseData errorMessageData{};
623 uint32_t currentCollectedButtonCount{};
624 ModalResponseData responseData{};
625 uint32_t maxTimeInMs{};
626 Snowflake channelId{};
627 bool doWeQuit{};
628
629 void run();
630 };
631
632 /**@}*/
633};
InteractionCallbackType
Interaction callback types.
A CoRoutine - representing a potentially asynchronous operation/function.
Definition: CoRoutine.hpp:88
DiscordCoreClient - The main class for this library.
Class for handling the assignment of event-handling functions.int32_t.
For storing Interaction-related values.
For storing MessageData-related values.
Data structure representing a single MessageData.
Data representing an input-event, which is any Message or Interaction that is coming into the bot as ...
Data for responding to an input-event.
For handling UserData input - Messages or Interactions.
Definition: InputEvents.hpp:44
For creating an ephemeral Interaction response.
For creating a deferred Interaction response.
For creating an Interaction response.
For getting an Interaction response.
std::string interactionToken
Interaction token.
For editing an Interaction response.
For deleting an Interaction response.
For creating an ephemeral follow up MessageData.
For creating a follow up MessageData.
For getting a follow-up MessageData.
std::string interactionToken
Interaction token.
For editing a follow up MessageData.
For deleting a follow up MessageData.
An interface class for the Interaction related Discord endpoints.
jsonifier::vector< std::string > values
A vector of the chosen values.
UniquePtr< InteractionData > interactionData
Interaction data.
Snowflake channelId
The ChannelData id where it took place.
Snowflake userId
The UserData id who selected the menu options.
Snowflake messageId
The Message id where it took place.
SelectMenuCollector, for collecting select-menu input from one or more Users.
Snowflake channelId
The ChannelData id where it took place.
std::string buttonId
The id of the button, for identification.
UniquePtr< InteractionData > interactionData
Interaction data.
Snowflake messageId
The Message id where it took place.
Snowflake userId
The UserData id who selected the menu options.
std::string emojiName
The emoji name, if applicable.
ButtonCollector, for collecting button input from one or more Users.
Snowflake channelId
The ChannelData id where it took place.
Snowflake userId
The input value of the modal component.
UniquePtr< InteractionData > interactionData
Interaction data.
std::string customIdSmall
The customId of the particular input.
std::string customId
The customId of the modal component.
ModalCollector, for collecting modal text input from one or more Users.
For editing a WebHook MessageData.
A class representing a Snowflake identifier with various operations.
Definition: Base.hpp:771
Event-delegate, for representing an event-function to be executed conditionally.
A trigger event that fires based on the result of trigger-function return value.
A thread-safe messaging block for data-structures.
A smart pointer class that provides unique ownership semantics.
Definition: UniquePtr.hpp:49