コード例 #1
0
 def run(self, bot, user, msg, tag_info):
     """Start/stop notifications or add/remove notifications from the list."""
     if msg.lower().startswith("!notifications on"):
         if not self.active:
             self.active = True
             self.callID = reactor.callLater(bot.NOTIFICATION_INTERVAL, self.writeNotification, bot)
             bot.write(self.responses["notifications_activate"]["msg"])
         else:
             bot.write(self.responses["notifications_already_on"]["msg"])
     elif msg.lower().startswith("!notifications off"):
         if is_callID_active(self.callID):
             self.callID.cancel()
         if self.active:
             self.active = False
             bot.write(self.responses["notifications_deactivate"]["msg"])
         else:
             bot.write(self.responses["notifications_already_off"]["msg"])
     elif msg.lower().startswith("!addnotification "):
         self.addnotification(bot, msg.split(" ", 1)[1])
     elif msg.lower().startswith("!delnotification "):
         self.delnotification(bot, msg.split(" ", 1)[1])
コード例 #2
0
ファイル: autogames.py プロジェクト: Tombstone2211/monkalot-1
    def run(self, bot, user, msg, tag_info):
        """Start/stop automatic games."""
        self.responses = bot.responses["AutoGames"]
        cmd = msg[len("!games "):]
        cmd.strip()

        if cmd == 'on':
            if not self.active:
                self.active = True
                self.callID = reactor.callLater(bot.AUTO_GAME_INTERVAL,
                                                self.randomGame, bot)
                bot.write(self.responses["autogames_activate"]["msg"])
            else:
                bot.write(self.responses["autogames_already_on"]["msg"])
        elif cmd == 'off':
            if is_callID_active(self.callID):
                self.callID.cancel()
            if self.active:
                self.active = False
                bot.write(self.responses["autogames_deactivate"]["msg"])
            else:
                bot.write(self.responses["autogames_already_off"]["msg"])
コード例 #3
0
ファイル: autogames.py プロジェクト: Tombstone2211/monkalot-1
 def close(self, bot):
     """Close the game."""
     if is_callID_active(self.callID):
         self.callID.cancel()
     self.active = False
コード例 #4
0
 def close(self, bot):
     """Turn off on shutdown or reload."""
     if is_callID_active(self.callID):
         self.callID.cancel()
     self.active = False
     bot.gameRunning = False
コード例 #5
0
 def close(self, bot):
     """Close minion game."""
     if is_callID_active(self.callID):
         self.callID.cancel()
     self.active = False
     bot.gameRunning = False