forked from Decentrala/chatbot
fix loop and youtube link
This commit is contained in:
parent
2de31fc3ef
commit
3b86c53c7c
6
chatbot
6
chatbot
@ -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')
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user