add note for temporary uploads

This commit is contained in:
bakatrouble 2023-04-19 00:50:27 +03:00
parent 9ecd8810ce
commit 6d74a7fffe

View File

@ -34,7 +34,7 @@ class ChannelHelperBotModuleConfig(TelegramBotModuleConfig):
self.rpc_dispatcher = RPCDispatcher()
self.rpc_dispatcher['post_photo'] = self.rpc_post_photo
def rpc_post_photo(self, photo, is_base64=False):
def rpc_post_photo(self, photo, is_base64=False, note=''):
config._reload_maybe()
bot = self.bot.get_bot()
try:
@ -60,7 +60,7 @@ class ChannelHelperBotModuleConfig(TelegramBotModuleConfig):
fpath = os.path.join(d, '{}.jpg'.format(uuid4()))
im.save(fpath)
if self.queued:
m = bot.send_photo(config.tmp_uploads_chat_id, open(fpath, 'rb'))
m = bot.send_photo(config.tmp_uploads_chat_id, open(fpath, 'rb'), caption=note or None)
QueuedItem.objects.create(config=self, type='photo', args=json.dumps([m.photo[-1].file_id]), message_id=m.message_id, image_hash=image_hash)
else:
bot.send_photo(self.chat_id, open(fpath, 'rb'))