Handle no results
This commit is contained in:
parent
018846b0c4
commit
207f3ee8ab
|
@ -121,9 +121,13 @@ async def saucenao(client, message):
|
||||||
text += atext
|
text += atext
|
||||||
elif low_similarity:
|
elif low_similarity:
|
||||||
break
|
break
|
||||||
|
if not text:
|
||||||
|
text = caption = 'No results found'
|
||||||
try:
|
try:
|
||||||
if to_thumbnail and not to_image:
|
if to_thumbnail and not to_image:
|
||||||
await download_file(to_thumbnail, filename)
|
await download_file(to_thumbnail, filename)
|
||||||
|
elif not to_image:
|
||||||
|
raise Exception()
|
||||||
ext = await get_file_ext(filename)
|
ext = await get_file_ext(filename)
|
||||||
os.rename(filename, filename + ext)
|
os.rename(filename, filename + ext)
|
||||||
await message.reply_photo(filename + ext, caption=caption)
|
await message.reply_photo(filename + ext, caption=caption)
|
||||||
|
|
Loading…
Reference in New Issue