From d1fc9ab952e78af4cc4026e8feecdc62489cfcfe Mon Sep 17 00:00:00 2001 From: Guillermo Rodriguez Date: Mon, 16 Jan 2023 00:42:48 -0300 Subject: [PATCH] Change img2img msg handler on telegram frontend --- skynet/frontend/telegram.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/skynet/frontend/telegram.py b/skynet/frontend/telegram.py index 15cdcec..ff30cc8 100644 --- a/skynet/frontend/telegram.py +++ b/skynet/frontend/telegram.py @@ -125,12 +125,15 @@ async def run_skynet_telegram( await bot.reply_to(message, resp_txt) - @bot.message_handler(commands=['img2img'], content_types=['photo']) + @bot.message_handler(func=lambda message: True, content_types=['photo']) async def send_img2img(message): chat = message.chat if chat.type != 'group' and chat.id != GROUP_ID: return + if not message.caption.startswith('/img2img'): + return + prompt = ' '.join(message.caption.split(' ')[1:]) if len(prompt) == 0: