Esempio n. 1
0
 def processChannelMessage(self, m):
     if (m.modCommand == "pyhello"):
         m.reply("Hello from a python module!!!!")
     elif (m.modCommand == "poop"):
         parser = CommandParser(m)
         if (parser.hasNumber()):
             numPoops = int(parser.findNumber())
             if (numPoops > 30):
                 m.reply("Too much poop")
             else:
                 m.reply((Constants.PILE_OF_POO + " ") * numPoops)
         else:
             m.reply("You must tell me how much to poop")
Esempio n. 2
0
    def processChannelMessage(self, m):
        if m.sender in BOT_NAMES:
            return

        commands = {
            "stats": self.gen_stats_reply,
            "purity": self.gen_purity_reply,
            "sexstats": self.gen_sex_reply,
        }

        if m.modCommand in commands:
            reply = "I'm afraid I just don't know."
            parser = CommandParser(m)
            if parser.hasVar("user"):
                user = parser.get("user")
                if KVStore.hasUserStore(user):
                    user_store = KVStore.getUserStore(user)
                    reply = commands[m.modCommand](user, user_store)
            else:
                chan_store = KVStore.getChanStore(m)
                reply = commands[m.modCommand](m.getChanname(), chan_store)
            m.reply("%s: %s" % (m.sender, reply))
        else:
            self.updateStats(m)