testne komande

This commit is contained in:
mad3v 2024-02-05 20:12:30 +01:00
parent d2438e59ea
commit 2de31fc3ef
1 changed files with 7 additions and 2 deletions

View File

@ -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')