discord_bot/util/custom_commands/getOwnerOfCustomCommand.js
SileNce5k 4d46428862
All checks were successful
CI / CI (push) Successful in 21s
Lint Codebase / eslint (push) Successful in 15s
Use SQL on owner custom command subcommand
2024-12-19 19:52:02 +01:00

20 lines
No EOL
558 B
JavaScript

const sqlite3 = require('sqlite3').verbose();
module.exports = async function(customName){
const db = new sqlite3.Database("data/database.db");
let author;
let command = await new Promise((resolve, reject)=>{
db.get("SELECT * FROM customCommands WHERE customName = ? AND isDeleted = 0", [customName], function(error){
if(error){
console.error(error)
author = "Error when getting the owner of this custom command. Check console.";
reject(author)
}else {
author = command.author;
resolve(author)
}
})
})
return author;
}