示例#1
0
    def execute(self,user,access,irc_msg):
        m=self.commandre.search(irc_msg.command)
        if not m:
            return 0

        if access < self.level:
            irc_msg.reply("You do not have enough access to use this command")
            return 0

        username = self.config.get("clickatell", "user")
        password = self.config.get("clickatell", "pass")
        api_id = self.config.get("clickatell", "api")

        ct = Clickatell(username, password, api_id)
        if not ct.auth():
            irc_msg.reply("Could not authenticate with server. Super secret message not sent.")
            return 1

        balance = ct.getbalance()

        if not balance:
            reply="Help me help you. I need the kwan. SHOW ME THE MONEY"
        else:
            reply="Current kwan balance: %d"%(float(balance),)

        irc_msg.reply(reply)
        return 1