DiscordCoreAPI
A Discord bot library written in C++, with custom asynchronous coroutines.
Loading...
Searching...
No Matches
EventManager.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/// EventManager.cpp - Header for the event manager class.
27/// Jun 7, 2021
28/// https://discordcoreapi.com
29/// \file EventManager.cpp
30
35
36namespace jsonifier {
37
38 template<> struct core<discord_core_api::auto_moderation_action_execution_event_data> {
39 using value_type = discord_core_api::auto_moderation_action_execution_event_data;
40 static constexpr auto parseValue = createValue("alert_system_message_id", &value_type::alertSystemMessageId, "rule_trigger_type", &value_type::ruleTriggerType,
41 "matched_keyword", &value_type::matchedKeyword, "matched_content", &value_type::matchedContent, "content", &value_type::content, "channel_id", &value_type::channelId,
42 "message_id", &value_type::messageId, "action", &value_type::action, "guild_id", &value_type::guildId, "rule_id", &value_type::ruleId, "user_id", &value_type::userId);
43 };
44
45 template<> struct core<discord_core_api::voice_state_data> {
46 using value_type2 = discord_core_api::voice_state_data;
47 static constexpr auto parseValue =
48 createValue("request_to_speak_timestamp", &value_type2::requestToSpeakTimestamp, "session_id", &value_type2::sessionId, "self_stream", &value_type2::selfStream,
49 "self_video", &value_type2::selfVideo, "self_deaf", &value_type2::selfDeaf, "self_mute", &value_type2::selfMute, "suppress", &value_type2::suppress, "deaf",
50 &value_type2::deaf, "mute", &value_type2::mute, "user_id", &value_type2::userId, "channel_id", &value_type2::channelId, "guild_id", &value_type2::guildId);
51 };
52
53 template<> struct core<discord_core_api::guild_emojis_update_event_data> {
54 using value_type = discord_core_api::guild_emojis_update_event_data;
55 static constexpr auto parseValue = createValue("emojis", &value_type::emojis, "guild_id", &value_type::guildId);
56 };
57
58 template<> struct core<discord_core_api::channel_pins_update_event_data> {
59 using value_type = discord_core_api::channel_pins_update_event_data;
60 static constexpr auto parseValue =
61 createValue("last_pin_timestamp", &value_type::lastPinTimeStamp, "channel_id", &value_type::channelId, "guild_id", &value_type::guildId);
62 };
63
64 template<> struct core<discord_core_api::typing_start_data> {
65 using value_type = discord_core_api::typing_start_data;
66 static constexpr auto parseValue = createValue("member", &value_type::member, "channel_id", &value_type::channelId, "guild_id", &value_type::guildId, "timestamp",
67 &value_type::timeStamp, "user_id", &value_type::userId);
68 };
69
70 template<> struct core<discord_core_api::reaction_remove_data> {
71 using value_type = discord_core_api::reaction_remove_data;
72 static constexpr auto parseValue = createValue("channel_id", &value_type::channelId, "message_id", &value_type::messageId, "guild_id", &value_type::guildId, "user_id",
73 &value_type::userId, "emoji", &value_type::emoji);
74 };
75
76 template<> struct core<discord_core_api::guild_stickers_update_event_data> {
77 using value_type = discord_core_api::guild_stickers_update_event_data;
78 static constexpr auto parseValue = createValue("stickers", &value_type::stickers, "guild_id", &value_type::guildId);
79 };
80
81 template<> struct core<discord_core_api::voice_server_update_data> {
82 using value_type = discord_core_api::voice_server_update_data;
83 static constexpr auto parseValue = createValue("endpoint", &value_type::endpoint, "guild_id", &value_type::guildId, "token", &value_type::token);
84 };
85
86 template<> struct core<discord_core_api::guild_members_chunk_event_data> {
87 using value_type = discord_core_api::guild_members_chunk_event_data;
88 static constexpr auto parseValue = createValue("presences", &value_type::presences, "members", &value_type::members, "not_found", &value_type::notFound, "chunk_index",
89 &value_type::chunkIndex, "chunk_count", &value_type::chunkCount, "guild_id", &value_type::guildId, "nonce", &value_type::nonce);
90 };
91
92 template<> struct core<discord_core_api::guild_member_remove_data> {
93 using value_type = discord_core_api::guild_member_remove_data;
94 static constexpr auto parseValue = createValue("guild_id", &value_type::guildId, "user", &value_type::user);
95 };
96
97 template<> struct core<discord_core_api::guild_ban_add_data> {
98 using value_type = discord_core_api::guild_ban_add_data;
99 static constexpr auto parseValue = createValue("guild_id", &value_type::guildId, "user", &value_type::user);
100 };
101
102 template<> struct core<discord_core_api::guild_ban_remove_data> {
103 using value_type = discord_core_api::guild_ban_remove_data;
104 static constexpr auto parseValue = createValue("guild_id", &value_type::guildId, "user", &value_type::user);
105 };
106
107 template<> struct core<discord_core_api::role_creation_data> {
108 using value_type = discord_core_api::role_creation_data;
109 static constexpr auto parseValue = createValue("guild_id", &value_type::guildId, "role", &value_type::role);
110 };
111
112 template<> struct core<discord_core_api::role_update_data> {
113 using value_type = discord_core_api::role_update_data;
114 static constexpr auto parseValue = createValue("guild_id", &value_type::guildId, "role", &value_type::role);
115 };
116
117 template<> struct core<discord_core_api::role_deletion_data> {
118 using value_type = discord_core_api::role_deletion_data;
119 static constexpr auto parseValue = createValue("guild_id", &value_type::guildId, "role", &value_type::role);
120 };
121
122 template<> struct core<discord_core_api::guild_scheduled_event_user_add_data> {
123 using value_type = discord_core_api::guild_scheduled_event_user_add_data;
124 static constexpr auto parseValue =
125 createValue("guild_scheduled_event_id", &value_type::guildScheduledEventId, "guild_id", &value_type::guildId, "user_id", &value_type::userId);
126 };
127
128 template<> struct core<discord_core_api::guild_scheduled_event_user_remove_data> {
129 using value_type = discord_core_api::guild_scheduled_event_user_remove_data;
130 static constexpr auto parseValue =
131 createValue("guild_scheduled_event_id", &value_type::guildScheduledEventId, "guild_id", &value_type::guildId, "user_id", &value_type::userId);
132 };
133
134 template<> struct core<discord_core_api::integration_creation_data> {
135 using value_type = discord_core_api::integration_creation_data;
136 static constexpr auto parseValue = createValue("integration_data", &value_type::integrationData, "guild_id", &value_type::guildId);
137 };
138
139 template<> struct core<discord_core_api::integration_update_data> {
140 using value_type = discord_core_api::integration_update_data;
141 static constexpr auto parseValue = createValue("integration_data", &value_type::integrationData, "guild_id", &value_type::guildId);
142 };
143
144 template<> struct core<discord_core_api::integration_deletion_data> {
145 using value_type = discord_core_api::integration_deletion_data;
146 static constexpr auto parseValue = createValue("application_id", &value_type::applicationId, "guild_id", &value_type::guildId, "id", &value_type::id);
147 };
148
149 template<> struct core<discord_core_api::invite_deletion_data> {
150 using value_type = discord_core_api::invite_deletion_data;
151 static constexpr auto parseValue = createValue("channel_id", &value_type::channelId, "guild_id", &value_type::guildId, "code", &value_type::code);
152 };
153
154 template<> struct core<discord_core_api::message_deletion_data> {
155 using value_type = discord_core_api::message_deletion_data;
156 static constexpr auto parseValue = createValue("message_id", &value_type::messageId, "channel_id", &value_type::channelId, "guild_id", &value_type::guildId);
157 };
158
159 template<> struct core<discord_core_api::message_deletion_bulk_data> {
160 using value_type = discord_core_api::message_deletion_bulk_data;
161 static constexpr auto parseValue = createValue("ids", &value_type::ids, "channel_id", &value_type::channelId, "guild_id", &value_type::guildId);
162 };
163
164 template<> struct core<discord_core_api::reaction_remove_all_data> {
165 using value_type = discord_core_api::reaction_remove_all_data;
166 static constexpr auto parseValue = createValue("channel_id", &value_type::channelId, "message_id", &value_type::messageId, "guild_id", &value_type::guildId);
167 };
168
169 template<> struct core<discord_core_api::reaction_remove_emoji_data> {
170 using value_type = discord_core_api::reaction_remove_emoji_data;
171 static constexpr auto parseValue =
172 createValue("message_id", &value_type::messageId, "channel_id", &value_type::channelId, "guild_id", &value_type::guildId, "emoji", &value_type::emoji);
173 };
174
175 template<> struct core<discord_core_api::web_hook_update_data> {
176 using value_type = discord_core_api::web_hook_update_data;
177 static constexpr auto parseValue = createValue("channel_id", &value_type::channelId, "guild_id", &value_type::guildId);
178 };
179
180}
181
182namespace discord_core_api {
183
184 template<> unordered_map<jsonifier::string, unbounded_message_block<message_data>*> object_collector<message_data>::objectsBuffersMap;
185
186 template<> unordered_map<jsonifier::string, unbounded_message_block<reaction_data>*> object_collector<reaction_data>::objectsBuffersMap;
187
188 on_input_event_creation_data::on_input_event_creation_data(jsonifier::jsonifier_core<false>& parserNew, jsonifier::string_view_base<uint8_t> dataToParse) {
189 parserNew.parseJson(*static_cast<event_data*>(this), dataToParse);
190 if (auto result = parserNew.getErrors(); result.size() > 0) {
191 for (auto& valueNew: result) {
193 }
194 }
195 }
196
197 on_application_command_permissions_update_data::on_application_command_permissions_update_data(jsonifier::jsonifier_core<false>& parserNew,
198 jsonifier::string_view_base<uint8_t> dataToParse) {
199 parserNew.parseJson(*static_cast<event_data*>(this), dataToParse);
200 if (auto result = parserNew.getErrors(); result.size() > 0) {
201 for (auto& valueNew: result) {
203 }
204 }
205 }
206
207 on_auto_moderation_rule_creation_data::on_auto_moderation_rule_creation_data(jsonifier::jsonifier_core<false>& parserNew, jsonifier::string_view_base<uint8_t> dataToParse) {
208 parserNew.parseJson(*static_cast<event_data*>(this), dataToParse);
209 if (auto result = parserNew.getErrors(); result.size() > 0) {
210 for (auto& valueNew: result) {
212 }
213 }
214 }
215
216 on_auto_moderation_rule_update_data::on_auto_moderation_rule_update_data(jsonifier::jsonifier_core<false>& parserNew, jsonifier::string_view_base<uint8_t> dataToParse) {
217 parserNew.parseJson(*static_cast<event_data*>(this), dataToParse);
218 if (auto result = parserNew.getErrors(); result.size() > 0) {
219 for (auto& valueNew: result) {
221 }
222 }
223 }
224
225 on_auto_moderation_rule_deletion_data::on_auto_moderation_rule_deletion_data(jsonifier::jsonifier_core<false>& parserNew, jsonifier::string_view_base<uint8_t> dataToParse) {
226 parserNew.parseJson(*static_cast<event_data*>(this), dataToParse);
227 if (auto result = parserNew.getErrors(); result.size() > 0) {
228 for (auto& valueNew: result) {
230 }
231 }
232 }
233
234 on_auto_moderation_action_execution_data::on_auto_moderation_action_execution_data(jsonifier::jsonifier_core<false>& parserNew, jsonifier::string_view_base<uint8_t> dataToParse) {
235 parserNew.parseJson(*static_cast<event_data*>(this), dataToParse);
236 if (auto result = parserNew.getErrors(); result.size() > 0) {
237 for (auto& valueNew: result) {
239 }
240 }
241 }
242
243 on_channel_creation_data::on_channel_creation_data(jsonifier::jsonifier_core<false>& parserNew, jsonifier::string_view_base<uint8_t> dataToParse) {
244 parserNew.parseJson(*static_cast<event_data*>(this), dataToParse);
245 if (auto result = parserNew.getErrors(); result.size() > 0) {
246 for (auto& valueNew: result) {
248 }
249 }
250 if (channels::doWeCacheChannels()) {
251 channels::insertChannel(static_cast<channel_cache_data>(value));
252 }
253 if (guilds::doWeCacheGuilds()) {
254 if (guilds::getCache().contains(value.guildId)) {
255 guilds::getCache()[value.guildId].channels.emplace_back(value.id);
256 }
257 }
258 }
259
260 on_channel_update_data::on_channel_update_data(jsonifier::jsonifier_core<false>& parserNew, jsonifier::string_view_base<uint8_t> dataToParse) {
261 parserNew.parseJson(*static_cast<updated_event_data*>(this), dataToParse);
262 if (channels::doWeCacheChannels()) {
263 oldValue = channels::getCachedChannel({ .channelId = value.id });
264 channels::insertChannel(static_cast<channel_cache_data>(value));
265 }
266 }
267
268 on_channel_deletion_data::on_channel_deletion_data(jsonifier::jsonifier_core<false>& parserNew, jsonifier::string_view_base<uint8_t> dataToParse) {
269 parserNew.parseJson(*static_cast<event_data*>(this), dataToParse);
270 if (auto result = parserNew.getErrors(); result.size() > 0) {
271 for (auto& valueNew: result) {
273 }
274 }
275 if (channels::doWeCacheChannels()) {
276 channels::removeChannel(static_cast<channel_cache_data>(value));
277 }
278 if (guilds::doWeCacheGuilds()) {
279 if (guilds::getCache().contains(value.guildId)) {
280 for (uint64_t x = 0; x < guilds::getCache().operator[](value.guildId).channels.size(); ++x) {
281 if (guilds::getCache().operator[](value.guildId).channels.at(x) == static_cast<uint64_t>(value.id)) {
282 guilds::getCache().operator[](value.guildId).channels.erase(guilds::getCache().operator[](value.guildId).channels.begin() + static_cast<int64_t>(x));
283 }
284 }
285 }
286 }
287 }
288
289 on_channel_pins_update_data::on_channel_pins_update_data(jsonifier::jsonifier_core<false>& parserNew, jsonifier::string_view_base<uint8_t> dataToParse) {
290 parserNew.parseJson(*static_cast<event_data*>(this), dataToParse);
291 if (auto result = parserNew.getErrors(); result.size() > 0) {
292 for (auto& valueNew: result) {
294 }
295 }
296 }
297
298 on_thread_creation_data::on_thread_creation_data(jsonifier::jsonifier_core<false>& parserNew, jsonifier::string_view_base<uint8_t> dataToParse) {
299 parserNew.parseJson(*static_cast<event_data*>(this), dataToParse);
300 if (auto result = parserNew.getErrors(); result.size() > 0) {
301 for (auto& valueNew: result) {
303 }
304 }
305 }
306
307 on_thread_update_data::on_thread_update_data(jsonifier::jsonifier_core<false>& parserNew, jsonifier::string_view_base<uint8_t> dataToParse) {
308 parserNew.parseJson(*static_cast<event_data*>(this), dataToParse);
309 if (auto result = parserNew.getErrors(); result.size() > 0) {
310 for (auto& valueNew: result) {
312 }
313 }
314 }
315
316 on_thread_deletion_data::on_thread_deletion_data(jsonifier::jsonifier_core<false>& parserNew, jsonifier::string_view_base<uint8_t> dataToParse) {
317 parserNew.parseJson(*static_cast<event_data*>(this), dataToParse);
318 if (auto result = parserNew.getErrors(); result.size() > 0) {
319 for (auto& valueNew: result) {
321 }
322 }
323 }
324
325 on_thread_list_sync_data::on_thread_list_sync_data(jsonifier::jsonifier_core<false>& parserNew, jsonifier::string_view_base<uint8_t> dataToParse) {
326 parserNew.parseJson(*static_cast<event_data*>(this), dataToParse);
327 if (auto result = parserNew.getErrors(); result.size() > 0) {
328 for (auto& valueNew: result) {
330 }
331 }
332 }
333
334 on_thread_member_update_data::on_thread_member_update_data(jsonifier::jsonifier_core<false>& parserNew, jsonifier::string_view_base<uint8_t> dataToParse) {
335 parserNew.parseJson(*static_cast<event_data*>(this), dataToParse);
336 if (auto result = parserNew.getErrors(); result.size() > 0) {
337 for (auto& valueNew: result) {
339 }
340 }
341 }
342
343 on_thread_members_update_data::on_thread_members_update_data(jsonifier::jsonifier_core<false>& parserNew, jsonifier::string_view_base<uint8_t> dataToParse) {
344 parserNew.parseJson(*static_cast<event_data*>(this), dataToParse);
345 if (auto result = parserNew.getErrors(); result.size() > 0) {
346 for (auto& valueNew: result) {
348 }
349 }
350 }
351
352 on_guild_creation_data::on_guild_creation_data(jsonifier::jsonifier_core<false>& parserNew, jsonifier::string_view_base<uint8_t> dataToParse) {
353 parserNew.parseJson(*static_cast<event_data*>(this), dataToParse);
354 if (auto result = parserNew.getErrors(); result.size() > 0) {
355 for (auto& valueNew: result) {
357 }
358 }
359 if (guild_members::doWeCacheGuildMembers()) {
360 for (auto& valueNew: value.members) {
361 try {
362 valueNew.guildId = value.id;
363 guild_members::insertGuildMember(static_cast<guild_member_cache_data>(valueNew));
364 } catch (...) {
365 message_printer::printError<print_message_type::general>("on_guild_creation_data::on_guild_creation_data()");
366 }
367 }
368 }
369 if (users::doWeCacheUsers()) {
370 for (auto& valueNew: value.members) {
371 try {
372 if (users::doWeCacheUsers()) {
373 users::insertUser(static_cast<user_cache_data>(valueNew.user));
374 }
375 } catch (...) {
376 message_printer::printError<print_message_type::general>("on_guild_creation_data::on_guild_creation_data()");
377 }
378 }
379 }
380 if (guild_members::doWeCacheVoiceStates()) {
381 for (auto& valueNew: value.voiceStates) {
382 try {
383 valueNew.guildId = value.id;
384 guild_members::insertVoiceState(static_cast<voice_state_data_light>(valueNew));
385 guild_member_data newMember{};
386 newMember.guildId = value.id;
387 newMember.user.id = valueNew.userId;
388 two_id_key newKey{ newMember };
389 } catch (...) {
390 message_printer::printError<print_message_type::general>("on_guild_creation_data::on_guild_creation_data()");
391 }
392 }
393 }
394 if (channels::doWeCacheChannels()) {
395 for (auto& valueNew: value.channels) {
396 try {
397 valueNew.guildId = value.id;
398 channels::insertChannel(static_cast<channel_cache_data>(valueNew));
399 } catch (...) {
400 message_printer::printError<print_message_type::general>("on_guild_creation_data::on_guild_creation_data()");
401 }
402 }
403 }
404 if (roles::doWeCacheRoles()) {
405 for (auto& valueNew: value.roles) {
406 try {
407 roles::insertRole(static_cast<role_cache_data>(valueNew));
408 } catch (...) {
409 message_printer::printError<print_message_type::general>("on_guild_creation_data::on_guild_creation_data()");
410 }
411 }
412 }
413 if (guilds::doWeCacheGuilds()) {
414 guilds::insertGuild(static_cast<guild_cache_data>(value));
415 }
416 }
417
418 on_guild_update_data::on_guild_update_data(jsonifier::jsonifier_core<false>& parserNew, jsonifier::string_view_base<uint8_t> dataToParse) {
419 parserNew.parseJson(*static_cast<updated_event_data*>(this), dataToParse);
420 if (guilds::doWeCacheGuilds()) {
421 oldValue = guilds::getCachedGuild({ value.id });
422 guilds::insertGuild(static_cast<guild_cache_data>(value));
423 }
424 }
425
426 on_guild_deletion_data::on_guild_deletion_data(jsonifier::jsonifier_core<false>& parserNew, jsonifier::string_view_base<uint8_t> dataToParse) {
427 parserNew.parseJson(*static_cast<event_data*>(this), dataToParse);
428 if (auto result = parserNew.getErrors(); result.size() > 0) {
429 for (auto& valueNew: result) {
431 }
432 }
433 for (auto& valueNew: value.members) {
434 guild_members::removeGuildMember(valueNew);
435 }
436 for (auto& valueNew: value.channels) {
437 channels::removeChannel(valueNew);
438 }
439 for (auto& valueNew: value.roles) {
440 roles::removeRole(valueNew);
441 }
442 if (guilds::doWeCacheGuilds()) {
443 guilds::removeGuild(value);
444 }
445 }
446
447 on_guild_ban_add_data::on_guild_ban_add_data(jsonifier::jsonifier_core<false>& parserNew, jsonifier::string_view_base<uint8_t> dataToParse) {
448 parserNew.parseJson(*static_cast<event_data*>(this), dataToParse);
449 if (auto result = parserNew.getErrors(); result.size() > 0) {
450 for (auto& valueNew: result) {
452 }
453 }
454 if (guilds::getCache().contains(value.guildId)) {
455 for (uint64_t x = 0; x < guilds::getCache().operator[](value.guildId).members.size(); ++x) {
456 if (guilds::getCache().operator[](value.guildId).members.at(x) == static_cast<uint64_t>(value.user.id)) {
457 guilds::getCache().operator[](value.guildId).members.erase(guilds::getCache().operator[](value.guildId).members.begin() + static_cast<int64_t>(x));
458 --guilds::getCache()[value.guildId].memberCount;
459 }
460 }
461 }
462 }
463
464 on_guild_ban_remove_data::on_guild_ban_remove_data(jsonifier::jsonifier_core<false>& parserNew, jsonifier::string_view_base<uint8_t> dataToParse) {
465 parserNew.parseJson(*static_cast<event_data*>(this), dataToParse);
466 if (auto result = parserNew.getErrors(); result.size() > 0) {
467 for (auto& valueNew: result) {
469 }
470 }
471 }
472
473 on_guild_emojis_update_data::on_guild_emojis_update_data(jsonifier::jsonifier_core<false>& parserNew, jsonifier::string_view_base<uint8_t> dataToParse) {
474 parserNew.parseJson(*static_cast<event_data*>(this), dataToParse);
475 if (auto result = parserNew.getErrors(); result.size() > 0) {
476 for (auto& valueNew: result) {
478 }
479 }
480 if (guilds::getCache().contains(value.guildId)) {
481 guilds::getCache()[value.guildId].emoji.clear();
482 for (auto& valueNew: value.emojis) {
483 guilds::getCache()[value.guildId].emoji.emplace_back(valueNew.id);
484 }
485 }
486 }
487
488 on_guild_stickers_update_data::on_guild_stickers_update_data(jsonifier::jsonifier_core<false>& parserNew, jsonifier::string_view_base<uint8_t> dataToParse) {
489 parserNew.parseJson(*static_cast<event_data*>(this), dataToParse);
490 if (auto result = parserNew.getErrors(); result.size() > 0) {
491 for (auto& valueNew: result) {
493 }
494 }
495 }
496
497 on_guild_integrations_update_data::on_guild_integrations_update_data(jsonifier::jsonifier_core<false>& parserNew, jsonifier::string_view_base<uint8_t> dataToParse) {
498 parserNew.parseJson(*static_cast<event_data*>(this), dataToParse);
499 if (auto result = parserNew.getErrors(); result.size() > 0) {
500 for (auto& valueNew: result) {
502 }
503 }
504 }
505
506 on_guild_member_add_data::on_guild_member_add_data(jsonifier::jsonifier_core<false>& parserNew, jsonifier::string_view_base<uint8_t> dataToParse) {
507 parserNew.parseJson(*static_cast<event_data*>(this), dataToParse);
508 if (auto result = parserNew.getErrors(); result.size() > 0) {
509 for (auto& valueNew: result) {
511 }
512 }
513 if (guild_members::doWeCacheGuildMembers()) {
514 guild_members::insertGuildMember(static_cast<guild_member_cache_data>(value));
515 }
516 if (guilds::doWeCacheGuilds()) {
517 if (guilds::getCache().contains(value.guildId)) {
518 ++guilds::getCache()[value.guildId].memberCount;
519 guilds::getCache()[value.guildId].members.emplace_back(value.user.id);
520 }
521 }
522 }
523
524 on_guild_member_remove_data::on_guild_member_remove_data(jsonifier::jsonifier_core<false>& parserNew, jsonifier::string_view_base<uint8_t> dataToParse) {
525 parserNew.parseJson(*static_cast<event_data*>(this), dataToParse);
526 if (auto result = parserNew.getErrors(); result.size() > 0) {
527 for (auto& valueNew: result) {
529 }
530 }
531 if (guild_members::doWeCacheGuildMembers()) {
532 guild_member_data guildMember = guild_members::getCachedGuildMember({ .guildMemberId = value.user.id, .guildId = value.guildId });
533 guild_members::removeGuildMember(guildMember);
534 }
535 if (guilds::doWeCacheGuilds()) {
536 if (guilds::getCache().contains(value.guildId)) {
537 for (uint64_t x = 0; x < guilds::getCache().operator[](value.guildId).members.size(); ++x) {
538 if (guilds::getCache().operator[](value.guildId).members.at(x) == static_cast<uint64_t>(value.user.id)) {
539 guilds::getCache().operator[](value.guildId).members.erase(guilds::getCache().operator[](value.guildId).members.begin() + static_cast<int64_t>(x));
540 --guilds::getCache()[value.guildId].memberCount;
541 }
542 }
543 }
544 }
545 }
546
547 on_guild_member_update_data::on_guild_member_update_data(jsonifier::jsonifier_core<false>& parserNew, jsonifier::string_view_base<uint8_t> dataToParse) {
548 parserNew.parseJson(*static_cast<updated_event_data*>(this), dataToParse);
549 if (guild_members::doWeCacheGuildMembers()) {
550 oldValue = guild_members::getCachedGuildMember({ .guildMemberId = value.user.id, .guildId = value.guildId });
551 guild_members::insertGuildMember(static_cast<guild_member_cache_data>(value));
552 }
553 }
554
555 on_guild_members_chunk_data::on_guild_members_chunk_data(jsonifier::jsonifier_core<false>& parserNew, jsonifier::string_view_base<uint8_t> dataToParse) {
556 parserNew.parseJson(*static_cast<event_data*>(this), dataToParse);
557 if (auto result = parserNew.getErrors(); result.size() > 0) {
558 for (auto& valueNew: result) {
560 }
561 }
562 }
563
564 on_role_creation_data::on_role_creation_data(jsonifier::jsonifier_core<false>& parserNew, jsonifier::string_view_base<uint8_t> dataToParse) {
565 parserNew.parseJson(*static_cast<event_data*>(this), dataToParse);
566 if (auto result = parserNew.getErrors(); result.size() > 0) {
567 for (auto& valueNew: result) {
569 }
570 }
571 if (roles::doWeCacheRoles()) {
572 roles::insertRole(static_cast<role_cache_data>(value.role));
573 }
574 if (guilds::doWeCacheGuilds()) {
575 if (guilds::getCache().contains(value.guildId)) {
576 guilds::getCache()[value.guildId].roles.emplace_back(value.role.id);
577 }
578 }
579 }
580
581 on_role_update_data::on_role_update_data(jsonifier::jsonifier_core<false>& parserNew, jsonifier::string_view_base<uint8_t> dataToParse) {
582 parserNew.parseJson(*static_cast<updated_event_data*>(this), dataToParse);
583 if (roles::doWeCacheRoles()) {
584 oldValue = roles::getCachedRole({ .guildId = value.guildId, .roleId = value.role.id });
585 roles::insertRole(static_cast<role_cache_data>(value.role));
586 }
587 }
588
589 on_role_deletion_data::on_role_deletion_data(jsonifier::jsonifier_core<false>& parserNew, jsonifier::string_view_base<uint8_t> dataToParse) {
590 parserNew.parseJson(*static_cast<event_data*>(this), dataToParse);
591 if (auto result = parserNew.getErrors(); result.size() > 0) {
592 for (auto& valueNew: result) {
594 }
595 }
596 if (roles::doWeCacheRoles()) {
597 roles::removeRole(static_cast<role_cache_data>(value.role));
598 }
599 if (guilds::doWeCacheGuilds()) {
600 if (guilds::getCache().contains(value.guildId)) {
601 for (uint64_t x = 0; x < guilds::getCache().operator[](value.guildId).roles.size(); ++x) {
602 if (guilds::getCache().operator[](value.guildId).roles.at(x) == static_cast<uint64_t>(value.role.id)) {
603 guilds::getCache().operator[](value.guildId).roles.erase(guilds::getCache().operator[](value.guildId).roles.begin() + static_cast<int64_t>(x));
604 }
605 }
606 }
607 }
608 }
609
610 on_voice_server_update_data::on_voice_server_update_data(jsonifier::jsonifier_core<false>& parserNew, jsonifier::string_view_base<uint8_t> dataToParse,
612 parserNew.parseJson(*static_cast<event_data*>(this), dataToParse);
613 if (auto result = parserNew.getErrors(); result.size() > 0) {
614 for (auto& valueNew: result) {
616 }
617 }
618 if (sslShard->areWeCollectingData.load(std::memory_order_acquire) && !sslShard->serverUpdateCollected && !sslShard->stateUpdateCollected) {
619 sslShard->voiceConnectionData = discord_core_internal::voice_connection_data{};
620 sslShard->voiceConnectionData.endPoint = value.endpoint;
621 sslShard->voiceConnectionData.token = value.token;
622 sslShard->serverUpdateCollected = true;
623 } else if (sslShard->areWeCollectingData.load(std::memory_order_acquire) && !sslShard->serverUpdateCollected) {
624 sslShard->voiceConnectionData.endPoint = value.endpoint;
625 sslShard->voiceConnectionData.token = value.token;
626 if (sslShard->voiceConnectionDataBufferMap.contains(value.guildId.operator const uint64_t&())) {
627 sslShard->voiceConnectionDataBufferMap[value.guildId.operator const uint64_t&()]->send(sslShard->voiceConnectionData);
628 }
629 sslShard->areWeCollectingData.store(false, std::memory_order_release);
630 sslShard->serverUpdateCollected = false;
631 sslShard->stateUpdateCollected = false;
632 }
633 };
634
635 on_guild_scheduled_event_creation_data::on_guild_scheduled_event_creation_data(jsonifier::jsonifier_core<false>& parserNew, jsonifier::string_view_base<uint8_t> dataToParse) {
636 parserNew.parseJson(*static_cast<event_data*>(this), dataToParse);
637 if (auto result = parserNew.getErrors(); result.size() > 0) {
638 for (auto& valueNew: result) {
640 }
641 }
642 }
643
644 on_guild_scheduled_event_update_data::on_guild_scheduled_event_update_data(jsonifier::jsonifier_core<false>& parserNew, jsonifier::string_view_base<uint8_t> dataToParse) {
645 parserNew.parseJson(*static_cast<event_data*>(this), dataToParse);
646 if (auto result = parserNew.getErrors(); result.size() > 0) {
647 for (auto& valueNew: result) {
649 }
650 }
651 }
652
653 on_guild_scheduled_event_deletion_data::on_guild_scheduled_event_deletion_data(jsonifier::jsonifier_core<false>& parserNew, jsonifier::string_view_base<uint8_t> dataToParse) {
654 parserNew.parseJson(*static_cast<event_data*>(this), dataToParse);
655 if (auto result = parserNew.getErrors(); result.size() > 0) {
656 for (auto& valueNew: result) {
658 }
659 }
660 }
661
662 on_guild_scheduled_event_user_add_data::on_guild_scheduled_event_user_add_data(jsonifier::jsonifier_core<false>& parserNew, jsonifier::string_view_base<uint8_t> dataToParse) {
663 parserNew.parseJson(*static_cast<event_data*>(this), dataToParse);
664 if (auto result = parserNew.getErrors(); result.size() > 0) {
665 for (auto& valueNew: result) {
667 }
668 }
669 }
670
671 on_guild_scheduled_event_user_remove_data::on_guild_scheduled_event_user_remove_data(jsonifier::jsonifier_core<false>& parserNew, jsonifier::string_view_base<uint8_t> dataToParse) {
672 parserNew.parseJson(*static_cast<event_data*>(this), dataToParse);
673 if (auto result = parserNew.getErrors(); result.size() > 0) {
674 for (auto& valueNew: result) {
676 }
677 }
678 }
679
680 on_integration_creation_data::on_integration_creation_data(jsonifier::jsonifier_core<false>& parserNew, jsonifier::string_view_base<uint8_t> dataToParse) {
681 parserNew.parseJson(*static_cast<event_data*>(this), dataToParse);
682 if (auto result = parserNew.getErrors(); result.size() > 0) {
683 for (auto& valueNew: result) {
685 }
686 }
687 }
688
689 on_integration_update_data::on_integration_update_data(jsonifier::jsonifier_core<false>& parserNew, jsonifier::string_view_base<uint8_t> dataToParse) {
690 parserNew.parseJson(*static_cast<event_data*>(this), dataToParse);
691 if (auto result = parserNew.getErrors(); result.size() > 0) {
692 for (auto& valueNew: result) {
694 }
695 }
696 }
697
698 on_integration_deletion_data::on_integration_deletion_data(jsonifier::jsonifier_core<false>& parserNew, jsonifier::string_view_base<uint8_t> dataToParse) {
699 parserNew.parseJson(*static_cast<event_data*>(this), dataToParse);
700 if (auto result = parserNew.getErrors(); result.size() > 0) {
701 for (auto& valueNew: result) {
703 }
704 }
705 }
706
707 on_interaction_creation_data::on_interaction_creation_data(jsonifier::jsonifier_core<false>& parserNew, jsonifier::string_view_base<uint8_t> dataToParse) {
708 parserNew.parseJson(*static_cast<event_data*>(this), dataToParse);
709 if (auto result = parserNew.getErrors(); result.size() > 0) {
710 for (auto& valueNew: result) {
712 }
713 }
714 unique_ptr<input_event_data> eventData{ makeUnique<input_event_data>(value) };
715 switch (value.type) {
717 eventData->responseType = input_event_response_type::Unset;
718 eventData->interactionData = makeUnique<interaction_data>(value);
719 discord_core_client::getInstance()->getCommandController().checkForAndRunCommand(command_data{ *eventData });
720 unique_ptr<on_input_event_creation_data> eventCreationData{ makeUnique<on_input_event_creation_data>(parser, dataToParse) };
721 eventCreationData->value = *eventData;
722 break;
723 }
725 switch (value.data.componentType) {
727 [[fallthrough]];
729 eventData->responseType = input_event_response_type::Unset;
730 eventData->interactionData = makeUnique<interaction_data>(value);
731 if (button_collector::buttonInteractionBuffersMap.contains(
732 eventData->getChannelData().id.operator jsonifier::string() + eventData->getMessageData().id.operator jsonifier::string())) {
733 button_collector::buttonInteractionBuffersMap[eventData->getChannelData().id.operator jsonifier::string() +
734 eventData->getMessageData().id.operator jsonifier::string()]
735 ->send(value);
736 }
737 button_collector::buttonInteractionEventsMap.operator()(*eventData->interactionData);
738 break;
739 }
741 [[fallthrough]];
743 [[fallthrough]];
745 [[fallthrough]];
747 [[fallthrough]];
749 eventData->responseType = input_event_response_type::Unset;
750 eventData->interactionData = makeUnique<interaction_data>(value);
751 if (select_menu_collector::selectMenuInteractionBuffersMap.contains(
752 eventData->getChannelData().id.operator jsonifier::string() + eventData->getMessageData().id.operator jsonifier::string())) {
753 select_menu_collector::selectMenuInteractionBuffersMap[eventData->getChannelData().id.operator jsonifier::string() +
754 eventData->getMessageData().id.operator jsonifier::string()]
755 ->send(value);
756 }
757 select_menu_collector::selectMenuInteractionEventsMap.operator()(*eventData->interactionData);
758 break;
759 }
761 break;
762 }
763 }
764 break;
765 }
767 eventData->responseType = input_event_response_type::Unset;
768 eventData->interactionData = makeUnique<interaction_data>(value);
769 unique_ptr<on_input_event_creation_data> eventCreationData{ makeUnique<on_input_event_creation_data>(parser, dataToParse) };
770 eventCreationData->value = *eventData;
771 if (modal_collector::modalInteractionBuffersMap.contains(eventData->getChannelData().id.operator jsonifier::string())) {
772 modal_collector::modalInteractionBuffersMap[eventData->getChannelData().id.operator jsonifier::string()]->send(eventData->getInteractionData());
773 modal_collector::modalInteractionEventsMap.operator()(*eventData->interactionData);
774 }
775 break;
776 }
778 eventData->responseType = input_event_response_type::Unset;
779 eventData->interactionData = makeUnique<interaction_data>(value);
780 unique_ptr<on_auto_complete_entry_data> autocompleteEntryData{ makeUnique<on_auto_complete_entry_data>(parser, dataToParse) };
781 autocompleteEntryData->value = *eventData;
782 discord_core_client::getInstance()->getEventManager().onAutoCompleteEntryEvent(*autocompleteEntryData);
783 break;
784 }
786 break;
787 }
788 }
789 }
790
791 on_invite_creation_data::on_invite_creation_data(jsonifier::jsonifier_core<false>& parserNew, jsonifier::string_view_base<uint8_t> dataToParse) {
792 parserNew.parseJson(*static_cast<event_data*>(this), dataToParse);
793 if (auto result = parserNew.getErrors(); result.size() > 0) {
794 for (auto& valueNew: result) {
796 }
797 }
798 }
799
800 on_invite_deletion_data::on_invite_deletion_data(jsonifier::jsonifier_core<false>& parserNew, jsonifier::string_view_base<uint8_t> dataToParse) {
801 parserNew.parseJson(*static_cast<event_data*>(this), dataToParse);
802 if (auto result = parserNew.getErrors(); result.size() > 0) {
803 for (auto& valueNew: result) {
805 }
806 }
807 }
808
809 on_message_creation_data::on_message_creation_data(jsonifier::jsonifier_core<false>& parserNew, jsonifier::string_view_base<uint8_t> dataToParse) {
810 parserNew.parseJson(*static_cast<event_data*>(this), dataToParse);
811 if (auto result = parserNew.getErrors(); result.size() > 0) {
812 for (auto& valueNew: result) {
814 }
815 }
816 for (auto& [key, valueNew]: message_collector::objectsBuffersMap) {
817 valueNew->send(value);
818 }
819 }
820
821 on_message_update_data::on_message_update_data(jsonifier::jsonifier_core<false>& parserNew, jsonifier::string_view_base<uint8_t> dataToParse) {
822 parserNew.parseJson(*static_cast<event_data*>(this), dataToParse);
823 if (auto result = parserNew.getErrors(); result.size() > 0) {
824 for (auto& valueNew: result) {
826 }
827 }
828 for (auto& [key, valueNew]: message_collector::objectsBuffersMap) {
829 valueNew->send(value);
830 }
831 }
832
833 on_message_deletion_data::on_message_deletion_data(jsonifier::jsonifier_core<false>& parserNew, jsonifier::string_view_base<uint8_t> dataToParse) {
834 parserNew.parseJson(*static_cast<event_data*>(this), dataToParse);
835 if (auto result = parserNew.getErrors(); result.size() > 0) {
836 for (auto& valueNew: result) {
838 }
839 }
840 }
841
842 on_message_delete_bulk_data::on_message_delete_bulk_data(jsonifier::jsonifier_core<false>& parserNew, jsonifier::string_view_base<uint8_t> dataToParse) {
843 parserNew.parseJson(*static_cast<event_data*>(this), dataToParse);
844 if (auto result = parserNew.getErrors(); result.size() > 0) {
845 for (auto& valueNew: result) {
847 }
848 }
849 }
850
851 on_reaction_add_data::on_reaction_add_data(jsonifier::jsonifier_core<false>& parserNew, jsonifier::string_view_base<uint8_t> dataToParse) {
852 parserNew.parseJson(*static_cast<event_data*>(this), dataToParse);
853 if (auto result = parserNew.getErrors(); result.size() > 0) {
854 for (auto& valueNew: result) {
856 }
857 }
858 for (auto& [key, valueNew]: reaction_collector::objectsBuffersMap) {
859 valueNew->send(value);
860 }
861 }
862
863 on_reaction_remove_data::on_reaction_remove_data(jsonifier::jsonifier_core<false>& parserNew, jsonifier::string_view_base<uint8_t> dataToParse) {
864 parserNew.parseJson(*static_cast<event_data*>(this), dataToParse);
865 if (auto result = parserNew.getErrors(); result.size() > 0) {
866 for (auto& valueNew: result) {
868 }
869 }
870 }
871
872 on_reaction_remove_all_data::on_reaction_remove_all_data(jsonifier::jsonifier_core<false>& parserNew, jsonifier::string_view_base<uint8_t> dataToParse) {
873 parserNew.parseJson(*static_cast<event_data*>(this), dataToParse);
874 if (auto result = parserNew.getErrors(); result.size() > 0) {
875 for (auto& valueNew: result) {
877 }
878 }
879 }
880
881 on_reaction_remove_emoji_data::on_reaction_remove_emoji_data(jsonifier::jsonifier_core<false>& parserNew, jsonifier::string_view_base<uint8_t> dataToParse) {
882 parserNew.parseJson(*static_cast<event_data*>(this), dataToParse);
883 if (auto result = parserNew.getErrors(); result.size() > 0) {
884 for (auto& valueNew: result) {
886 }
887 }
888 }
889
890 on_presence_update_data::on_presence_update_data(jsonifier::jsonifier_core<false>& parserNew, jsonifier::string_view_base<uint8_t> dataToParse) {
891 parserNew.parseJson(*static_cast<event_data*>(this), dataToParse);
892 if (auto result = parserNew.getErrors(); result.size() > 0) {
893 for (auto& valueNew: result) {
895 }
896 }
897 }
898
899 on_stage_instance_creation_data::on_stage_instance_creation_data(jsonifier::jsonifier_core<false>& parserNew, jsonifier::string_view_base<uint8_t> dataToParse) {
900 parserNew.parseJson(*static_cast<event_data*>(this), dataToParse);
901 if (auto result = parserNew.getErrors(); result.size() > 0) {
902 for (auto& valueNew: result) {
904 }
905 }
906 }
907
908 on_stage_instance_update_data::on_stage_instance_update_data(jsonifier::jsonifier_core<false>& parserNew, jsonifier::string_view_base<uint8_t> dataToParse) {
909 parserNew.parseJson(*static_cast<event_data*>(this), dataToParse);
910 if (auto result = parserNew.getErrors(); result.size() > 0) {
911 for (auto& valueNew: result) {
913 }
914 }
915 }
916
917 on_stage_instance_deletion_data::on_stage_instance_deletion_data(jsonifier::jsonifier_core<false>& parserNew, jsonifier::string_view_base<uint8_t> dataToParse) {
918 parserNew.parseJson(*static_cast<event_data*>(this), dataToParse);
919 if (auto result = parserNew.getErrors(); result.size() > 0) {
920 for (auto& valueNew: result) {
922 }
923 }
924 }
925
926 on_typing_start_data::on_typing_start_data(jsonifier::jsonifier_core<false>& parserNew, jsonifier::string_view_base<uint8_t> dataToParse) {
927 parserNew.parseJson(*static_cast<event_data*>(this), dataToParse);
928 if (auto result = parserNew.getErrors(); result.size() > 0) {
929 for (auto& valueNew: result) {
931 }
932 }
933 }
934
935 on_user_update_data::on_user_update_data(jsonifier::jsonifier_core<false>& parserNew, jsonifier::string_view_base<uint8_t> dataToParse) {
936 parserNew.parseJson(*static_cast<updated_event_data*>(this), dataToParse);
937 oldValue = users::getCachedUser({ value.id });
938 if (users::doWeCacheUsers()) {
939 users::insertUser(static_cast<user_cache_data>(value));
940 }
941 }
942
943 on_voice_state_update_data::on_voice_state_update_data(jsonifier::jsonifier_core<false>& parserNew, jsonifier::string_view_base<uint8_t> dataToParse,
945 parserNew.parseJson(*static_cast<event_data*>(this), dataToParse);
946 if (auto result = parserNew.getErrors(); result.size() > 0) {
947 for (auto& valueNew: result) {
949 }
950 }
951 if (sslShard->areWeCollectingData.load(std::memory_order_acquire) && !sslShard->stateUpdateCollected && !sslShard->serverUpdateCollected &&
952 value.userId == sslShard->userId) {
953 sslShard->voiceConnectionData = discord_core_internal::voice_connection_data{};
954 sslShard->voiceConnectionData.sessionId = value.sessionId;
955 sslShard->stateUpdateCollected = true;
956 } else if (sslShard->areWeCollectingData.load(std::memory_order_acquire) && !sslShard->stateUpdateCollected && value.userId == sslShard->userId) {
957 sslShard->voiceConnectionData.sessionId = value.sessionId;
958 if (sslShard->voiceConnectionDataBufferMap.contains(value.guildId.operator const uint64_t&())) {
959 sslShard->voiceConnectionDataBufferMap[value.guildId.operator const uint64_t&()]->send(std::move(sslShard->voiceConnectionData));
960 }
961 sslShard->areWeCollectingData.store(false, std::memory_order_release);
962 sslShard->serverUpdateCollected = false;
963 sslShard->stateUpdateCollected = false;
964 }
965 voice_state_data_light voiceDataNew{};
966 voiceDataNew.channelId = value.channelId;
967 voiceDataNew.guildId = value.guildId;
968 voiceDataNew.userId = value.userId;
969 guild_members::insertVoiceState(std::move(voiceDataNew));
970 }
971
972 on_webhook_update_data::on_webhook_update_data(jsonifier::jsonifier_core<false>& parserNew, jsonifier::string_view_base<uint8_t> dataToParse) {
973 parserNew.parseJson(*static_cast<event_data*>(this), dataToParse);
974 if (auto result = parserNew.getErrors(); result.size() > 0) {
975 for (auto& valueNew: result) {
977 }
978 }
979 }
980
981 on_auto_complete_entry_data::on_auto_complete_entry_data(jsonifier::jsonifier_core<false>& parserNew, jsonifier::string_view_base<uint8_t> dataToParse) {
982 parserNew.parseJson(*static_cast<event_data*>(this), dataToParse);
983 if (auto result = parserNew.getErrors(); result.size() > 0) {
984 for (auto& valueNew: result) {
986 }
987 }
988 }
989
994
996 return onApplicationCommandPermissionsUpdateEvent.erase(token);
997 }
998
1003
1005 return onAutoModerationRuleCreationEvent.erase(token);
1006 }
1007
1012
1014 return onAutoModerationRuleUpdateEvent.erase(token);
1015 }
1016
1021
1023 return onAutoModerationRuleDeletionEvent.erase(token);
1024 }
1025
1030
1032 return onAutoModerationActionExecutionEvent.erase(token);
1033 }
1034
1038
1040 return onInputEventCreationEvent.erase(token);
1041 }
1042
1046
1048 return onInputEventCreationEvent.erase(token);
1049 }
1050
1054
1056 onChannelCreationEvent.erase(token);
1057 }
1058
1062
1064 onChannelUpdateEvent.erase(token);
1065 }
1066
1070
1072 onChannelDeletionEvent.erase(token);
1073 }
1074
1078
1080 return onChannelPinsUpdateEvent.erase(token);
1081 }
1082
1086
1088 return onThreadCreationEvent.erase(token);
1089 }
1090
1094
1096 return onThreadUpdateEvent.erase(token);
1097 }
1098
1102
1104 return onThreadDeletionEvent.erase(token);
1105 }
1106
1110
1112 return onThreadListSyncEvent.erase(token);
1113 }
1114
1118
1120 return onThreadMemberUpdateEvent.erase(token);
1121 }
1122
1127
1129 return onThreadMembersUpdateEvent.erase(token);
1130 }
1131
1135
1137 onGuildCreationEvent.erase(token);
1138 }
1139
1143
1145 onGuildUpdateEvent.erase(token);
1146 }
1147
1151
1153 onGuildDeletionEvent.erase(token);
1154 }
1155
1159
1161 onGuildBanAddEvent.erase(token);
1162 }
1163
1167
1169 onGuildBanRemoveEvent.erase(token);
1170 }
1171
1175
1177 onGuildEmojisUpdateEvent.erase(token);
1178 }
1179
1184
1186 onGuildStickersUpdateEvent.erase(token);
1187 }
1188
1193
1195 onGuildIntegrationsUpdateEvent.erase(token);
1196 }
1197
1201
1203 onGuildMembersChunkEvent.erase(token);
1204 }
1205
1209
1211 onGuildMemberAddEvent.erase(token);
1212 }
1213
1217
1219 onGuildMemberRemoveEvent.erase(token);
1220 }
1221
1225
1227 onGuildMemberUpdateEvent.erase(token);
1228 }
1229
1233
1235 onRoleCreationEvent.erase(token);
1236 }
1237
1241
1243 onRoleUpdateEvent.erase(token);
1244 }
1245
1249
1251 onRoleDeletionEvent.erase(token);
1252 }
1253
1258
1260 onGuildScheduledEventCreationEvent.erase(token);
1261 }
1262
1267
1269 onGuildScheduledEventUpdateEvent.erase(token);
1270 }
1271
1276
1278 onGuildScheduledEventDeletionEvent.erase(token);
1279 }
1280
1285
1287 onGuildScheduledEventUserAddEvent.erase(token);
1288 }
1289
1294
1296 onGuildScheduledEventUserRemoveEvent.erase(token);
1297 }
1298
1303
1305 onIntegrationCreationEvent.erase(token);
1306 }
1307
1311
1313 onIntegrationUpdateEvent.erase(token);
1314 }
1315
1320
1322 onIntegrationDeletionEvent.erase(token);
1323 }
1324
1329
1331 onInteractionCreationEvent.erase(token);
1332 }
1333
1337
1339 onInviteCreationEvent.erase(token);
1340 }
1341
1345
1347 onInviteDeletionEvent.erase(token);
1348 }
1349
1353
1355 onMessageCreationEvent.erase(token);
1356 }
1357
1361
1363 onMessageUpdateEvent.erase(token);
1364 }
1365
1369
1371 onMessageDeletionEvent.erase(token);
1372 }
1373
1377
1379 onMessageDeleteBulkEvent.erase(token);
1380 }
1381
1385
1387 onReactionAddEvent.erase(token);
1388 }
1389
1393
1395 onReactionRemoveEvent.erase(token);
1396 }
1397
1401
1403 onReactionRemoveAllEvent.erase(token);
1404 }
1405
1410
1412 onReactionRemoveEmojiEvent.erase(token);
1413 }
1414
1418
1420 onPresenceUpdateEvent.erase(token);
1421 }
1422
1427
1429 onStageInstanceCreationEvent.erase(token);
1430 }
1431
1436
1438 onStageInstanceUpdateEvent.erase(token);
1439 }
1440
1445
1447 onStageInstanceDeletionEvent.erase(token);
1448 }
1449
1453
1455 onTypingStartEvent.erase(token);
1456 }
1457
1461
1463 onUserUpdateEvent.erase(token);
1464 }
1465
1469
1471 onVoiceStateUpdateEvent.erase(token);
1472 }
1473
1477
1479 onVoiceServerUpdateEvent.erase(token);
1480 }
1481
1485
1487 onWebhookUpdateEvent.erase(token);
1488 }
1489
1490
1491};
static channel_cache_data getCachedChannel(get_channel_data dataPackage)
Collects a channel from the library's cache.
A co_routine - representing a potentially asynchronous operation/function.
Event-delegate, representing an event function to be executed.
A websocket client, for communication via a tcp-connection.
discord_core_internal::event_delegate_token onInputEventCreation(discord_core_internal::event_delegate< co_routine< void >, const on_input_event_creation_data & > handler)
For adding a function to handle this event.
discord_core_internal::event_delegate_token onGuildStickersUpdate(discord_core_internal::event_delegate< co_routine< void >, const on_guild_stickers_update_data & > handler)
For adding a function to handle this event.
discord_core_internal::event_delegate_token onThreadMemberUpdate(discord_core_internal::event_delegate< co_routine< void >, const on_thread_member_update_data & > handler)
For adding a function to handle this event.
discord_core_internal::event_delegate_token onRoleUpdate(discord_core_internal::event_delegate< co_routine< void >, const on_role_update_data & > handler)
For adding a function to handle this event.
discord_core_internal::event_delegate_token onChannelPinsUpdate(discord_core_internal::event_delegate< co_routine< void >, const on_channel_pins_update_data & > handler)
For adding a function to handle this event.
discord_core_internal::event_delegate_token onAutoModerationRuleCreation(discord_core_internal::event_delegate< co_routine< void >, const on_auto_moderation_rule_creation_data & > handler)
For adding a function to handle this event.
discord_core_internal::event_delegate_token onGuildUpdate(discord_core_internal::event_delegate< co_routine< void >, const on_guild_update_data & > handler)
For adding a function to handle this event.
discord_core_internal::event_delegate_token onRoleCreation(discord_core_internal::event_delegate< co_routine< void >, const on_role_creation_data & > handler)
For adding a function to handle this event.
discord_core_internal::event_delegate_token onIntegrationCreation(discord_core_internal::event_delegate< co_routine< void >, const on_integration_creation_data & > handler)
For adding a function to handle this event.
discord_core_internal::event_delegate_token onThreadCreation(discord_core_internal::event_delegate< co_routine< void >, const on_thread_creation_data & > handler)
For adding a function to handle this event.
discord_core_internal::event_delegate_token onMessageDeletion(discord_core_internal::event_delegate< co_routine< void >, const on_message_deletion_data & > handler)
For adding a function to handle this event.
discord_core_internal::event_delegate_token onGuildDeletion(discord_core_internal::event_delegate< co_routine< void >, const on_guild_deletion_data & > handler)
For adding a function to handle this event.
discord_core_internal::event_delegate_token onThreadUpdate(discord_core_internal::event_delegate< co_routine< void >, const on_thread_update_data & > handler)
For adding a function to handle this event.
discord_core_internal::event_delegate_token onGuildMemberRemove(discord_core_internal::event_delegate< co_routine< void >, const on_guild_member_remove_data & > handler)
For adding a function to handle this event.
discord_core_internal::event_delegate_token onGuildScheduledEventDeletion(discord_core_internal::event_delegate< co_routine< void >, const on_guild_scheduled_event_deletion_data & > handler)
For adding a function to handle this event.
discord_core_internal::event_delegate_token onChannelCreation(discord_core_internal::event_delegate< co_routine< void >, const on_channel_creation_data & > handler)
For adding a function to handle this event.
discord_core_internal::event_delegate_token onMessageCreation(discord_core_internal::event_delegate< co_routine< void >, const on_message_creation_data & > handler)
For adding a function to handle this event.
discord_core_internal::event_delegate_token onThreadListSync(discord_core_internal::event_delegate< co_routine< void >, const on_thread_list_sync_data & > handler)
For adding a function to handle this event.
discord_core_internal::event_delegate_token onIntegrationDeletion(discord_core_internal::event_delegate< co_routine< void >, const on_integration_deletion_data & > handler)
For adding a function to handle this event.
discord_core_internal::event_delegate_token onThreadDeletion(discord_core_internal::event_delegate< co_routine< void >, const on_thread_deletion_data & > handler)
For adding a function to handle this event.
discord_core_internal::event_delegate_token onGuildScheduledEventCreation(discord_core_internal::event_delegate< co_routine< void >, const on_guild_scheduled_event_creation_data & > handler)
For adding a function to handle this event.
discord_core_internal::event_delegate_token onReactionRemove(discord_core_internal::event_delegate< co_routine< void >, const on_reaction_remove_data & > handler)
For adding a function to handle this event.
discord_core_internal::event_delegate_token onReactionAdd(discord_core_internal::event_delegate< co_routine< void >, const on_reaction_add_data & > handler)
For adding a function to handle this event.
discord_core_internal::event_delegate_token onReactionRemoveAll(discord_core_internal::event_delegate< co_routine< void >, const on_reaction_remove_all_data & > handler)
For adding a function to handle this event.
discord_core_internal::event_delegate_token onChannelUpdate(discord_core_internal::event_delegate< co_routine< void >, const on_channel_update_data & > handler)
For adding a function to handle this event.
discord_core_internal::event_delegate_token onGuildScheduledEventUserRemove(discord_core_internal::event_delegate< co_routine< void >, const on_guild_scheduled_event_user_remove_data & > handler)
For adding a function to handle this event.
discord_core_internal::event_delegate_token onVoiceStateUpdate(discord_core_internal::event_delegate< co_routine< void >, const on_voice_state_update_data & > handler)
For adding a function to handle this event.
discord_core_internal::event_delegate_token onAutoCompleteEntry(discord_core_internal::event_delegate< co_routine< void >, const on_auto_complete_entry_data & > handler)
For adding a function to handle this event.
discord_core_internal::event_delegate_token onVoiceServerUpdate(discord_core_internal::event_delegate< co_routine< void >, const on_voice_server_update_data & > handler)
For adding a function to handle this event.
discord_core_internal::event_delegate_token onGuildScheduledEventUpdate(discord_core_internal::event_delegate< co_routine< void >, const on_guild_scheduled_event_update_data & > handler)
For adding a function to handle this event.
discord_core_internal::event_delegate_token onGuildBanAdd(discord_core_internal::event_delegate< co_routine< void >, const on_guild_ban_add_data & > handler)
For adding a function to handle this event.
discord_core_internal::event_delegate_token onMessageDeleteBulk(discord_core_internal::event_delegate< co_routine< void >, const on_message_delete_bulk_data & > handler)
For adding a function to handle this event.
discord_core_internal::event_delegate_token onRoleDeletion(discord_core_internal::event_delegate< co_routine< void >, const on_role_deletion_data & > handler)
For adding a function to handle this event.
discord_core_internal::event_delegate_token onGuildIntegrationsUpdate(discord_core_internal::event_delegate< co_routine< void >, const on_guild_integrations_update_data & > handler)
For adding a function to handle this event.
discord_core_internal::event_delegate_token onInviteDeletion(discord_core_internal::event_delegate< co_routine< void >, const on_invite_deletion_data & > handler)
For adding a function to handle this event.
discord_core_internal::event_delegate_token onStageInstanceDeletion(discord_core_internal::event_delegate< co_routine< void >, const on_stage_instance_deletion_data & > handler)
For adding a function to handle this event.
discord_core_internal::event_delegate_token onGuildMembersChunk(discord_core_internal::event_delegate< co_routine< void >, const on_guild_members_chunk_data & > handler)
For adding a function to handle this event.
discord_core_internal::event_delegate_token onThreadMembersUpdate(discord_core_internal::event_delegate< co_routine< void >, const on_thread_members_update_data & > handler)
For adding a function to handle this event.
discord_core_internal::event_delegate_token onGuildCreation(discord_core_internal::event_delegate< co_routine< void >, const on_guild_creation_data & > handler)
For adding a function to handle this event.
discord_core_internal::event_delegate_token onStageInstanceUpdate(discord_core_internal::event_delegate< co_routine< void >, const on_stage_instance_update_data & > handler)
For adding a function to handle this event.
discord_core_internal::event_delegate_token onInviteCreation(discord_core_internal::event_delegate< co_routine< void >, const on_invite_creation_data & > handler)
For adding a function to handle this event.
discord_core_internal::event_delegate_token onStageInstanceCreation(discord_core_internal::event_delegate< co_routine< void >, const on_stage_instance_creation_data & > handler)
For adding a function to handle this event.
discord_core_internal::event_delegate_token onGuildMemberUpdate(discord_core_internal::event_delegate< co_routine< void >, const on_guild_member_update_data & > handler)
For adding a function to handle this event.
discord_core_internal::event_delegate_token onGuildEmojisUpdate(discord_core_internal::event_delegate< co_routine< void >, const on_guild_emojis_update_data & > handler)
For adding a function to handle this event.
discord_core_internal::event_delegate_token onWebhookUpdate(discord_core_internal::event_delegate< co_routine< void >, const on_webhook_update_data & > handler)
For adding a function to handle this event.
discord_core_internal::event_delegate_token onGuildScheduledEventUserAdd(discord_core_internal::event_delegate< co_routine< void >, const on_guild_scheduled_event_user_add_data & > handler)
For adding a function to handle this event.
discord_core_internal::event_delegate_token onAutoModerationRuleUpdate(discord_core_internal::event_delegate< co_routine< void >, const on_auto_moderation_rule_update_data & > handler)
For adding a function to handle this event.
discord_core_internal::event_delegate_token onTypingStart(discord_core_internal::event_delegate< co_routine< void >, const on_typing_start_data & > handler)
For adding a function to handle this event.
discord_core_internal::event_delegate_token onReactionRemoveEmoji(discord_core_internal::event_delegate< co_routine< void >, const on_reaction_remove_emoji_data & > handler)
For adding a function to handle this event.
discord_core_internal::event_delegate_token onUserUpdate(discord_core_internal::event_delegate< co_routine< void >, const on_user_update_data & > handler)
For adding a function to handle this event.
discord_core_internal::event_delegate_token onApplicationCommandsPermissionsUpdate(discord_core_internal::event_delegate< co_routine< void >, const on_application_command_permissions_update_data & > handler)
For adding a function to handle this event.
discord_core_internal::event_delegate_token onAutoModerationActionExecution(discord_core_internal::event_delegate< co_routine< void >, const on_auto_moderation_action_execution_data & > handler)
For adding a function to handle this event.
discord_core_internal::event_delegate_token onAutoModerationRuleDeletion(discord_core_internal::event_delegate< co_routine< void >, const on_auto_moderation_rule_deletion_data & > handler)
For adding a function to handle this event.
discord_core_internal::event_delegate_token onGuildBanRemove(discord_core_internal::event_delegate< co_routine< void >, const on_guild_ban_remove_data & > handler)
For adding a function to handle this event.
discord_core_internal::event_delegate_token onPresenceUpdate(discord_core_internal::event_delegate< co_routine< void >, const on_presence_update_data & > handler)
For adding a function to handle this event.
discord_core_internal::event_delegate_token onChannelDeletion(discord_core_internal::event_delegate< co_routine< void >, const on_channel_deletion_data & > handler)
For adding a function to handle this event.
discord_core_internal::event_delegate_token onGuildMemberAdd(discord_core_internal::event_delegate< co_routine< void >, const on_guild_member_add_data & > handler)
For adding a function to handle this event.
discord_core_internal::event_delegate_token onInteractionCreation(discord_core_internal::event_delegate< co_routine< void >, const on_interaction_creation_data & > handler)
For adding a function to handle this event.
discord_core_internal::event_delegate_token onIntegrationUpdate(discord_core_internal::event_delegate< co_routine< void >, const on_integration_update_data & > handler)
For adding a function to handle this event.
discord_core_internal::event_delegate_token onMessageUpdate(discord_core_internal::event_delegate< co_routine< void >, const on_message_update_data & > handler)
For adding a function to handle this event.
static guild_member_cache_data getCachedGuildMember(get_guild_member_data dataPackage)
Collects a guild_member from the library's cache.
static guild_cache_data getCachedGuild(get_guild_data dataPackage)
Collects a guild from the library's cache.
static DCA_INLINE void printError(const string_type &what, std::source_location where=std::source_location::current())
Print an error message of the specified type.
Definition Base.hpp:252
static role_cache_data getCachedRole(get_role_data dataPackage)
Collects a given role from the library's cache.
static user_cache_data getCachedUser(get_user_data dataPackage)
Collects a given user from the library's cache.
@ Action_Row
container for other components.
@ Mentionable_Select
Select menu for mentionables (users and roles).
@ Channel_Select
Select menu for channels.
@ String_Select
Select menu for picking from defined text options.
@ Application_Command_Autocomplete
Application command autocomplete.
DCA_INLINE unique_ptr< value_type, deleter > makeUnique(arg_types &&... args)
Helper function to create a unique_ptr for a non-array object.
The main namespace for the forward-facing interfaces.
Struct representing an event delegate token, associated with an event.
Data that is received as part of an application_command_permissions update event.
Data that is received upon the bot receiving an autocomplete entry.
Data that is received as part of an auto_moderation_action execution event.
Data that is received as part of an auto_moderation_rule_data creation event.
Data that is received as part of an auto_moderation_rule_data delete event.
Data that is received as part of an auto_moderation_rule_data update event.
Data that is received as part of a channel creation event.
Data that is received as part of a channel deletion event.
Data that is received as part of a channel pins update event.
Data that is received as part of a channel update event.
Data that is received as part of a guild ban add event.
Data that is received as part of a guild ban add event.
Data that is received as part of a guild creation event.
Data that is received as part of a guild deletion event.
Data that is received as part of a guild emojis update event.
Data that is received as part of a guild integration update event.
Data that is received as part of a guild_member add event.
Data that is received as part of a guild_member remove event.
Data that is received as part of a guild_member update event.
Data that is received as part of a guild_members chunk event.
Data that is received as part of a guild_scheduled_event_data creation event.
Data that is received as part of a guild_scheduled_event_data delete event.
Data that is received as part of a guild_scheduled_event_data update event.
Data that is received as part of a guild_scheduled_event_data user add event.
Data that is received as part of a guild_scheduled_event_data user remove event.
Data that is received as part of a guild sticker update event.
Data that is received as part of a guild update event.
Data that is received as part of an input_event creation event.
Data that is received as part of an integration creation event.
Data that is received as part of an integration deletion event.
Data that is received as part of an integration update event.
Data that is received as part of an interaction creation event.
Data that is received as part of an invite creation event.
Data that is received as part of an invite deletion event.
Data that is received as part of a message creation event.
Data that is received as part of a message delete bulk event.
Data that is received as part of a message deletion event.
Data that is received as part of a message update event.
Data that is received as part of a presence update event.
Data that is received as part of a reaction add event.
Data that is received as part of a reaction remove all event.
Data that is received as part of a reaction remove event.
Data that is received as part of a reaction remove emoji event.
Data that is received as part of a role_data creation event.
Data that is received as part of a role_data deletion event.
Data that is received as part of a role_data update event.
Data that is received as part of a stage_instance_data creation event.
Data that is received as part of a stage_instance_data deletion event.
Data that is received as part of a stage_instance_data update event.
Data that is received as part of a thread_data creation event.
Data that is received as part of a thread_data deletion event.
Data that is received as part of a thread_data list sync event.
Data that is received as part of a thread_data member update event.
Data that is received as part of a thread_data members update event.
Data that is received as part of a thread_data update event.
Data that is received as part of a typing start event.
Data that is received as part of a user update event.
Data that is received as part of a voice server update event.
Data that is received as part of a voice state update event.
Data that is received as part of a web_hook update event.