From 62b76735d110d0b57f02f53e5a636050668c60a3 Mon Sep 17 00:00:00 2001 From: bakatrouble Date: Fri, 25 Jul 2025 14:21:12 +0300 Subject: [PATCH] add get_hashes rpc endpoint --- bots/modules/channel_helper.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bots/modules/channel_helper.py b/bots/modules/channel_helper.py index 1d5f549..ce8e394 100644 --- a/bots/modules/channel_helper.py +++ b/bots/modules/channel_helper.py @@ -39,6 +39,7 @@ class ChannelHelperBotModuleConfig(TelegramBotModuleConfig): self.rpc_dispatcher = RPCDispatcher() self.rpc_dispatcher['post_photo'] = self.rpc_post_photo self.rpc_dispatcher['post_gif'] = self.rpc_post_gif + self.rpc_dispatcher['get_hashes'] = self.rpc_get_hashes def rpc_post_photo(self, photo, is_base64=False, note=''): config._reload_maybe() @@ -97,6 +98,12 @@ class ChannelHelperBotModuleConfig(TelegramBotModuleConfig): upload_animation_rpc.delay(qi.pk, fpath_output, note or None) return True + def rpc_get_hashes(self): + config._reload_maybe() + return (self.queued_items.filter(type='photo', processed=False) + .exclude(image_hash__isnull=True) + .values_list('image_hash', flat=True)) + def periodic_task(self, bot: Bot): i = self.queued_items.filter(processed=False).order_by('?').first() # type: QueuedItem