fix loop and youtube link

This commit is contained in:
fram3d 2024-02-05 20:22:41 +01:00
parent 2de31fc3ef
commit 3b86c53c7c
Signed by: fram3d
GPG Key ID: 938920E709EEA32A
1 changed files with 2 additions and 4 deletions

View File

@ -11,9 +11,7 @@ VERSION='0.1.0'
def processmsg(msg, rcpt): def processmsg(msg, rcpt):
if !msg.startswith("!"): if !msg.startswith("!"):
return "" return ""
if msg.startswith("http"): elif "youtube.com/watch" in msg:
return "link"
elif "youtube" in msg:
return msg.replace("youtube.com", "iv.datura.network") return msg.replace("youtube.com", "iv.datura.network")
def show_version(): def show_version():
@ -41,7 +39,7 @@ class MUCBot(slixmpp.ClientXMPP):
def muc_message(self, msg): def muc_message(self, msg):
rcpt=msg['from'].bare rcpt=msg['from'].bare
processmsg(msg['body'], rcpt) processmsg(msg['body'], rcpt)
if msg['type'] in ('chat', 'normal'): if msg['mucnick'] != self.nick):
self.send_message(mto=rcpt,mbody="%s: %s" % (msg['mucnick'],msg['body']),mtype='groupchat') self.send_message(mto=rcpt,mbody="%s: %s" % (msg['mucnick'],msg['body']),mtype='groupchat')