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:
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):