DiscordCoreAPI
A Discord bot library written in C++, with custom asynchronous coroutines.
Loading...
Searching...
No Matches
ReactionEntities.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/// ReactionEntities.hpp - Header for the reaction_data related classes and structs.
27/// May 13, 2021
28/// https://discordcoreapi.com
29/// \file ReactionEntities.hpp
30#pragma once
31
35
36namespace discord_core_api {
37
38 using reaction_collector = object_collector<reaction_data>;
39
40 /**
41 * \addtogroup foundation_entities
42 * @{
43 */
44
45 /// @brief For creating a single reaction_data.
47 jsonifier::string emojiName{};///< The emoji name of the reaction_data to add.
48 snowflake channelId{};///< The channel_data for which to add the reaction_data.
49 snowflake messageId{};///< The message on which to add the reaction_data.
50 snowflake emojiId{};///< The emoji id of the reaction_data to add.
51 };
52
53 /// @brief For deleting one's own reaction_data.
55 jsonifier::string emojiName{};///< The emoji name for which to remove the emoji.
56 snowflake channelId{};///< The channel_data from which to remove the reaction_data.
57 snowflake messageId{};///< The message from which to remove the reaction_data.
58 snowflake emojiId{};///< The emoji id for which to remove the emoji.
59 };
60
61 /// @brief For deleting a reaction, by user_data.
63 jsonifier::string emojiName{};///< The name of which emoji to remove.
64 snowflake channelId{};///< The channel_data from which to remove the reaction_data.
65 snowflake messageId{};///< The message from which to remove the reaction_data.
66 snowflake emojiId{};///< The id of which emoji to remove.
67 snowflake userId{};///< The user_data id for whom to remove their emoji.
68 };
69
70 /// @brief For getting all of the reactions.
72 snowflake channelId{};///< The channel_data from which to acquire the reactors.
73 snowflake messageId{};///< The message from which to acquire the reactors.
74 snowflake afterId{};///< Get users after this user id.
75 jsonifier::string emoji{};///< The emoji name for which to acquire the reactors.
76 int32_t limit{};///< The maximum number of reactors to collect.
77 };
78
79 /// @brief For deleting all of the reactions on a particular message_data.
81 snowflake channelId{};///< The channel_data from which you would like to remove the emoji.
82 snowflake messageId{};///< The message from which you would like to remove the emoji.
83 };
84
85 /// @brief For deleting all of the reactions of a particular emoji.
87 jsonifier::string emojiName{};///< The name of which emoji to remove.
88 snowflake channelId{};///< The channel_data from which you would like to remove the emoji.
89 snowflake messageId{};///< The message from which you would like to remove the emoji.
90 snowflake emojiId{};///< The id of which emoji to remove.
91 };
92
93 /// for collecting a list of emoji from a guild.
95 snowflake guildId{};///< The id of the chosen guild.
96 };
97
98 /// for collecting a single guild emoji.
100 snowflake guildId{};///< The id of the chosen guild.
101 snowflake emojiId{};///< The id of the chosen emoji
102 };
103
104 enum class image_type {
105 jpg = 0,
106 png = 1,
107 gif = 2,
108 };
109
110 /// for creating a new guild emoji.
112 template<typename value_type> friend struct jsonifier::core;
113 friend class reactions;
114
115 jsonifier::vector<snowflake> roles{};///< Roles that can use this emoji.
116 jsonifier::string imageFilePath{};///< The image responseData.
117 jsonifier::string reason{};///< Reason for creating the new emoji.
118 snowflake guildId{};///< The guild within which to create the emoji.
119 jsonifier::string name{};///< Name of the emoji.
120 image_type type{};///< The type of image being uploaded.
121
122 protected:
123 jsonifier::string imageDataFinal{};
124 };
125
126 /// for modifying a guild emoji.
128 jsonifier::vector<snowflake> roles{};///< Roles that can use this emoji.
129 jsonifier::string reason{};///< Reason for modifying the emoji.
130 snowflake guildId{};///< The guild within which to modify the emoji.
131 snowflake emojiId{};///< The id of the emoji to modify.
132 jsonifier::string name{};///< Name of the emoji.
133 };
134
135 /// for deleting a guild emoji.
137 jsonifier::string reason{};///< Reason for deleting the emoji.
138 snowflake guildId{};///< The guild within which to delete the emoji.
139 snowflake emojiId{};///< The id of the emoji to delete.
140 };
141
142 /**@}*/
143
144 /**
145 * \addtogroup main_endpoints
146 * @{
147 */
148 /// @brief An interface class for the reaction_data related discord endpoints.
149 class DiscordCoreAPI_Dll reactions {
150 public:
151 static void initialize(discord_core_internal::https_client*);
152
153 /// @brief Creates a reaction_data on a message.
154 /// @param dataPackage a create_reaction_data structure.
155 /// @return a co_routine containing a reaction_data.
156 static co_routine<reaction_data> createReactionAsync(create_reaction_data dataPackage);
157
158 /// @brief Deletes your own reactions from a given message_data.
159 /// @param dataPackage a delete_own_reaction_data structure.
160 /// @return a co_routine containing void.
161 static co_routine<void> deleteOwnReactionAsync(delete_own_reaction_data dataPackage);
162
163 /// @brief Deletes all of the reactions by a specific user_data from a given message_data.
164 /// @param dataPackage a delete_user_reaction_data structure.
165 /// @return a co_routine containing void.
166 static co_routine<void> deleteUserReactionAsync(delete_user_reaction_data dataPackage);
167
168 /// @brief Get a list of users that reacted with this emoji. returns An array of user objects on success.
169 /// @param dataPackage a get_reactions_data structure.
170 /// @return a co_routine containing a jsonifier::vector<user_data>.
171 static co_routine<jsonifier::vector<user_data>> getReactionsAsync(get_reactions_data dataPackage);
172
173 /// @brief Deletes all of the reactions from a given message_data.
174 /// @param dataPackage a delete_all_reactions_data structure.
175 /// @return a co_routine containing void.
176 static co_routine<void> deleteAllReactionsAsync(delete_all_reactions_data dataPackage);
177
178 /// @brief Deletes all of the reactions by a specific emoji from a given message_data.
179 /// @param dataPackage a delete_reactions_by_emoji_data structure.
180 /// @return a co_routine containing void.
181 static co_routine<void> deleteReactionsByEmojiAsync(delete_reactions_by_emoji_data dataPackage);
182
183 /// @brief Collects a list of guild emoji from a chosen guild.
184 /// @param dataPackage a get_emoji_list_data structure.
185 /// @return a co_routine containing a jsonifier::vector<emoji_data>.
186 static co_routine<jsonifier::vector<emoji_data>> getEmojiListAsync(get_emoji_list_data dataPackage);
187
188 /// @brief Collects a single guild emoji from a chosen guild.
189 /// @param dataPackage a get_guild_emoji_data structure.
190 /// @return a co_routine containing an emoji_data.
191 static co_routine<emoji_data> getGuildEmojiAsync(get_guild_emoji_data dataPackage);
192
193 /// @brief Creates a single guild emoji within a chosen guild.
194 /// @param dataPackage a create_guild_emoji_data structure.
195 /// @return a co_routine containing an emoji_data.
196 static co_routine<emoji_data> createGuildEmojiAsync(create_guild_emoji_data dataPackage);
197
198 /// @brief Modifies a single guild emoji within a chosen guild.
199 /// @param dataPackage a modify_guild_emoji_data structure.
200 /// @return a co_routine containing an emoji_data.
201 static co_routine<emoji_data> modifyGuildEmojiAsync(modify_guild_emoji_data dataPackage);
202
203 /// @brief Deletes a single guild emoji within a chosen guild.
204 /// @param dataPackage a delete_guild_emoji_data structure.
205 /// @return a co_routine containing void.
206 static co_routine<void> deleteGuildEmojiAsync(delete_guild_emoji_data dataPackage);
207
208 protected:
209 static discord_core_internal::https_client* httpsClient;
210 };
211 /**@}*/
212}
Object collector, for collecting objects from a channel.
An interface class for the reaction_data related discord endpoints.
The main namespace for the forward-facing interfaces.
snowflake guildId
The guild within which to create the emoji.
jsonifier::string reason
Reason for creating the new emoji.
image_type type
The type of image being uploaded.
jsonifier::string imageFilePath
The image responseData.
jsonifier::vector< snowflake > roles
Roles that can use this emoji.
jsonifier::string name
Name of the emoji.
For creating a single reaction_data.
snowflake emojiId
The emoji id of the reaction_data to add.
snowflake messageId
The message on which to add the reaction_data.
jsonifier::string emojiName
The emoji name of the reaction_data to add.
snowflake channelId
The channel_data for which to add the reaction_data.
For deleting all of the reactions on a particular message_data.
snowflake channelId
The channel_data from which you would like to remove the emoji.
snowflake messageId
The message from which you would like to remove the emoji.
jsonifier::string reason
Reason for deleting the emoji.
snowflake guildId
The guild within which to delete the emoji.
snowflake emojiId
The id of the emoji to delete.
For deleting one's own reaction_data.
snowflake messageId
The message from which to remove the reaction_data.
jsonifier::string emojiName
The emoji name for which to remove the emoji.
snowflake channelId
The channel_data from which to remove the reaction_data.
snowflake emojiId
The emoji id for which to remove the emoji.
For deleting all of the reactions of a particular emoji.
snowflake emojiId
The id of which emoji to remove.
snowflake messageId
The message from which you would like to remove the emoji.
snowflake channelId
The channel_data from which you would like to remove the emoji.
jsonifier::string emojiName
The name of which emoji to remove.
For deleting a reaction, by user_data.
snowflake emojiId
The id of which emoji to remove.
snowflake messageId
The message from which to remove the reaction_data.
snowflake channelId
The channel_data from which to remove the reaction_data.
jsonifier::string emojiName
The name of which emoji to remove.
snowflake userId
The user_data id for whom to remove their emoji.
for collecting a list of emoji from a guild.
snowflake guildId
The id of the chosen guild.
for collecting a single guild emoji.
snowflake guildId
The id of the chosen guild.
snowflake emojiId
The id of the chosen emoji.
For getting all of the reactions.
snowflake messageId
The message from which to acquire the reactors.
snowflake channelId
The channel_data from which to acquire the reactors.
int32_t limit
The maximum number of reactors to collect.
jsonifier::string emoji
The emoji name for which to acquire the reactors.
snowflake afterId
Get users after this user id.
jsonifier::vector< snowflake > roles
Roles that can use this emoji.
jsonifier::string reason
Reason for modifying the emoji.
snowflake guildId
The guild within which to modify the emoji.
snowflake emojiId
The id of the emoji to modify.
jsonifier::string name
Name of the emoji.