fix not queued rcp uploads

This commit is contained in:
bakatrouble 2019-11-24 19:42:28 +03:00
parent bb3da27f9a
commit 79a512784f

View File

@ -49,12 +49,12 @@ class ChannelHelperBotModuleConfig(TelegramBotModuleConfig):
with tempfile.TemporaryDirectory() as d: with tempfile.TemporaryDirectory() as d:
fpath = os.path.join(d, '{}.jpg'.format(uuid4())) fpath = os.path.join(d, '{}.jpg'.format(uuid4()))
im.save(fpath) im.save(fpath)
m = bot.send_photo(config.tmp_uploads_chat_id, open(fpath, 'rb')) if self.queued:
i = QueuedItem(config=self, type='photo', args=json.dumps([m.photo[-1].file_id])) m = bot.send_photo(config.tmp_uploads_chat_id, open(fpath, 'rb'))
if self.queued: i = QueuedItem(config=self, type='photo', args=json.dumps([m.photo[-1].file_id]))
i.save() i.save()
else: else:
i.send(bot) bot.send_photo(self.chat_id, open(fpath, 'rb'))
return True return True
def periodic_task(self, bot: Bot): def periodic_task(self, bot: Bot):