From 207f3ee8ab81bf850fb34380ba02a43625f3a654 Mon Sep 17 00:00:00 2001 From: blank X Date: Fri, 25 Dec 2020 08:43:52 +0700 Subject: [PATCH] Handle no results --- sukuinote/plugins/saucenao.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sukuinote/plugins/saucenao.py b/sukuinote/plugins/saucenao.py index ea1e32d..021ac3a 100644 --- a/sukuinote/plugins/saucenao.py +++ b/sukuinote/plugins/saucenao.py @@ -121,9 +121,13 @@ async def saucenao(client, message): text += atext elif low_similarity: break + if not text: + text = caption = 'No results found' try: if to_thumbnail and not to_image: await download_file(to_thumbnail, filename) + elif not to_image: + raise Exception() ext = await get_file_ext(filename) os.rename(filename, filename + ext) await message.reply_photo(filename + ext, caption=caption)