| 1 | /************************************************************************************ |
| 2 | * |
| 3 | * D++, A Lightweight C++ library for Discord |
| 4 | * |
| 5 | * SPDX-License-Identifier: Apache-2.0 |
| 6 | * Copyright 2021 Craig Edwards and D++ contributors |
| 7 | * (https://github.com/brainboxdotcc/DPP/graphs/contributors) |
| 8 | * |
| 9 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 10 | * you may not use this file except in compliance with the License. |
| 11 | * You may obtain a copy of the License at |
| 12 | * |
| 13 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 14 | * |
| 15 | * Unless required by applicable law or agreed to in writing, software |
| 16 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 18 | * See the License for the specific language governing permissions and |
| 19 | * limitations under the License. |
| 20 | * |
| 21 | ************************************************************************************/ |
| 22 | #include <dpp/discordevents.h>cxx . . $ `<file>/include/dpp/discordevents.h`/ |
| 23 | #include <dpp/cluster.h>cxx . . $ `<file>/include/dpp/cluster.h`/ |
| 24 | #include <dpp/message.h>cxx . . $ `<file>/include/dpp/message.h`/ |
| 25 | #include <dpp/stringops.h>cxx . . $ `<file>/include/dpp/stringops.h`/ |
| 26 | #include <dpp/json.h>cxx . . $ `<file>/include/dpp/json.h`/ |
| 27 | |
| 28 | |
| 29 | namespace dppcxx . . $ dpp/::eventscxx . . $ dpp/events/ { |
| 30 | |
| 31 | |
| 32 | /** |
| 33 | * @brief Handle event |
| 34 | * |
| 35 | * @param client Websocket client (current shard) |
| 36 | * @param j JSON data for the event |
| 37 | * @param raw Raw JSON string |
| 38 | */ |
| 39 | void message_reaction_removecxx . . $ dpp/events/message_reaction_remove#::handlecxx . . $ dpp/events/message_reaction_remove#handle(d84592ac08c04423).(discord_clientcxx . . $ dpp/discord_client#* client, jsoncxx . . $ dpp/json# &j, const stdcxx . . $ std/::stringcxx . . $ std/string# &raw) { |
| 40 | if (!client->creatorcxx . . $ dpp/discord_client#creator.->on_message_reaction_removecxx . . $ dpp/cluster#on_message_reaction_remove..emptycxx . . $ dpp/event_router_t#empty(50ce9a9e25b4a850).()) { |
| 41 | jsoncxx . . $ dpp/json# &d = j[cxx . . $ nlohmann/json_abi_v3_11_3/basic_json#`operator[]`(20f28fa18fb3cd78)."d"]; |
| 42 | |
| 43 | message_reaction_remove_tcxx . . $ dpp/message_reaction_remove_t# mrr(client->ownercxx . . $ dpp/ssl_connection#owner., client->shard_idcxx . . $ dpp/discord_client#shard_id., raw); |
| 44 | |
| 45 | snowflakecxx . . $ dpp/snowflake# guild_id = snowflake_not_nullcxx . . $ dpp/snowflake#snowflake(45405682577da2e6).(&d, "guild_id"); |
| 46 | snowflakecxx . . $ dpp/snowflake# user_id = snowflake_not_nullcxx . . $ dpp/snowflake#snowflake(45405682577da2e6).(&d, "user_id"); |
| 47 | snowflakecxx . . $ dpp/snowflake# channel_id = snowflake_not_nullcxx . . $ dpp/snowflake#snowflake(45405682577da2e6).(&d, "channel_id"); |
| 48 | snowflakecxx . . $ dpp/snowflake# message_id = snowflake_not_nullcxx . . $ dpp/snowflake#snowflake(45405682577da2e6).(&d, "message_id"); |
| 49 | |
| 50 | guildcxx . . $ dpp/guild#* g = find_guildcxx . . $ dpp/find_guild(12282466d18323a1).(guild_idcxx . . $ dpp/snowflake#snowflake(14a7ecd272f4e02a).); |
| 51 | channelcxx . . $ dpp/channel#* c = dppcxx . . $ dpp/::find_channelcxx . . $ dpp/find_channel(a7f51a27f53cb107).(mrrcxx . . $ dpp/snowflake#snowflake(14a7ecd272f4e02a)..channel_idcxx . . $ dpp/message_reaction_remove_t#channel_id.); |
| 52 | |
| 53 | mrr.reacting_guildcxx . . $ dpp/message_reaction_remove_t#reacting_guild. =cxx . . $ dpp/guild#`operator=`(6c3ca6ee60c6f6a4). g ? *g : guildcxx . . $ dpp/guild#guild(49f6e7a06ebc5aa8).{}; |
| 54 | mrr.reacting_guildcxx . . $ dpp/message_reaction_remove_t#reacting_guild..idcxx . . $ dpp/managed#id. =cxx . . $ dpp/snowflake#`operator=`(672d8e94f4ed0334). guild_id; |
| 55 | |
| 56 | mrr.reacting_user_idcxx . . $ dpp/message_reaction_remove_t#reacting_user_id. =cxx . . $ dpp/snowflake#`operator=`(672d8e94f4ed0334). user_id; |
| 57 | |
| 58 | mrr.channel_idcxx . . $ dpp/message_reaction_remove_t#channel_id. =cxx . . $ dpp/snowflake#`operator=`(672d8e94f4ed0334). channel_id; |
| 59 | mrr.reacting_channelcxx . . $ dpp/message_reaction_remove_t#reacting_channel. =cxx . . $ dpp/channel#`operator=`(fbac1c4b7d340c57). c ? *c : channelcxx . . $ dpp/channel#channel(49f6e7a06ebc5aa8).{}; |
| 60 | mrr.reacting_channelcxx . . $ dpp/message_reaction_remove_t#reacting_channel..idcxx . . $ dpp/managed#id. =cxx . . $ dpp/snowflake#`operator=`(672d8e94f4ed0334). channel_id; |
| 61 | |
| 62 | mrr.message_idcxx . . $ dpp/message_reaction_remove_t#message_id. =cxx . . $ dpp/snowflake#`operator=`(672d8e94f4ed0334). message_id; |
| 63 | mrr.reacting_emojicxx . . $ dpp/message_reaction_remove_t#reacting_emoji. =cxx . . $ dpp/emoji#`operator=`(8ac48ee640a78d4e). dppcxx . . $ dpp/emoji#emoji(ced63f7c635d850d).::emojicxx . . $ dpp/emoji#().fill_from_jsoncxx . . $ dpp/json_interface#fill_from_json(a8904c0342117f8d).(&(d[cxx . . $ nlohmann/json_abi_v3_11_3/basic_json#`operator[]`(20f28fa18fb3cd78)."emoji"])); |
| 64 | |
| 65 | if (mrr.channel_idcxx . . $ dpp/message_reaction_remove_t#channel_id. && mrr.message_idcxx . . $ dpp/message_reaction_remove_t#message_id.) { |
| 66 | client->creatorcxx . . $ dpp/discord_client#creator.->queue_workcxx . . $ dpp/cluster#queue_work(b3c3b0542defecd6).(1, [cxx . . $ std/function#function(bdc3712e480e4d04).c = client->creatorcxx . . $ dpp/discord_client#creator., mrr]() { |
| 67 | c->on_message_reaction_removecxx . . $ dpp/cluster#on_message_reaction_remove..callcxx . . $ dpp/event_router_t#call(5e8fed7c35318f6).(mrr); |
| 68 | }); |
| 69 | } |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | }; |