From 52ccc4c6b5fd7e6333504999dc7a934da243999c Mon Sep 17 00:00:00 2001 From: Bulat Kurbanov Date: Fri, 9 Aug 2024 21:57:30 +0200 Subject: [PATCH] Fix --- docker/build.dockerfile | 4 ++-- src/services/discord.py | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/docker/build.dockerfile b/docker/build.dockerfile index 63af662..f8390cd 100644 --- a/docker/build.dockerfile +++ b/docker/build.dockerfile @@ -10,7 +10,7 @@ RUN --mount=type=ssh /opt/venv/bin/poetry export --without-hashes ${POETRY_EXPOR && /opt/venv/bin/pip install --no-cache-dir -r requirements.txt -FROM python:3.11-slim AS runtime +FROM python:3.12-slim AS runtime RUN apt update && apt install -y --no-install-recommends netcat-traditional wkhtmltopdf && apt clean @@ -25,4 +25,4 @@ WORKDIR /app EXPOSE 80 -CMD ["python", "/app/main.py"] +CMD ["python3.12", "/app/main.py"] diff --git a/src/services/discord.py b/src/services/discord.py index c37321e..336dbc2 100644 --- a/src/services/discord.py +++ b/src/services/discord.py @@ -1,3 +1,5 @@ +import asyncio + import discord from discord.abc import Messageable from discord import Object @@ -95,4 +97,7 @@ async def delete(interaction: discord.Interaction, game: str): async def start_discord_sevice(): - client.run(config.DISCORD_BOT_TOKEN) + print("Starting Discord service...") + + loop = asyncio.get_event_loop() + await loop.run_in_executor(None, client.run, config.DISCORD_BOT_TOKE)