add: config file and verif category name

This commit is contained in:
starnakin 2023-10-10 12:42:28 +00:00
parent 9f83b5baea
commit bdc7caf1b3
2 changed files with 16 additions and 4 deletions

4
src/config.h Normal file
View File

@ -0,0 +1,4 @@
#include <string>
const std::string BOT_TOKEN = "token";
const std::string GROCERY_LIST_CATEGORY = "listes-de-course";

View File

@ -1,8 +1,9 @@
#include <string>
#include <dpp/dpp.h>
#include <dpp/channel.h>
#include <dpp/unicode_emoji.h>
const std::string BOT_TOKEN = "NDkyOTgxMzcwMDg0MzkyOTYw.GAaPMf.LvxTvRkd7pMozkTxC3miWnqM5g7SwxLz2iGVPo";
#include "config.h"
int main()
{
@ -18,17 +19,24 @@ int main()
}
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")
//.add_field("Prix", "3.29")
.set_author(event.msg.author.username, "", "")
.set_footer(dpp::embed_footer().set_text("PyMenuVersion:2.0"));
bot.message_delete(event.msg.id, event.msg.channel_id);
dpp::message msg(event.msg.channel_id, embed);
bot.message_delete(event.msg.id, event.msg.channel_id);
}
});