dm support

This commit is contained in:
saces 2026-02-07 17:46:17 +01:00
parent f19f7e8511
commit 55b78ea09e
3 changed files with 103 additions and 22 deletions

View file

@ -51,16 +51,16 @@ class DemoBot(SMALBot):
return
if msg["content"]["body"].startswith("!echo"):
logger.error(f"reply to this: {msg}")
txt = msg["content"]["body"][5:].strip()
if txt.strip() == "":
txt = "Are you kidding me?"
# self.sendmessage(msg["roomid"], txt)
self.sendmessagereply(msg["roomid"], msg["id"], msg["sender"], txt)
if txt == "":
txt = "Empty text? Are you kidding me?"
if msg["is_direct"]:
self.sendmessage(msg["roomid"], txt)
else:
self.sendmessagereply(msg["roomid"], msg["id"], msg["sender"], txt)
return
logger.info(f"ignored a message: {msg}")