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
|
return
|
||||||
|
|
||||||
if message.text.startswith("@"):
|
if message.text.startswith("@"):
|
||||||
self.command(message, to=message.sender)
|
if self.command(message, to=message.sender):
|
||||||
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.direct(message)
|
self.direct(message)
|
||||||
@ -345,7 +346,8 @@ class Bot(ClientXMPP):
|
|||||||
return
|
return
|
||||||
|
|
||||||
if message.content.startswith("@"):
|
if message.content.startswith("@"):
|
||||||
self.command(message, room=message.room)
|
if self.command(message, room=message.room):
|
||||||
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.group(message)
|
self.group(message)
|
||||||
@ -396,6 +398,7 @@ class Bot(ClientXMPP):
|
|||||||
kwargs["mtype"] = "groupchat"
|
kwargs["mtype"] = "groupchat"
|
||||||
|
|
||||||
self.send_message(**kwargs)
|
self.send_message(**kwargs)
|
||||||
|
return True
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def uptime(self):
|
def uptime(self):
|
||||||
@ -405,17 +408,17 @@ class Bot(ClientXMPP):
|
|||||||
def meta(self, message, **kwargs):
|
def meta(self, message, **kwargs):
|
||||||
"""Handle meta command invocations."""
|
"""Handle meta command invocations."""
|
||||||
if message.text.startswith("@bots"):
|
if message.text.startswith("@bots"):
|
||||||
self.reply("🖐️", **kwargs)
|
return self.reply("🖐️", **kwargs)
|
||||||
|
|
||||||
def command(self, message, **kwargs):
|
def command(self, message, **kwargs):
|
||||||
"""Handle command invocations."""
|
"""Handle command invocations."""
|
||||||
if message.content.startswith("@uptime"):
|
if message.content.startswith("@uptime"):
|
||||||
self.reply(self.uptime, **kwargs)
|
return self.reply(self.uptime, **kwargs)
|
||||||
elif message.content.startswith("@help"):
|
elif message.content.startswith("@help"):
|
||||||
try:
|
try:
|
||||||
self.reply(cleandoc(self.help), **kwargs)
|
return self.reply(cleandoc(self.help), **kwargs)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
self.reply("No help found 🤔️", **kwargs)
|
return self.reply("No help found 🤔️", **kwargs)
|
||||||
|
|
||||||
|
|
||||||
class EchoBot(Bot):
|
class EchoBot(Bot):
|
||||||
|
Reference in New Issue
Block a user