change rpc return format
This commit is contained in:
parent
a9529f3e4c
commit
9a7c0637e2
@ -57,7 +57,10 @@ class ChannelHelperBotModuleConfig(TelegramBotModuleConfig):
|
|||||||
|
|
||||||
image_hash = imagehash.phash(im)
|
image_hash = imagehash.phash(im)
|
||||||
if self.queued_items.filter(image_hash=str(image_hash), type='photo').count() > 0:
|
if self.queued_items.filter(image_hash=str(image_hash), type='photo').count() > 0:
|
||||||
return 'duplicate'
|
return {
|
||||||
|
'status': 'duplicate',
|
||||||
|
'hash': str(image_hash),
|
||||||
|
}
|
||||||
|
|
||||||
width, height = im.size
|
width, height = im.size
|
||||||
if width > 2000 or height > 2000:
|
if width > 2000 or height > 2000:
|
||||||
@ -72,7 +75,10 @@ class ChannelHelperBotModuleConfig(TelegramBotModuleConfig):
|
|||||||
# else:
|
# else:
|
||||||
# bot.send_photo(self.chat_id, open(fpath, 'rb'))
|
# bot.send_photo(self.chat_id, open(fpath, 'rb'))
|
||||||
# QueuedItem.objects.create(config=self, type='photo', args=json.dumps([]), image_hash=image_hash, processed=True)
|
# QueuedItem.objects.create(config=self, type='photo', args=json.dumps([]), image_hash=image_hash, processed=True)
|
||||||
return str(image_hash)
|
return {
|
||||||
|
'status': 'ok',
|
||||||
|
'hash': str(image_hash),
|
||||||
|
}
|
||||||
|
|
||||||
def rpc_post_gif(self, url, note=''):
|
def rpc_post_gif(self, url, note=''):
|
||||||
config._reload_maybe()
|
config._reload_maybe()
|
||||||
|
Loading…
Reference in New Issue
Block a user