From 79a512784f06ca8269ec3d4c243c8ec8fd49f0b6 Mon Sep 17 00:00:00 2001 From: bakatrouble Date: Sun, 24 Nov 2019 19:42:28 +0300 Subject: [PATCH] fix not queued rcp uploads --- bots/modules/channel_helper.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/bots/modules/channel_helper.py b/bots/modules/channel_helper.py index aee12d0..26e8e4a 100644 --- a/bots/modules/channel_helper.py +++ b/bots/modules/channel_helper.py @@ -49,12 +49,12 @@ class ChannelHelperBotModuleConfig(TelegramBotModuleConfig): with tempfile.TemporaryDirectory() as d: fpath = os.path.join(d, '{}.jpg'.format(uuid4())) im.save(fpath) - m = bot.send_photo(config.tmp_uploads_chat_id, open(fpath, 'rb')) - i = QueuedItem(config=self, type='photo', args=json.dumps([m.photo[-1].file_id])) - if self.queued: - i.save() - else: - i.send(bot) + if self.queued: + m = bot.send_photo(config.tmp_uploads_chat_id, open(fpath, 'rb')) + i = QueuedItem(config=self, type='photo', args=json.dumps([m.photo[-1].file_id])) + i.save() + else: + bot.send_photo(self.chat_id, open(fpath, 'rb')) return True def periodic_task(self, bot: Bot):