예제 #1
0
    def __init__(self, updater, devnullChatId=-1):

        self._updater = updater
        self._resourceManager = ResourceManager()
        self._userOptionsManager = UserOptionsManager()
        self._usersManager = UsersManager()
        self._preambleManager = PreambleManager(self._resourceManager)
        self._latexConverter = LatexConverter(self._preambleManager, self._userOptionsManager)
        self._inlineQueryResponseDispatcher = InlineQueryResponseDispatcher(updater.bot, self._latexConverter, self._resourceManager, self._userOptionsManager, devnullChatId)
        self._messageQueryResponseDispatcher = MessageQueryResponseDispatcher(updater.bot, self._latexConverter, self._resourceManager)
        self._devnullChatId = devnullChatId
        self._messageFilters = []

        self._updater.dispatcher.add_handler(CommandHandler('start', self.onStart))
        self._updater.dispatcher.add_handler(CommandHandler('abort', self.onAbort))
        self._updater.dispatcher.add_handler(CommandHandler("help", self.onHelp))
        self._updater.dispatcher.add_handler(CommandHandler('setcustompreamble', self.onSetCustomPreamble))
        self._updater.dispatcher.add_handler(CommandHandler('getmypreamble', self.onGetMyPreamble))
        self._updater.dispatcher.add_handler(CommandHandler('getdefaultpreamble', self.onGetDefaultPreamble))
        self._updater.dispatcher.add_handler(CommandHandler('setcodeincaptionon', self.onSetCodeInCaptionOn))
        self._updater.dispatcher.add_handler(CommandHandler('setcodeincaptionoff', self.onSetCodeInCaptionOff))
        self._updater.dispatcher.add_handler(CommandHandler("setdpi", self.onSetDpi))
        self._updater.dispatcher.add_handler(MessageHandler(Filters.text, self.dispatchTextMessage), 1)
        
        self._messageFilters.append(self.filterPreamble)
        self._messageFilters.append(self.filterExpression)
        
        inline_handler = InlineQueryHandler(self.onInlineQuery)
        self._updater.dispatcher.add_handler(inline_handler)
        
        self._usersRequestedCustomPreambleRegistration = set()
예제 #2
0
 def setUp(self):
     self.latexConverter = Mock()
     self.bot = Mock()
     self.sut = MessageQueryResponseDispatcher(self.bot,
                                               self.latexConverter,
                                               ResourceManager())