From 831665232c044d4d2735531a071bdfc367d07da6 Mon Sep 17 00:00:00 2001 From: Michel Roux Date: Wed, 24 Jan 2024 12:25:33 +0100 Subject: [PATCH] feat: rework __main__ (close #170) --- divent/__main__.py | 3 +++ divent/bot.py | 2 +- pyproject.toml | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 divent/__main__.py diff --git a/divent/__main__.py b/divent/__main__.py new file mode 100644 index 0000000..5b90231 --- /dev/null +++ b/divent/__main__.py @@ -0,0 +1,3 @@ +from divent.bot import run + +run() diff --git a/divent/bot.py b/divent/bot.py index 85baf9d..1f940e8 100644 --- a/divent/bot.py +++ b/divent/bot.py @@ -342,6 +342,6 @@ async def ical(entity_id: str): return redirect(url_for(".login")) -def __main__(): +def run(): client.loop.create_task(client.start(DISCORD_TOKEN)) app.run("0.0.0.0", loop=client.loop) diff --git a/pyproject.toml b/pyproject.toml index 4a4acda..5fd1d3a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,7 +9,7 @@ homepage = "https://divent.crystalyx.net/" repository = "https://git.crystalyx.net/Xefir/Divent" [tool.poetry.scripts] -divent = 'divent.bot:__main__' +divent = 'divent.bot:run' [tool.poetry.dependencies] python = ">=3.8.1,<3.12"