diff --git a/src/config.h b/src/config.h new file mode 100644 index 0000000..d3a9287 --- /dev/null +++ b/src/config.h @@ -0,0 +1,4 @@ +#include + +const std::string BOT_TOKEN = "token"; +const std::string GROCERY_LIST_CATEGORY = "listes-de-course"; \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index e3796c3..6e6ef92 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,8 +1,9 @@ #include #include +#include #include -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); } });