diff options
author | 2022-08-21 22:12:24 +0100 | |
---|---|---|
committer | 2022-08-21 22:27:59 +0100 | |
commit | 2b63ccba96d8651f2ff7d43a5f10f95f2b154268 (patch) | |
tree | 099fdeab7d8bd4c188f186cac13bd2ea70fb3563 /arthur/__init__.py | |
parent | Bump Dockerfile and CI to Python 3.10 (diff) |
Use BotBase from bot-core
This includes:
- Moving to an async main function to start the bot
- Moving all extension loading (barring jishaku) to bot core
- Adding dunder init files to all packages, required by bot-core ext loaders
Diffstat (limited to 'arthur/__init__.py')
-rw-r--r-- | arthur/__init__.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/arthur/__init__.py b/arthur/__init__.py index a7efb0b..0d837f6 100644 --- a/arthur/__init__.py +++ b/arthur/__init__.py @@ -1,7 +1,19 @@ """King Arthur is Python Discord's DevOps utility bot.""" +import asyncio +import os from functools import partial +from typing import TYPE_CHECKING import loguru +if TYPE_CHECKING: + from arthur.bot import KingArthur + logger = loguru.logger.opt(colors=True) logger.opt = partial(logger.opt, colors=True) + +# On Windows, the selector event loop is required for aiodns. +if os.name == "nt": + asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) + +instance: "KingArthur" = None # Global Bot instance. |