From 7b59355a3c59f1f1a4a6888a87b4b2cbcac6e4b7 Mon Sep 17 00:00:00 2001 From: starnakin Date: Wed, 11 Oct 2023 13:52:42 +0000 Subject: [PATCH] add: set token into args --- Dockerfile | 2 +- README.md | 10 +++++++--- docker-compose.yml | 9 +++++++++ src/main.cpp | 4 ++-- 4 files changed, 19 insertions(+), 6 deletions(-) create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile index 98be48a..d1ffdbb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,4 +26,4 @@ RUN make COPY src/config.h src/config.h -ENTRYPOINT ["./PyMenu"] \ No newline at end of file +ENTRYPOINT ["./PyMenu", "$BOT_TOKEN"] \ No newline at end of file diff --git a/README.md b/README.md index e971f74..c41bdf2 100644 --- a/README.md +++ b/README.md @@ -46,15 +46,19 @@ make git clone https://git.chauvet.pro/starnakin/PyMenuBOT/ cd PyMenuBOT ``` -- Config the bot -Edit the `src/config.h` file and set the discord bot token - Build the docker image. ``` bash docker build -t pymenu . ``` +- Config the bot +Edit the `docker-compose.yml` file and set the discord bot token - Run the docker ```bash -docker run --restart=always --name=pymenu -d pymenu +docker-compose up -d +``` +- Run the docker - alternative without docker-compose +```bash +docker run --restart=always --name=pymenu -e BOT_TOKEN=token -d pymenu ``` ## Setting up on Your Discord Server diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..7c6e53c --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,9 @@ +version: "3" +services: + pymenu: + container_name: pymenu + image: pymenu + build: . + restart: always + environment: + - BOT_TOKEN=TOKEN \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index be42941..97a6e4d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -5,9 +5,9 @@ #include "config.h" -int main() +int main(int ac, char **av) { - dpp::cluster bot(BOT_TOKEN, dpp::i_default_intents | dpp::i_message_content); + dpp::cluster bot(ac == 2 ? av[1] : BOT_TOKEN, dpp::i_default_intents | dpp::i_message_content); bot.on_log(dpp::utility::cout_logger());