From 2de31fc3ef15eef004e2e99407f6ca636ba9b595 Mon Sep 17 00:00:00 2001 From: MaD3V Date: Mon, 5 Feb 2024 20:12:30 +0100 Subject: [PATCH] testne komande --- chatbot | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/chatbot b/chatbot index 27c9814..9cde5ed 100755 --- a/chatbot +++ b/chatbot @@ -9,7 +9,12 @@ CONFIG_PATH = "./config.ini" VERSION='0.1.0' def processmsg(msg, rcpt): - return f"Echo: {msg}" + if !msg.startswith("!"): + return "" + if msg.startswith("http"): + return "link" + elif "youtube" in msg: + return msg.replace("youtube.com", "iv.datura.network") def show_version(): print("chatbot " + VERSION) @@ -36,7 +41,7 @@ class MUCBot(slixmpp.ClientXMPP): def muc_message(self, msg): rcpt=msg['from'].bare processmsg(msg['body'], rcpt) - if msg['mucnick'] != self.nick: + if msg['type'] in ('chat', 'normal'): self.send_message(mto=rcpt,mbody="%s: %s" % (msg['mucnick'],msg['body']),mtype='groupchat')