Specify if the timer doesn't belong to author
This commit is contained in:
parent
13e611c860
commit
6e8faadd97
1 changed files with 5 additions and 2 deletions
|
@ -4,14 +4,17 @@ module.exports = async function (authorID, timerID) {
|
|||
const db = new sqlite3.Database(databasePath);
|
||||
let sendText = "";
|
||||
await new Promise((resolve, reject) => {
|
||||
db.get(`SELECT * FROM timers WHERE ID = ? AND user = ?`, [timerID, authorID],
|
||||
db.get(`SELECT * FROM timers WHERE ID = ?`, [timerID],
|
||||
function (error, timer){
|
||||
if(error){
|
||||
sendText = "An error occured while trying to read timer from database. Check console.";
|
||||
console.error("Error while trying to read timer from database: ", error)
|
||||
reject(error);
|
||||
}else{
|
||||
if(timer === undefined){
|
||||
if(authorID !== timer.user){
|
||||
sendText = "This timer does not belong to you."
|
||||
}
|
||||
else if(timer === undefined){
|
||||
sendText = "Timer not found";
|
||||
}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}`;
|
||||
|
|
Loading…
Add table
Reference in a new issue