예제 #1
0
    def __init__(self, bot, hass, allowed_chat_ids):
        """Initialize the polling instance."""
        BaseTelegramBotEntity.__init__(self, hass, allowed_chat_ids)

        # TODO: set con_pool_size=8 in initialize_bot()
        self.updater = Updater(bot=bot, workers=4)  # updater
        self.dispatcher = self.updater.dispatcher  # dispatcher

        self.dispatcher.add_handler(MessageHandler(self.process_update))
        self.dispatcher.add_error_handler(self.process_error)
예제 #2
0
 def __init__(self, bot, hass, allowed_chat_ids):
     """Initialize the polling instance."""
     BaseTelegramBotEntity.__init__(self, hass, allowed_chat_ids)
     self.update_id = 0
     self.websession = async_get_clientsession(hass)
     self.update_url = '{0}/getUpdates'.format(bot.base_url)
     self.polling_task = None  # The actuall polling task.
     self.timeout = 15  # async post timeout
     # polling timeout should always be less than async post timeout.
     self.post_data = {'timeout': self.timeout - 5}
예제 #3
0
 def __init__(self, bot, hass, allowed_chat_ids):
     """Initialize the polling instance."""
     BaseTelegramBotEntity.__init__(self, hass, allowed_chat_ids)
     self.update_id = 0
     self.websession = async_get_clientsession(hass)
     self.update_url = '{0}/getUpdates'.format(bot.base_url)
     self.polling_task = None  # The actual polling task.
     self.timeout = 15  # async post timeout
     # Polling timeout should always be less than async post timeout.
     self.post_data = {'timeout': self.timeout - 5}
예제 #4
0
    def __init__(self, bot, hass, allowed_chat_ids):
        """Initialize the polling instance."""
        from telegram.ext import Updater

        BaseTelegramBotEntity.__init__(self, hass, allowed_chat_ids)

        self.updater = Updater(bot=bot, workers=4)
        self.dispatcher = self.updater.dispatcher

        self.dispatcher.add_handler(message_handler(self.process_update))
        self.dispatcher.add_error_handler(process_error)
예제 #5
0
    def __init__(self, bot, hass, allowed_chat_ids):
        """Initialize the polling instance."""
        from telegram.ext import Updater

        BaseTelegramBotEntity.__init__(self, hass, allowed_chat_ids)

        self.updater = Updater(bot=bot, workers=4)
        self.dispatcher = self.updater.dispatcher

        self.dispatcher.add_handler(message_handler(self.process_update))
        self.dispatcher.add_error_handler(process_error)
예제 #6
0
 def __init__(self, hass, allowed_chat_ids, trusted_networks):
     """Initialize the class."""
     BaseTelegramBotEntity.__init__(self, hass, allowed_chat_ids)
     self.trusted_networks = trusted_networks
예제 #7
0
 def __init__(self, hass, allowed_chat_ids, trusted_networks):
     """Initialize the class."""
     BaseTelegramBotEntity.__init__(self, hass, allowed_chat_ids)
     self.trusted_networks = trusted_networks