Fix crash if timer doesn't exist

This commit is contained in:
SileNce5k 2024-04-10 13:53:21 +02:00
parent 6e8faadd97
commit 56e8f4765d
No known key found for this signature in database
GPG key ID: 961132EB78C8915F

View file

@ -11,11 +11,11 @@ module.exports = async function (authorID, timerID) {
console.error("Error while trying to read timer from database: ", error) console.error("Error while trying to read timer from database: ", error)
reject(error); reject(error);
}else{ }else{
if(authorID !== timer.user){ if(timer === undefined){
sendText = "This timer does not belong to you."
}
else if(timer === undefined){
sendText = "Timer not found"; sendText = "Timer not found";
}
else if(authorID !== timer.user){
sendText = "This timer does not belong to you."
}else{ }else{
sendText = `${timer.ID} will remind you <t:${timer.reminderTime.toFixed(0)}:R> (<t:${timer.reminderTime.toFixed(0)}:f>), with the message being:\n${timer.customMessage}`; sendText = `${timer.ID} will remind you <t:${timer.reminderTime.toFixed(0)}:R> (<t:${timer.reminderTime.toFixed(0)}:f>), with the message being:\n${timer.customMessage}`;
} }