add note for temporary uploads
This commit is contained in:
parent
9ecd8810ce
commit
6d74a7fffe
@ -34,7 +34,7 @@ class ChannelHelperBotModuleConfig(TelegramBotModuleConfig):
|
|||||||
self.rpc_dispatcher = RPCDispatcher()
|
self.rpc_dispatcher = RPCDispatcher()
|
||||||
self.rpc_dispatcher['post_photo'] = self.rpc_post_photo
|
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()
|
config._reload_maybe()
|
||||||
bot = self.bot.get_bot()
|
bot = self.bot.get_bot()
|
||||||
try:
|
try:
|
||||||
@ -60,7 +60,7 @@ class ChannelHelperBotModuleConfig(TelegramBotModuleConfig):
|
|||||||
fpath = os.path.join(d, '{}.jpg'.format(uuid4()))
|
fpath = os.path.join(d, '{}.jpg'.format(uuid4()))
|
||||||
im.save(fpath)
|
im.save(fpath)
|
||||||
if self.queued:
|
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)
|
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:
|
else:
|
||||||
bot.send_photo(self.chat_id, open(fpath, 'rb'))
|
bot.send_photo(self.chat_id, open(fpath, 'rb'))
|
||||||
|
Loading…
Reference in New Issue
Block a user