diff --git a/chatbot b/chatbot index e056407..6021d93 100755 --- a/chatbot +++ b/chatbot @@ -9,7 +9,7 @@ CONFIG_PATH = "./config.ini" VERSION='0.1.0' def processmsg(msg, rcpt): - if !msg.startswith("!"): + if msg.startswith("!"): return "" elif "youtube.com/watch" in msg: return msg.replace("youtube.com", "iv.datura.network") @@ -38,9 +38,10 @@ class MUCBot(slixmpp.ClientXMPP): def muc_message(self, msg): rcpt=msg['from'].bare - processmsg(msg['body'], rcpt) - if msg['mucnick'] != self.nick): - self.send_message(mto=rcpt,mbody="%s: %s" % (msg['mucnick'],msg['body']),mtype='groupchat') + answer = processmsg(msg['body'], rcpt) + if msg['mucnick'] != self.nick: + if answer is not None: + self.send_message(mto=rcpt,mbody="%s: %s" % (msg['mucnick'],answer),mtype='groupchat') if __name__ == '__main__': @@ -58,7 +59,7 @@ if __name__ == '__main__': JID = config.get('credentials', 'JID') PASSWORD = config.get('credentials', 'PASSWORD') NICK = config.get('credentials', 'NICK') - ROOM1 = config.get('credentials', 'ROOM') + ROOM = config.get('credentials', 'ROOM') HOST = None PORT = 5222 if "host" in config.options('credentials'):