|
@@ -34,14 +34,10 @@ class Rollbot(Generic[RawMsg]):
|
|
|
raise NotImplemented("Must be implemented by driver")
|
|
|
|
|
|
async def on_startup(self):
|
|
|
- await asyncio.gather(
|
|
|
- *[task(self.context) for task in self.command_config.startup]
|
|
|
- )
|
|
|
+ await asyncio.gather(*[task(self.context) for task in self.command_config.startup])
|
|
|
|
|
|
async def on_shutdown(self):
|
|
|
- await asyncio.gather(
|
|
|
- *[task(self.context) for task in self.command_config.shutdown]
|
|
|
- )
|
|
|
+ await asyncio.gather(*[task(self.context) for task in self.command_config.shutdown])
|
|
|
|
|
|
async def on_message(self, incoming: RawMsg):
|
|
|
message = self.parse(incoming)
|
|
@@ -49,15 +45,10 @@ class Rollbot(Generic[RawMsg]):
|
|
|
return
|
|
|
|
|
|
message.command = Command.from_text(message.text)
|
|
|
- if (
|
|
|
- message.command is None
|
|
|
- or message.command.bang not in self.command_config.bangs
|
|
|
- ):
|
|
|
+ if message.command is None or message.command.bang not in self.command_config.bangs:
|
|
|
return
|
|
|
|
|
|
- command = self.command_config.aliases.get(
|
|
|
- message.command.name, message.command.name
|
|
|
- )
|
|
|
+ command = self.command_config.aliases.get(message.command.name, message.command.name)
|
|
|
res = self.command_config.call_and_response.get(command, None)
|
|
|
if res is not None:
|
|
|
await self.respond(Response.from_message(message, res))
|
|
@@ -66,9 +57,7 @@ class Rollbot(Generic[RawMsg]):
|
|
|
command_call = self.command_config.commands.get(command, None)
|
|
|
if command_call is None:
|
|
|
await self.respond(
|
|
|
- Response.from_message(
|
|
|
- message, f"Sorry! I don't know the command {command}."
|
|
|
- )
|
|
|
+ Response.from_message(message, f"Sorry! I don't know the command {command}.")
|
|
|
)
|
|
|
return
|
|
|
|