Browse Source

Clean up types

Kirk Trombley 4 years ago
parent
commit
faf7f29aa8
1 changed files with 4 additions and 3 deletions
  1. 4 3
      lib/rollbot/types.py

+ 4 - 3
lib/rollbot/types.py

@@ -32,7 +32,7 @@ class Response:
     attachments: list[Attachment]
 
     @staticmethod
-    def from_message(msg: Message, text: str, attachments: list[Attachment] = None) -> "Response":
+    def from_message(msg: Message, text: Optional[str] = None, attachments: list[Attachment] = None) -> "Response":
         return Response(
             origin_id=msg.origin_id,
             channel_id=msg.channel_id,
@@ -49,6 +49,7 @@ class Context:
 
 
 CommandType = Callable[[Message, Context], Coroutine[None, None, None]]
+StartupShutdownType = Callable[[Context], Coroutine[None, None, None]]
 
 
 @dataclass
@@ -57,5 +58,5 @@ class CommandConfiguration:
     call_and_response: dict[str, str]
     aliases: dict[str, str]
     bangs: Container[str] = ("!",)
-    startup: list[Callable[[Context], Coroutine[None, None, None]]] = field(default_factory=list)
-    shutdown: list[Callable[[Context], Coroutine[None, None, None]]] = field(default_factory=list)
+    startup: list[StartupShutdownType] = field(default_factory=list)
+    shutdown: list[StartupShutdownType] = field(default_factory=list)