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

View File

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