testne komande
This commit is contained in:
		
							
								
								
									
										9
									
								
								chatbot
									
									
									
									
									
								
							
							
						
						
									
										9
									
								
								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')
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user