diff --git a/app/bot.py b/app/bot.py index 03b2049..2521e19 100644 --- a/app/bot.py +++ b/app/bot.py @@ -103,17 +103,17 @@ async def write_debug_log(ctx: commands.Context) -> None: # traces_sample_rate=1.0, # ) - def runner(self) -> None: + def runner(self, *, token: str) -> None: try: - asyncio.run(self._runner()) + asyncio.run(self._runner(token=token)) except ValueError: self.logger.exception("Failed to start bot") asyncio.run(self.shutdown(status=1)) - async def _runner(self) -> None: + async def _runner(self, *, token: str) -> None: try: async with self: - await self.start(os.environ["DISCORD_BOT_TOKEN"]) + await self.start(token) except TypeError: self.logger.exception("Failed to start bot") await self.shutdown() diff --git a/main.py b/main.py index fe7f9ae..2c5c8a6 100644 --- a/main.py +++ b/main.py @@ -1,5 +1,7 @@ +import os + from app.bot import Bot if __name__ == "__main__": bot = Bot() - bot.runner() + bot.runner(token=os.environ["DISCORD_BOT_TOKEN"])