Python telegram.ext.InlineQueryHandler() Examples
The following are 2
code examples of telegram.ext.InlineQueryHandler().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
telegram.ext
, or try the search function
.
Example #1
Source File: inlinequeries.py From rules-bot with GNU Affero General Public License v3.0 | 5 votes |
def register(dispatcher): dispatcher.add_handler(InlineQueryHandler(inline_query))
Example #2
Source File: telegrambot.py From OpenCryptoBot with GNU Affero General Public License v3.0 | 4 votes |
def __init__(self, bot_token, bot_db): self.db = bot_db self.token = bot_token read_timeout = Cfg.get("telegram", "read_timeout") connect_timeout = Cfg.get("telegram", "connect_timeout") kwargs = dict() if read_timeout: kwargs["read_timeout"] = read_timeout if connect_timeout: kwargs["connect_timeout"] = connect_timeout try: self.updater = Updater(bot_token, request_kwargs=kwargs) except InvalidToken as e: cls_name = f"Class: {type(self).__name__}" logging.error(f"{repr(e)} - {cls_name}") exit("ERROR: Bot token not valid") self.job_queue = self.updater.job_queue self.dispatcher = self.updater.dispatcher # Load classes in folder 'plugins' self._load_plugins() # Handler for files downloads (plugins) mh = MessageHandler(Filters.document, self._download) self.dispatcher.add_handler(mh) # Handler for command-links self._add_link_handler() # Handler for inline-mode inline_handler = InlineQueryHandler(self._inline) self.dispatcher.add_handler(inline_handler) # Handle all Telegram related errors self.dispatcher.add_error_handler(self._handle_tg_errors) # Refresh cache periodically self._refresh_cache() # Check for updates periodically self._update_check() # Start the bot