Thread True back from reply to stop flow
Closes https://git.autonomic.zone/decentral1se/xbotlib/issues/27.
This commit is contained in:
parent
7d5571afcb
commit
866029256a
15
xbotlib.py
15
xbotlib.py
@ -293,7 +293,8 @@ class Bot(ClientXMPP):
|
||||
return
|
||||
|
||||
if message.text.startswith("@"):
|
||||
self.command(message, to=message.sender)
|
||||
if self.command(message, to=message.sender):
|
||||
return
|
||||
|
||||
try:
|
||||
self.direct(message)
|
||||
@ -345,7 +346,8 @@ class Bot(ClientXMPP):
|
||||
return
|
||||
|
||||
if message.content.startswith("@"):
|
||||
self.command(message, room=message.room)
|
||||
if self.command(message, room=message.room):
|
||||
return
|
||||
|
||||
try:
|
||||
self.group(message)
|
||||
@ -396,6 +398,7 @@ class Bot(ClientXMPP):
|
||||
kwargs["mtype"] = "groupchat"
|
||||
|
||||
self.send_message(**kwargs)
|
||||
return True
|
||||
|
||||
@property
|
||||
def uptime(self):
|
||||
@ -405,17 +408,17 @@ class Bot(ClientXMPP):
|
||||
def meta(self, message, **kwargs):
|
||||
"""Handle meta command invocations."""
|
||||
if message.text.startswith("@bots"):
|
||||
self.reply("🖐️", **kwargs)
|
||||
return self.reply("🖐️", **kwargs)
|
||||
|
||||
def command(self, message, **kwargs):
|
||||
"""Handle command invocations."""
|
||||
if message.content.startswith("@uptime"):
|
||||
self.reply(self.uptime, **kwargs)
|
||||
return self.reply(self.uptime, **kwargs)
|
||||
elif message.content.startswith("@help"):
|
||||
try:
|
||||
self.reply(cleandoc(self.help), **kwargs)
|
||||
return self.reply(cleandoc(self.help), **kwargs)
|
||||
except AttributeError:
|
||||
self.reply("No help found 🤔️", **kwargs)
|
||||
return self.reply("No help found 🤔️", **kwargs)
|
||||
|
||||
|
||||
class EchoBot(Bot):
|
||||
|
Reference in New Issue
Block a user