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