Exemple #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)
Exemple #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}
 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}
Exemple #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)
Exemple #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)
Exemple #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
 def __init__(self, hass, allowed_chat_ids, trusted_networks):
     """Initialize the class."""
     BaseTelegramBotEntity.__init__(self, hass, allowed_chat_ids)
     self.trusted_networks = trusted_networks