59 lines
1.8 KiB
C++
59 lines
1.8 KiB
C++
#include <string>
|
|
#include <dpp/dpp.h>
|
|
#include <dpp/channel.h>
|
|
#include <dpp/unicode_emoji.h>
|
|
|
|
#include "config.h"
|
|
|
|
int main()
|
|
{
|
|
dpp::cluster bot(BOT_TOKEN, dpp::i_default_intents | dpp::i_message_content);
|
|
|
|
bot.on_log(dpp::utility::cout_logger());
|
|
|
|
bot.on_message_create([&bot](const dpp::message_create_t& event)
|
|
{
|
|
if (event.msg.author.id == bot.me.id)
|
|
{
|
|
bot.message_add_reaction(event.msg, dpp::unicode_emoji::white_check_mark);
|
|
}
|
|
else
|
|
{
|
|
dpp::channel channel = bot.channel_get_sync(event.msg.channel_id);
|
|
dpp::channel category = bot.channel_get_sync(channel.parent_id);
|
|
|
|
|
|
if (category.is_category() == false || category.name != GROCERY_LIST_CATEGORY)
|
|
return;
|
|
|
|
dpp::embed embed = dpp::embed()
|
|
.set_color(dpp::colors::sea_green)
|
|
.set_title(event.msg.content)
|
|
.add_field("Quantite", "1", true)
|
|
//.add_field("Prix", "3.29")
|
|
.set_author(event.msg.author.username, "", "")
|
|
.set_footer(dpp::embed_footer().set_text("PyMenuVersion:2.0"));
|
|
|
|
dpp::message msg(event.msg.channel_id, embed);
|
|
|
|
bot.message_delete(event.msg.id, event.msg.channel_id);
|
|
}
|
|
});
|
|
|
|
bot.on_message_reaction_add([&bot](const dpp::message_reaction_add_t& event)
|
|
{
|
|
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);
|
|
});
|
|
|
|
bot.on_ready([&bot](const dpp::ready_t& event)
|
|
{
|
|
std::cout << bot.me.id << std::endl;
|
|
(void) event;
|
|
});
|
|
|
|
bot.start(dpp::st_wait);
|
|
} |