From 2ef2ecacc9b45e373effa43e17ef052409ef7d1e Mon Sep 17 00:00:00 2001 From: gsd Date: Tue, 7 Mar 2023 23:02:56 +0300 Subject: [PATCH] =?UTF-8?q?=D0=BF=D1=80=D0=B8=D0=B4=D1=83=D0=BC=D0=B0?= =?UTF-8?q?=D0=BB=20=D0=B3=D0=BE=D0=B2=D0=BD=D0=B0=20=D1=87=D1=82=D0=BE?= =?UTF-8?q?=D0=B1=20=D1=83=D0=BF=D1=80=D0=BE=D1=81=D1=82=D0=B8=D1=82=D1=8C?= =?UTF-8?q?=20=D0=B6=D0=B8=D0=B7=D0=BD=D1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 3 ++- bot.py | 9 ++++++++- git_build/Dockerfile | 1 + 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3eb60e3..811544c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,4 +3,5 @@ RUN python -m pip install git+https://github.com/Rapptz/discord.py aiohttp ENV PYTHONUNBUFFERED 1 WORKDIR /app COPY ./ ./ -ENTRYPOINT ["python", "bot.py"] +RUN "python bot.py --import-test" +ENTRYPOINT ["python", "bot.py"] \ No newline at end of file diff --git a/bot.py b/bot.py index 09eae28..dd4002e 100644 --- a/bot.py +++ b/bot.py @@ -8,7 +8,7 @@ from discord.ext import tasks from player import * import traceback from exceptions import * -import asyncio, sys +import asyncio, sys, argparse #Скрыть сообщение если надо ephemeral=True class DiscordClient(discord.Client): @@ -142,6 +142,13 @@ class DiscordClient(discord.Client): print("backend is up, continue build app") if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument("--import-test", action="store_true", default=None) + args = parser.parse_args() + if args.import_test: + DiscordClient("","") + sys.exit(0) + DiscordClient( os.getenv("BACKEND_URL"), os.getenv("BACKEND_SECRETKEY") diff --git a/git_build/Dockerfile b/git_build/Dockerfile index b0ba478..79b26dc 100644 --- a/git_build/Dockerfile +++ b/git_build/Dockerfile @@ -3,4 +3,5 @@ RUN python -m pip install git+https://github.com/Rapptz/discord.py aiohttp WORKDIR /app RUN cd /tmp && git clone https://git.pblr-nyk.pro/gsd/Facti13.Bot.Discord.V2 && cp -a Facti13.Bot.Discord.V2/. /app && rm -r Facti13.Bot.Discord.V2 ENV PYTHONUNBUFFERED 1 +RUN "python bot.py --import-test" ENTRYPOINT ["python", "bot.py"] \ No newline at end of file