fix(makeprompt.py): add try-except block to handle errors when sending warning message if guild_data["images_limit_reached"] is True

This commit is contained in:
Paillat
2023-05-05 16:20:30 +02:00
parent 6effbe80ad
commit 024bfde8a6

View File

@@ -496,12 +496,15 @@ async def gpt_prompt(bot, messages, message, data_dict, prompt, guild_data):
await message.channel.trigger_typing() await message.channel.trigger_typing()
response = response.choices[0].message.content response = response.choices[0].message.content
if guild_data["images_limit_reached"]: try:
hist = await historicator(message) if guild_data["images_limit_reached"]:
await hist.send( hist = await historicator(message)
f"```diff\n-Warning: You have reached the image limit for this server. You can upgrade to premium to get more images recognized. More info in our server: https://discord.gg/sxjHtmqrbf```", await hist.send(
delete_after=10, f"```diff\n-Warning: You have reached the image limit for this server. You can upgrade to premium to get more images recognized. More info in our server: https://discord.gg/sxjHtmqrbf```",
) delete_after=10,
)
except:
pass
return response return response