def __init__(self, config, main_async_loop): super().__init__(config, main_async_loop) self.channel_config = { CONFIG_TELEGRAM_ALL_CHANNEL: False, CONFIG_TELEGRAM_CHANNEL: [] } # check presence of telegram instance if TelegramService.is_setup_correctly(self.config): self.service = self.config[CONFIG_CATEGORY_SERVICES][CONFIG_TELEGRAM][CONFIG_SERVICE_INSTANCE] self.is_setup_correctly = True else: if TelegramService.should_be_ready(config): self.logger.warning(self.REQUIRED_SERVICE_ERROR_MESSAGE) self.is_setup_correctly = False
def telegram_notification_available(self, key=None): if self.enabled( key ) and NotificationTypes.TELEGRAM.value in self.notification_type: if TelegramService.is_setup_correctly(self.config): return True return False
def update_channel_config(self, config): if not TelegramService.is_setup_correctly(self.config): raise DispatcherException(f"{self.get_name()} is not usable: {self.REQUIRED_SERVICE_ERROR_MESSAGE}. " "Evaluators using Telegram channels information can't work.") self.channel_config[CONFIG_TELEGRAM_CHANNEL].extend(channel for channel in config[CONFIG_TELEGRAM_CHANNEL] if channel not in self.channel_config[CONFIG_TELEGRAM_CHANNEL]) self._register_if_something_to_watch()
def telegram_notification_available(self, key=None): if self.enabled( key) and TelegramService.get_name() in self.notification_type: if TelegramService.is_setup_correctly(self.config): return True return False
def telegram_notification_available(self, key=None): return self.enabled(key) and \ self._service_instance_is_present(CONFIG_TELEGRAM) and \ self.config[CONFIG_CATEGORY_SERVICES][CONFIG_TELEGRAM][CONFIG_SERVICE_INSTANCE].get_type() \ in self.notification_type and \ TelegramService.is_setup_correctly(self.config)
def telegram_notification_available(self): if self.enable and NotificationTypes.TELEGRAM.value in self.notification_type: if TelegramService.is_setup_correctly(self.config): return True return False