当前位置: 首页>>代码示例>>Python>>正文


Python HandlerManager.add_handler方法代码示例

本文整理汇总了Python中pajbot.managers.handler.HandlerManager.add_handler方法的典型用法代码示例。如果您正苦于以下问题:Python HandlerManager.add_handler方法的具体用法?Python HandlerManager.add_handler怎么用?Python HandlerManager.add_handler使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pajbot.managers.handler.HandlerManager的用法示例。


在下文中一共展示了HandlerManager.add_handler方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: start_quest

# 需要导入模块: from pajbot.managers.handler import HandlerManager [as 别名]
# 或者: from pajbot.managers.handler.HandlerManager import add_handler [as 别名]
    def start_quest(self):
        HandlerManager.add_handler('on_message', self.on_message)

        redis = RedisManager.get()

        self.load_progress(redis=redis)
        self.load_data(redis=redis)
开发者ID:Neclord9,项目名称:pajbot,代码行数:9,代码来源:typeemote.py

示例2: command_start

# 需要导入模块: from pajbot.managers.handler import HandlerManager [as 别名]
# 或者: from pajbot.managers.handler.HandlerManager import add_handler [as 别名]
    def command_start(self, **options):
        bot = options['bot']
        source = options['source']
        message = options['message']

        if self.trivia_running:
            bot.safe_me('{}, a trivia is already running'.format(source.username_raw))
            return

        self.trivia_running = True
        self.job.resume()

        try:
            self.point_bounty = int(message)
            if self.point_bounty < 0:
                self.point_bounty = 0
            elif self.point_bounty > 50:
                self.point_bounty = 50
        except:
            self.point_bounty = self.settings['default_point_bounty']

        if self.point_bounty > 0:
            bot.safe_me('The trivia has started! {} points for each right answer!'.format(self.point_bounty))
        else:
            bot.safe_me('The trivia has started!')

        HandlerManager.add_handler('on_message', self.on_message)
开发者ID:pajlada,项目名称:pajbot,代码行数:29,代码来源:trivia.py

示例3: start_quest

# 需要导入模块: from pajbot.managers.handler import HandlerManager [as 别名]
# 或者: from pajbot.managers.handler.HandlerManager import add_handler [as 别名]
    def start_quest(self):
        HandlerManager.add_handler('on_user_win_hs_bet', self.on_user_win_hs_bet)

        redis = RedisManager.get()

        self.load_progress(redis=redis)
        self.load_data(redis=redis)

        self.LIMIT = self.hsbet_points_required
开发者ID:Neclord9,项目名称:pajbot,代码行数:11,代码来源:winhsbetpoints.py

示例4: start_quest

# 需要导入模块: from pajbot.managers.handler import HandlerManager [as 别名]
# 或者: from pajbot.managers.handler.HandlerManager import add_handler [as 别名]
    def start_quest(self):
        HandlerManager.add_handler('on_duel_complete', self.on_duel_complete)

        redis = RedisManager.get()

        self.load_progress(redis=redis)
        self.load_data(redis=redis)

        self.LIMIT = self.points_required
开发者ID:Neclord9,项目名称:pajbot,代码行数:11,代码来源:winduelpoints.py

示例5: enable

# 需要导入模块: from pajbot.managers.handler import HandlerManager [as 别名]
# 或者: from pajbot.managers.handler.HandlerManager import add_handler [as 别名]
    def enable(self, bot):
        HandlerManager.add_handler('on_message', self.on_message, priority=200)
        HandlerManager.add_handler('on_commit', self.on_commit)

        if self.db_session is not None:
            self.db_session.commit()
            self.db_session.close()
            self.db_session = None
            self.links = {}
        self.db_session = DBManager.create_session()
开发者ID:Neclord9,项目名称:pajbot,代码行数:12,代码来源:linktracker.py

示例6: enable

# 需要导入模块: from pajbot.managers.handler import HandlerManager [as 别名]
# 或者: from pajbot.managers.handler.HandlerManager import add_handler [as 别名]
 def enable(self, bot):
     HandlerManager.add_handler('on_pubmsg', self.on_pubmsg)
     self.bot = bot
开发者ID:Neclord9,项目名称:pajbot,代码行数:5,代码来源:pyramid.py

示例7: __init__

# 需要导入模块: from pajbot.managers.handler import HandlerManager [as 别名]
# 或者: from pajbot.managers.handler.HandlerManager import add_handler [as 别名]

#.........这里部分代码省略.........
        self.users = UserManager()
        self.decks = DeckManager()
        self.module_manager = ModuleManager(self.socket_manager, bot=self).load()
        self.commands = CommandManager(
                socket_manager=self.socket_manager,
                module_manager=self.module_manager,
                bot=self).load()
        self.filters = FilterManager().reload()
        self.banphrase_manager = BanphraseManager(self).load()
        self.timer_manager = TimerManager(self).load()
        self.kvi = KVIManager()
        self.emotes = EmoteManager(self)
        self.twitter_manager = TwitterManager(self)

        HandlerManager.trigger('on_managers_loaded')

        # Reloadable managers
        self.reloadable = {
                'filters': self.filters,
                }

        # Commitable managers
        self.commitable = {
                'commands': self.commands,
                'filters': self.filters,
                'banphrases': self.banphrase_manager,
                }

        self.execute_every(10 * 60, self.commit_all)
        self.execute_every(1, self.do_tick)

        try:
            self.admin = self.config['main']['admin']
        except KeyError:
            log.warning('No admin user specified. See the [main] section in config.example.ini for its usage.')
        if self.admin:
            with self.users.get_user_context(self.admin) as user:
                user.level = 2000

        self.parse_version()

        relay_host = self.config['main'].get('relay_host', None)
        relay_password = self.config['main'].get('relay_password', None)
        if relay_host is None or relay_password is None:
            self.irc = MultiIRCManager(self)
        else:
            self.irc = SingleIRCManager(self)

        self.reactor.add_global_handler('all_events', self.irc._dispatcher, -10)

        twitch_client_id = None
        twitch_oauth = None
        if 'twitchapi' in self.config:
            twitch_client_id = self.config['twitchapi'].get('client_id', None)
            twitch_oauth = self.config['twitchapi'].get('oauth', None)

        # A client ID is required for the bot to work properly now, give an error for now
        if twitch_client_id is None:
            log.error('MISSING CLIENT ID, SET "client_id" VALUE UNDER [twitchapi] SECTION IN CONFIG FILE')

        self.twitchapi = TwitchAPI(twitch_client_id, twitch_oauth)

        self.data = {}
        self.data_cb = {}
        self.url_regex = re.compile(self.url_regex_str, re.IGNORECASE)

        self.data['broadcaster'] = self.streamer
        self.data['version'] = self.version
        self.data['version_brief'] = self.version_brief
        self.data['bot_name'] = self.nickname
        self.data_cb['status_length'] = self.c_status_length
        self.data_cb['stream_status'] = self.c_stream_status
        self.data_cb['bot_uptime'] = self.c_uptime
        self.data_cb['current_time'] = self.c_current_time

        self.silent = True if args.silent else self.silent

        if self.silent:
            log.info('Silent mode enabled')

        """
        For actions that need to access the main thread,
        we can use the mainthread_queue.
        """
        self.mainthread_queue = ActionQueue()
        self.execute_every(1, self.mainthread_queue.parse_action)

        self.websocket_manager = WebSocketManager(self)

        try:
            if self.config['twitchapi']['update_subscribers'] == '1':
                self.execute_every(30 * 60,
                                   self.action_queue.add,
                                   (self.update_subscribers_stage1, ))
        except:
            pass

        # XXX: TEMPORARY UGLY CODE
        HandlerManager.add_handler('on_user_gain_tokens', self.on_user_gain_tokens)
        HandlerManager.add_handler('send_whisper', self.whisper)
开发者ID:jardg,项目名称:pajbot,代码行数:104,代码来源:bot.py

示例8: enable

# 需要导入模块: from pajbot.managers.handler import HandlerManager [as 别名]
# 或者: from pajbot.managers.handler.HandlerManager import add_handler [as 别名]
 def enable(self, bot):
     self.bot = bot
     HandlerManager.add_handler('on_message', self.on_message)
开发者ID:Neclord9,项目名称:pajbot,代码行数:5,代码来源:emotesonscreen.py

示例9: start_quest

# 需要导入模块: from pajbot.managers.handler import HandlerManager [as 别名]
# 或者: from pajbot.managers.handler.HandlerManager import add_handler [as 别名]
    def start_quest(self):
        HandlerManager.add_handler('on_duel_complete', self.on_duel_complete)

        redis = RedisManager.get()

        self.load_progress(redis=redis)
开发者ID:Neclord9,项目名称:pajbot,代码行数:8,代码来源:winduels.py

示例10: enable

# 需要导入模块: from pajbot.managers.handler import HandlerManager [as 别名]
# 或者: from pajbot.managers.handler.HandlerManager import add_handler [as 别名]
 def enable(self, bot):
     HandlerManager.add_handler('on_message', self.on_message)
     HandlerManager.add_handler('on_usernotice', self.on_usernotice)
     self.bot = bot
开发者ID:smackedhs,项目名称:pajbot,代码行数:6,代码来源:subalert.py

示例11: enable

# 需要导入模块: from pajbot.managers.handler import HandlerManager [as 别名]
# 或者: from pajbot.managers.handler.HandlerManager import add_handler [as 别名]
    def enable(self, bot):
        self.bot = bot

        HandlerManager.add_handler('on_user_sub', self.on_user_sub)
        HandlerManager.add_handler('on_user_resub', self.on_user_resub)
        HandlerManager.add_handler('on_tick', self.on_tick)
开发者ID:jardg,项目名称:pajbot,代码行数:8,代码来源:roulette.py

示例12: enable

# 需要导入模块: from pajbot.managers.handler import HandlerManager [as 别名]
# 或者: from pajbot.managers.handler.HandlerManager import add_handler [as 别名]
 def enable(self, bot):
     HandlerManager.add_handler('on_message', self.on_message, priority=100)
     self.bot = bot
开发者ID:pajlada,项目名称:pajbot,代码行数:5,代码来源:maxmsglength.py

示例13: enable

# 需要导入模块: from pajbot.managers.handler import HandlerManager [as 别名]
# 或者: from pajbot.managers.handler.HandlerManager import add_handler [as 别名]
    def enable(self, bot):
        HandlerManager.add_handler('on_stream_start', self.on_stream_start)
        HandlerManager.add_handler('on_stream_stop', self.on_stream_stop)
        HandlerManager.add_handler('on_managers_loaded', self.on_managers_loaded)

        self.bot = bot
开发者ID:smackedhs,项目名称:pajbot,代码行数:8,代码来源:quest.py

示例14: start_quest

# 需要导入模块: from pajbot.managers.handler import HandlerManager [as 别名]
# 或者: from pajbot.managers.handler.HandlerManager import add_handler [as 别名]
    def start_quest(self):
        HandlerManager.add_handler('on_user_win_hs_bet', self.on_user_win_hs_bet)

        redis = RedisManager.get()

        self.load_progress(redis=redis)
开发者ID:Neclord9,项目名称:pajbot,代码行数:8,代码来源:winhsbetwins.py

示例15: enable

# 需要导入模块: from pajbot.managers.handler import HandlerManager [as 别名]
# 或者: from pajbot.managers.handler.HandlerManager import add_handler [as 别名]
 def enable(self, bot):
     HandlerManager.add_handler('on_paid_timeout', self.on_paid_timeout)
     self.bot = bot
开发者ID:Neclord9,项目名称:pajbot,代码行数:5,代码来源:paidtimeout.py


注:本文中的pajbot.managers.handler.HandlerManager.add_handler方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。