add: config file and verif category name
This commit is contained in:
parent
9f83b5baea
commit
bdc7caf1b3
4
src/config.h
Normal file
4
src/config.h
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
#include <string>
|
||||||
|
|
||||||
|
const std::string BOT_TOKEN = "token";
|
||||||
|
const std::string GROCERY_LIST_CATEGORY = "listes-de-course";
|
16
src/main.cpp
16
src/main.cpp
@ -1,8 +1,9 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <dpp/dpp.h>
|
#include <dpp/dpp.h>
|
||||||
|
#include <dpp/channel.h>
|
||||||
#include <dpp/unicode_emoji.h>
|
#include <dpp/unicode_emoji.h>
|
||||||
|
|
||||||
const std::string BOT_TOKEN = "NDkyOTgxMzcwMDg0MzkyOTYw.GAaPMf.LvxTvRkd7pMozkTxC3miWnqM5g7SwxLz2iGVPo";
|
#include "config.h"
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
@ -18,17 +19,24 @@ int main()
|
|||||||
}
|
}
|
||||||
else
|
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()
|
dpp::embed embed = dpp::embed()
|
||||||
.set_color(dpp::colors::sea_green)
|
.set_color(dpp::colors::sea_green)
|
||||||
.set_title(event.msg.content)
|
.set_title(event.msg.content)
|
||||||
.add_field("Quantite", "1", true)
|
.add_field("Quantite", "1", true)
|
||||||
.add_field("Prix", "3.29")
|
//.add_field("Prix", "3.29")
|
||||||
.set_author(event.msg.author.username, "", "")
|
.set_author(event.msg.author.username, "", "")
|
||||||
.set_footer(dpp::embed_footer().set_text("PyMenuVersion:2.0"));
|
.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);
|
dpp::message msg(event.msg.channel_id, embed);
|
||||||
|
|
||||||
|
bot.message_delete(event.msg.id, event.msg.channel_id);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user