bot.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:MusicBot 作者: BjoernPetersen 项目源码 文件源码
def _register_commands(self, _dispatcher, plugins):
        # keyboard answer handlers
        _dispatcher.add_handler(MessageHandler(Filters.text, self.handle_message))
        _dispatcher.add_handler(CallbackQueryHandler(self.handle_callback_query))

        # public commands
        _dispatcher.add_handler(CommandHandler('start', self.start_command))
        _dispatcher.add_handler(CommandHandler('showqueue', self.show_queue_command))
        _dispatcher.add_handler(CommandHandler('currentsong', self.current_song_command))
        _dispatcher.add_handler(CommandHandler('cancel', self.cancel_command))
        _dispatcher.add_handler(CommandHandler('login', self.login_command))

        _dispatcher.add_handler(CommandHandler('subscribe', self.subscribe))
        _dispatcher.add_handler(CommandHandler('unsubscribe', self.unsubscribe))

        # gmusic_password protected commands
        _dispatcher.add_handler(CommandHandler('next', self.next_command))
        _dispatcher.add_handler(CommandHandler('play', self.play_command))
        _dispatcher.add_handler(CommandHandler('pause', self.pause_command))
        _dispatcher.add_handler(CommandHandler('skip', self.skip_command))
        _dispatcher.add_handler(CommandHandler('movesong', self.move_song_command))

        # admin commands
        _dispatcher.add_handler(CommandHandler('admin', self.admin_command))
        _dispatcher.add_handler(CommandHandler('clearqueue', self.clear_queue_command))
        _dispatcher.add_handler(CommandHandler('reset', self.reset_command))
        _dispatcher.add_handler(CommandHandler('exit', self.exit_command))
        _dispatcher.add_handler(CommandHandler('ip', self.ip_command))
        _dispatcher.add_handler(CommandHandler('togglepassword', self.toggle_password_command))
        _dispatcher.add_handler(CommandHandler('setpassword', self.set_password_command))
        _dispatcher.add_handler(CommandHandler('banuser', self.ban_user_command))
        _dispatcher.add_handler(CommandHandler('setquality', self.set_quality_command))
        _dispatcher.add_handler(CommandHandler('stationremove', self.station_remove_command))
        _dispatcher.add_handler(CommandHandler('stationreload', self.station_reload_command))

        for plugin in plugins:
            _dispatcher.add_handler(
                CommandHandler(plugin.get_label(), lambda bot, update: plugin.run_command(self, bot, update)))

        _dispatcher.add_handler(InlineQueryHandler(self.get_inline_query_handler()))
        _dispatcher.add_handler(ChosenInlineResultHandler(self.queue_command))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号