Handle empty API responses gracefully
This commit is contained in:
@@ -110,6 +110,10 @@ class Assistant(commands.Cog):
|
|||||||
await message.reply("No response from the assistant.")
|
await message.reply("No response from the assistant.")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if not reply.strip():
|
||||||
|
await message.reply("*(The assistant returned an empty response.)*")
|
||||||
|
return
|
||||||
|
|
||||||
if len(reply) <= 2000:
|
if len(reply) <= 2000:
|
||||||
await message.reply(reply)
|
await message.reply(reply)
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user