diff --git a/src/message.cpp b/src/grocery.cpp similarity index 70% rename from src/message.cpp rename to src/grocery.cpp index 5e1aaf3..0c67475 100644 --- a/src/message.cpp +++ b/src/grocery.cpp @@ -49,4 +49,22 @@ void on_message(dpp::cluster& bot) bot.message_delete(event.msg.id, event.msg.channel_id); } }); +} + +void on_react(dpp::cluster& bot) +{ + bot.on_message_reaction_add([&bot](const dpp::message_reaction_add_t& event) + { + dpp::channel channel = bot.channel_get_sync(event.channel_id); + dpp::channel category = bot.channel_get_sync(channel.parent_id); + + if (category.is_category() == false || category.name != GROCERY_LIST_CATEGORY) + return; + + if (event.reacting_user.id == bot.me.id) + return; + dpp::emoji emoji = event.reacting_emoji; + if (emoji.name == dpp::unicode_emoji::white_check_mark) + bot.message_delete(event.message_id, event.channel_id); + }); } \ No newline at end of file diff --git a/src/reaction.cpp b/src/reaction.cpp deleted file mode 100644 index 0ccf744..0000000 --- a/src/reaction.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include -#include -#include - -#include "config.h" - -void on_react(dpp::cluster& bot) -{ - bot.on_message_reaction_add([&bot](const dpp::message_reaction_add_t& event) - { - dpp::channel channel = bot.channel_get_sync(event.channel_id); - dpp::channel category = bot.channel_get_sync(channel.parent_id); - - if (category.is_category() == false || category.name != GROCERY_LIST_CATEGORY) - return; - - if (event.reacting_user.id == bot.me.id) - return; - dpp::emoji emoji = event.reacting_emoji; - if (emoji.name == dpp::unicode_emoji::white_check_mark) - bot.message_delete(event.message_id, event.channel_id); - }); -} \ No newline at end of file