def privmsg(self, user, channel, msg): addressed = False if msg.startswith(self.nickname): msg = msg[len(self.nickname) + 1:] addressed = True msg.strip() msg = msg.lower() nice_user = user.split('!')[0] if scan_msg(msg, nice_user): self.msg(channel, nice_user + ': ' + HELP_TXT) if ('i know' in msg or 'no spam for me' in msg) and addressed: they_know_now(nice_user) self.msg(channel, 'I now count %s as smart' % nice_user) return if 'spam me' in msg and addressed: they_dont_know(nice_user) self.msg(channel, nice_user + ": you will now be help spammed") return if 'help' in msg and addressed: self.msg(channel, nice_user + BOT_HELP_TXT) return if ('info' in msg or 'hi' in msg) and addressed: self.msg(channel, nice_user + ": " + BOT_INFO_TXT) return if 'ping' in msg and addressed: self.msg(channel, nice_user + ': pong') return if 'freetime' in msg and addressed: self.msg(channel, "gcibot, I love you. We should go out some time") return
def privmsg(self, user, channel, msg): addressed = False if msg.startswith(self.nickname): msg = msg[len(self.nickname)+1:] addressed = True msg.strip() msg = msg.lower() nice_user = user.split('!')[0] # Restart the bot if the user is sugarbot-git # We need to find a elegant way. if "sugarbot-git" in nice_user and re.match(UPDATE_RE, msg): self.msg(channel, 'I will update now') reactor.stop() for ignored in IGNORED_BOTS: if ignored in nice_user.lower(): # Just talking with bot :( return if scan_msg(msg, nice_user): self.msg(channel, nice_user + ', ' + HELP_TXT) if ('i know' in msg or 'no spam for me' in msg) and addressed: they_know_now(nice_user) self.msg(channel, 'I now count %s as smart' % nice_user) return if ('spam me' in msg or "i don't know" in msg or 'i dont know' in msg) and addressed: they_dont_know(nice_user) self.msg(channel, nice_user + ", you will now be help spammed") return re_result = re.search("([\S]{1,9999}) knows", msg) if re_result and addressed: they_know_now(re_result.groups()[0]) self.msg(channel, 'I now count %s as smart' % re_result.groups()[0]) return if 'help' in msg and addressed: self.msg(channel, nice_user + BOT_HELP_TXT) return if ('info' in msg or 'hi' in msg) and addressed: self.msg(channel, nice_user + ", " + BOT_INFO_TXT) return if 'ping' in msg and addressed: self.msg(channel, nice_user + ', pong') return if 'version' in msg and addressed: self.msg(channel, nice_user + ': ' + BOT_VERSION) return if 'freetime' in msg and addressed: self.msg(channel, "gcibot, I love you. We should go out some time") return