Adding error checking for stat message removal
This commit is contained in:
parent
1f3ff44317
commit
a5d2530456
16
llamabot.js
16
llamabot.js
@ -504,11 +504,17 @@ async function generateResponse(conversation, message) {
|
||||
|
||||
// clear the interval, replace the "please wait" message with the response, and update the message
|
||||
console.log(responseText);
|
||||
try {
|
||||
if (time > 2) {
|
||||
await botMessage.delete()
|
||||
clearInterval(refreshInterval);
|
||||
botMessage = null;
|
||||
}
|
||||
await botMessage.delete();
|
||||
clearInterval(refreshInterval);
|
||||
botMessage = null;
|
||||
console.log("Time limit reached. Message deleted.");
|
||||
}
|
||||
} catch (err) {
|
||||
console.log("Error deleting message: ", err);
|
||||
}
|
||||
|
||||
|
||||
return responseText;
|
||||
|
||||
@ -521,4 +527,4 @@ async function generateResponse(conversation, message) {
|
||||
}
|
||||
}
|
||||
|
||||
client.login(process.env.THE_TOKEN); // Replace with your bot token
|
||||
client.login(process.env.THE_TOKEN); // Replace with your bot token
|
||||
|
Loading…
Reference in New Issue
Block a user