add: config file and verif category name
This commit is contained in:
		
							
								
								
									
										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 <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);
 | 
			
		||||
        }
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user