Use new indentation style

This commit is contained in:
Luke Murphy 2021-01-16 13:09:41 +01:00
parent aa64a1a68e
commit b1b9c0e701
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC
1 changed files with 22 additions and 19 deletions

View File

@ -214,16 +214,18 @@ class Bot(ClientXMPP):
def direct_message(self, message):
"""Handle message event."""
if message["type"] in ("chat", "normal"):
_message = SimpleMessage(message)
if message["type"] not in ("chat", "normal"):
return
if "@" in _message.body:
self.direct_command(_message)
_message = SimpleMessage(message)
try:
self.direct(_message)
except AttributeError:
self.log.info(f"Bot.direct not implemented for {self.nick}")
if "@" in _message.body:
self.direct_command(_message)
try:
self.direct(_message)
except AttributeError:
self.log.info(f"Bot.direct not implemented for {self.nick}")
def session_start(self, message):
"""Handle session_start event."""
@ -257,20 +259,21 @@ class Bot(ClientXMPP):
def group_message(self, message):
"""Handle groupchat_message event."""
if message["type"] in ("groupchat", "normal"):
if message["mucnick"] != self.config.nick:
_message = SimpleMessage(message)
if message["type"] not in ("groupchat", "normal"):
return
if _message.body.startswith("@"):
self.meta(_message, room=_message.room)
if message["mucnick"] == self.config.nick:
return
if f"{self.nick}:!" in _message.body:
self.command(_message, room=_message.room)
_message = SimpleMessage(message)
try:
self.group(_message)
except AttributeError:
self.log.info(f"Bot.group not implemented for {self.nick}")
if self.nick in _message.body and "@" in _message.body:
self.group_command(_message, room=_message.room)
try:
self.group(_message)
except AttributeError:
self.log.info(f"Bot.group not implemented for {self.nick}")
def register_xmpp_plugins(self):
"""Register XMPP plugins that the bot supports."""