Adding error checking for stat message removal

This commit is contained in:
Raven Scott 2023-11-14 18:18:37 -05:00
parent 1f3ff44317
commit a5d2530456

View File

@ -504,11 +504,17 @@ async function generateResponse(conversation, message) {
// clear the interval, replace the "please wait" message with the response, and update the message // clear the interval, replace the "please wait" message with the response, and update the message
console.log(responseText); console.log(responseText);
try {
if (time > 2) { if (time > 2) {
await botMessage.delete() await botMessage.delete();
clearInterval(refreshInterval); clearInterval(refreshInterval);
botMessage = null; botMessage = null;
console.log("Time limit reached. Message deleted.");
} }
} catch (err) {
console.log("Error deleting message: ", err);
}
return responseText; return responseText;