commit 73fc774be9e6fdb4285ed30a272c8da829cbbd50 Author: starnakin Date: Sat Oct 7 22:49:52 2023 +0000 init diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4354bd2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +obj/* +PyMenu \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..8fa4df4 --- /dev/null +++ b/Makefile @@ -0,0 +1,26 @@ +CXX := g++ +CXXFLAGS := -Wall -Wextra -Werror -g +SRCDIR := src +OBJDIR := obj +NAME := PyMenu + +SRCS := $(wildcard $(SRCDIR)/*.cpp) +OBJS := $(patsubst $(SRCDIR)/%.cpp,$(OBJDIR)/%.o,$(SRCS)) + +all: $(NAME) + +$(OBJDIR)/%.o: $(SRCDIR)/%.cpp + mkdir -p obj + $(CXX) $(CXXFLAGS) -c $< -o $@ + +$(NAME): $(OBJS) + $(CXX) $(CXXFLAGS) $^ -o $@ -ldpp + +clean: + rm -rf $(OBJDIR) + +fclean: clean + rm -fr $(NAME) + +re: fclean + @make --no-print-directory all \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..c5c488c --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,45 @@ +#include +#include +#include + +const std::string BOT_TOKEN = "NDkyOTgxMzcwMDg0MzkyOTYw.GAaPMf.LvxTvRkd7pMozkTxC3miWnqM5g7SwxLz2iGVPo"; + +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::x); + bot.message_add_reaction(event.msg, dpp::unicode_emoji::white_check_mark); + } + else + { + 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")); + + bot.message_delete(event.msg.id, event.msg.channel_id); + + dpp::message msg(event.msg.channel_id, embed); + + event.send(msg); + } + }); + + bot.on_ready([&bot](const dpp::ready_t& event) + { + std::cout << bot.me.id << std::endl; + (void) event; + }); + + bot.start(dpp::st_wait); +} \ No newline at end of file