aboutsummaryrefslogtreecommitdiffstats
path: root/arthur/__init__.py
diff options
context:
space:
mode:
authorGravatar Chris Lovering <[email protected]>2022-08-21 22:12:24 +0100
committerGravatar Chris Lovering <[email protected]>2022-08-21 22:27:59 +0100
commit2b63ccba96d8651f2ff7d43a5f10f95f2b154268 (patch)
tree099fdeab7d8bd4c188f186cac13bd2ea70fb3563 /arthur/__init__.py
parentBump 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__.py12
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.