This commit is contained in:
starnakin 2023-10-07 22:49:52 +00:00
commit 73fc774be9
3 changed files with 73 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
obj/*
PyMenu

26
Makefile Normal file
View File

@ -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

45
src/main.cpp Normal file
View File

@ -0,0 +1,45 @@
#include <string>
#include <dpp/dpp.h>
#include <dpp/unicode_emoji.h>
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);
}