From 61111014181abc7b0e0f5442a78920174fd610b7 Mon Sep 17 00:00:00 2001 From: RGBCube Date: Sun, 27 Nov 2022 12:01:19 +0300 Subject: [PATCH] Fix poetry run --- minearchy_bot/__main__.py | 16 +++++++++------- pyproject.toml | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/minearchy_bot/__main__.py b/minearchy_bot/__main__.py index 9a33564..17671a9 100644 --- a/minearchy_bot/__main__.py +++ b/minearchy_bot/__main__.py @@ -8,14 +8,16 @@ from uvloop import install as install_uvloop from . import MinearchyBot -install_uvloop() -with (Path(__file__).parent.parent / "config.json").open() as f: - config = parse_json(f) +def main() -> None: + install_uvloop() -for key in ("HIDE", "NO_UNDERSCORE"): - env[f"JISHAKU_{key}"] = "True" + with (Path(__file__).parent.parent / "config.json").open() as f: + config = parse_json(f) -bot = MinearchyBot(token=config["BOT_TOKEN"], webhook_url=config["WEBHOOK_URL"]) + for key in ("HIDE", "NO_UNDERSCORE"): + env[f"JISHAKU_{key}"] = "True" -bot.run() + bot = MinearchyBot(token=config["BOT_TOKEN"], webhook_url=config["WEBHOOK_URL"]) + + bot.run() diff --git a/pyproject.toml b/pyproject.toml index 19b790b..1602b42 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,7 +19,7 @@ unimport = "*" pyright = "*" [tool.poetry.scripts] -bot = "minearchy_bot.__main__:__main__" +bot = "minearchy_bot.__main__:main" [tool.black] line-length = 100