|
@@ -1,6 +1,7 @@
|
|
|
from collections.abc import Callable, Coroutine
|
|
|
from typing import TypeVar, Any
|
|
|
from datetime import datetime
|
|
|
+from logging import Logger
|
|
|
|
|
|
from aiohttp import ClientSession
|
|
|
|
|
@@ -8,7 +9,6 @@ from ..types import Message, Context, Attachment, Command
|
|
|
from .base import Injector, InjectorWithCleanup, Simple
|
|
|
|
|
|
__all__ = [
|
|
|
- "Lazy",
|
|
|
"MessageInjector",
|
|
|
"ContextInjector",
|
|
|
"Origin",
|
|
@@ -22,7 +22,9 @@ __all__ = [
|
|
|
"CommandInjector",
|
|
|
"Request",
|
|
|
"Respond",
|
|
|
+ "LoggerInjector",
|
|
|
"Config",
|
|
|
+ "Lazy",
|
|
|
]
|
|
|
|
|
|
MessageInjector = Simple[Message](lambda m, c: m)
|
|
@@ -38,6 +40,8 @@ Attachments = Simple[list[Attachment]](lambda m, c: m.attachments)
|
|
|
CommandInjector = Simple[Command](lambda m, c: m.command)
|
|
|
Request = Simple[ClientSession](lambda m, c: c.request)
|
|
|
Respond = Simple[Callable[[], Coroutine[None, None, None]]](lambda m, c: c.respond)
|
|
|
+# TODO might be nice to auto format with command name
|
|
|
+LoggerInjector = Simple[Logger](lambda m, c: c.logger)
|
|
|
|
|
|
|
|
|
class Config(Injector[Any]):
|