!bots
-> /bots
This commit is contained in:
parent
895d0c8787
commit
3e83a9390b
@ -1,5 +1,9 @@
|
||||
# xbotlib x.x.x (UNRELEASED)
|
||||
|
||||
# xbotlib 0.9.0 (2021-01-15)
|
||||
|
||||
- Re-worked `!bots` -> `/bots`
|
||||
|
||||
# xbotlib 0.8.2 (2021-01-15)
|
||||
|
||||
- Add `!bots` command to summon status
|
||||
|
@ -4,7 +4,7 @@ build-backend = "poetry.masonry.api"
|
||||
|
||||
[tool.poetry]
|
||||
name = "xbotlib"
|
||||
version = "0.8.2"
|
||||
version = "0.9.0"
|
||||
description = "XMPP bots for humans"
|
||||
authors = ["decentral1se <lukewm@riseup.net>"]
|
||||
maintainers = ["decentral1se <lukewm@riseup.net>"]
|
||||
|
19
xbotlib.py
19
xbotlib.py
@ -213,6 +213,10 @@ class Bot(ClientXMPP):
|
||||
if message["type"] in ("chat", "normal"):
|
||||
_message = SimpleMessage(message)
|
||||
|
||||
if _message.body.startswith("/"):
|
||||
self.meta(_message, to=_message.sender)
|
||||
return
|
||||
|
||||
if _message.body.startswith("!"):
|
||||
self.command(_message, to=_message.sender)
|
||||
return
|
||||
@ -258,6 +262,10 @@ class Bot(ClientXMPP):
|
||||
if message["mucnick"] != self.config.nick:
|
||||
_message = SimpleMessage(message)
|
||||
|
||||
if _message.body.startswith("/"):
|
||||
self.meta(_message, room=_message.room)
|
||||
return
|
||||
|
||||
if f"{self.nick}:!" in _message.body:
|
||||
self.command(_message, room=_message.room)
|
||||
return
|
||||
@ -319,8 +327,15 @@ class Bot(ClientXMPP):
|
||||
self.reply(self.help, **kwargs)
|
||||
except AttributeError:
|
||||
self.reply("No help found 🤔️", **kwargs)
|
||||
elif command == "bots" and "room" in kwargs:
|
||||
self.reply("o/", **kwargs)
|
||||
else:
|
||||
self.log.error(f"'{command}' command is not recognised")
|
||||
|
||||
def meta(self, message, **kwargs):
|
||||
"""Handle "/" style commands with built-in responses."""
|
||||
command = message.body.split("/")[-1]
|
||||
|
||||
if command == "bots":
|
||||
self.reply(f"🖐️", **kwargs)
|
||||
else:
|
||||
self.log.error(f"'{command}' command is not recognised")
|
||||
|
||||
|
Reference in New Issue
Block a user