예제 #1
0
    def __init__(self, bot, md):
        BotInterface.__init__(self, bot, md)
        bot.register_module_info(__name__, "MysqLtest", "The Junky",
                                 "mysqlclient for ss", ".01")
        self._db = Amysql(self.logger)
        # self._db.setDbCredentialsFromFile(
        #   self.module_path + R"/db.conf", "db")
        self._db.setDbCredentialsFromFile(self.module_path + R"/egnetdb.conf",
                                          "db")
        self._db.start()
        self.clist = [
            COMMAND_TYPE_PUBLIC, COMMAND_TYPE_TEAM, COMMAND_TYPE_FREQ,
            COMMAND_TYPE_PRIVATE, COMMAND_TYPE_CHAT
        ]
        self._sql_command_id = bot.register_command('!sql', None, 9,
                                                    self.clist, "web",
                                                    "[query]", 'sql it zz')
        self._sqlnl_command_id = bot.register_command('!sqlnl', None, 9,
                                                      self.clist, "web",
                                                      "[query]", 'sql it zz')
        self.level = logging.DEBUG
        self.timer_man = TimerManager.TimerManager()
        self.timer_man.set(.01, 1)
        self.timer_man.set(300, 2)
        self.chat = bot.add_chat("st4ff")

        formatter = logging.Formatter('%(message)s')
        handler = LoggingRemoteHandler(logging.DEBUG, bot, "Ratio")
        handler.setFormatter(formatter)
        self.logger.addHandler(handler)
예제 #2
0
파일: statsdb.py 프로젝트: prozaker/PyCore
    def __init__(self, bot, md):
        BotInterface.__init__(self, bot, md)
        bot.register_module_info(__name__, "stats", "The Junky",
                                 "Stats Retrieval Module", ".01")
        self._db = Amysql(self.logger)
        self._db.setDbCredentialsFromFile(self.module_path + R"/statsdb.conf",
                                          "db")
        self._db.start()
        # self.clist = [COMMAND_TYPE_PUBLIC, COMMAND_TYPE_TEAM,
        #   COMMAND_TYPE_FREQ, COMMAND_TYPE_PRIVATE, COMMAND_TYPE_CHAT]
        self.clist = [COMMAND_TYPE_PRIVATE]
        # self._sql_command_id = bot.register_command(
        #   '!sql', None, 9, self.clist, "web", "[query]", 'sql it zz')
        # self._sqlnl_command_id = bot.register_command(
        #   '!sqlnl', None, 9, self.clist, "web", "[query]", 'sql it zz')
        self._last_jp = bot.register_command('!jackpots', None, 0, self.clist,
                                             "Stats", "", 'last jackpots won')
        self._recs = bot.register_command('!recs', None, 0, self.clist,
                                          "Stats", "[reset id]", 'top ratios')
        self._points = bot.register_command('!points', None, 0, self.clist,
                                            "Stats", "[reset id]",
                                            'Top points')
        self._squads = bot.register_command('!squads', None, 0, self.clist,
                                            "Stats", "[reset id]",
                                            'top squads')
        self._resets = bot.register_command('!resets', None, 0, self.clist,
                                            "Stats", "", 'recentreset ids')
        self.level = logging.DEBUG
        self.timer_man = TimerManager.TimerManager()
        self.timer_man.set(.01, 1)
        self.timer_man.set(300, 2)
        self.chat = bot.add_chat("st4ff")
        self.cache = {
            # !cmd: (Cached_result, time)
            "!jackpots": (None, 0, "jackpots.txt"),
            "!recs": (None, 0, "recs.txt"),
            "!points": (None, 0, "points.txt"),
            "!squads": (None, 0, "squads.txt")
        }

        formatter = logging.Formatter('%(message)s')
        handler = LoggingRemoteHandler(logging.DEBUG, bot, "Ratio")
        handler.setFormatter(formatter)
        self.logger.addHandler(handler)
예제 #3
0
파일: egdldb.py 프로젝트: prozaker/PyCore
    def __init__(self, bot, md):
        BotInterface.__init__(self, bot, md)
        bot.register_module_info(
            __name__,
            "MysqLtest",
            "The Junky",
            "egdldb helper",
            ".01b"
        )
        self._db = Amysql(self.logger)
        self._db.setDbCredentialsFromFile(
            self.module_path + R"/egdldb.conf", "db")
        self._db.start()
        self.clist = [COMMAND_TYPE_PUBLIC, COMMAND_TYPE_TEAM,
                      COMMAND_TYPE_FREQ, COMMAND_TYPE_PRIVATE,
                      COMMAND_TYPE_CHAT]
        self.commands = {
            # bot.register_command(
            #     '!sql',
            #     None,
            #     9,
            #     self.clist,
            #     "db",
            #     "[query]",
            #     'sql it zz'
            # ): (self.cmd_sql, ""),
            bot.register_command(
                '!sqlnl',
                None,
                9,
                self.clist,
                "db",
                "[query]",
                'sql it zz'
            ): (self.cmd_sql, "nl"),
            bot.register_command(
                '!addplayer',
                "!ap",
                5,
                self.clist,
                "egdl",
                "[name:vp:squadid]",
                'create/add new player to current league'
            ): (self.cmd_ap, ""),
            bot.register_command(
                '!changeplayer',
                "!cp",
                5,
                self.clist,
                "egdl",
                "[name:vp:squadid]",
                'update existing player'
            ): (self.cmd_cp, ""),
            bot.register_command(
                '!deleteplayer',
                "!dp",
                5,
                self.clist,
                "egdl",
                "[name]",
                'update existing player'
            ): (self.cmd_dp, ""),
            bot.register_command(
                '!listsquads',
                "!ls",
                5,
                self.clist,
                "egdl",
                "",
                'list squads'
            ): (self.cmd_ls, ""),
            bot.register_command(
                '!listplayers',
                "!lp",
                5,
                self.clist,
                "egdl",
                "[squad]",
                'list squads'
            ): (self.cmd_lp, "")
        }
        self.level = logging.DEBUG
        self.timer_man = TimerManager.TimerManager()
        self.timer_man.set(.01, 1)
        self.timer_man.set(300, 2)
        self.chat = bot.add_chat("st4ff")

        formatter = logging.Formatter('%(message)s')
        handler = LoggingRemoteHandler(logging.DEBUG, bot, "Ratio")
        handler.setFormatter(formatter)
        self.logger.addHandler(handler)