From 86e1d3545ef85d616bbe51be5141337aa6277062 Mon Sep 17 00:00:00 2001 From: msramalho <19508417+msramalho@users.noreply.github.com> Date: Wed, 15 Jun 2022 17:17:46 +0200 Subject: [PATCH] fix for missing telethon config --- archivers/telethon_archiver.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/archivers/telethon_archiver.py b/archivers/telethon_archiver.py index 18996d8..bfc7f57 100644 --- a/archivers/telethon_archiver.py +++ b/archivers/telethon_archiver.py @@ -16,8 +16,9 @@ class TelethonArchiver(Archiver): def __init__(self, storage: Storage, driver, config: TelethonConfig): super().__init__(storage, driver) - self.client = TelegramClient("./anon", config.api_id, config.api_hash) - self.bot_token = config.bot_token + if config: + self.client = TelegramClient("./anon", config.api_id, config.api_hash) + self.bot_token = config.bot_token def _get_media_posts_in_group(self, chat, original_post, max_amp=10): """ @@ -38,6 +39,10 @@ class TelethonArchiver(Archiver): return media def download(self, url, check_if_exists=False): + if not hasattr(self, "client"): + logger.error('Missing Telethon config') + return False + # detect URLs that we definitely cannot handle matches = self.link_pattern.findall(url) if not len(matches):