Discord Bot coding help - Newbie be nice :)


I have a discord bot which I really need help implementing a role into a specific command to allow only administrators to access the command.

var db = require(’…/db_helper’);
const db_checker = require(’…/db_checker’);

module.exports = async (msg) => {
var existing = db_checker(msg);
existing.then(async function(result) {
if (result) {
var sql = ‘TRUNCATE TABLE kills_’ + msg.guild.id;
db.query(sql, async function(err) {
if (err) throw err;
var sql = ‘TRUNCATE TABLE players_’ + msg.guild.id;
db.query(sql, async function(err) {
if (err) throw err;
await msg.channel.send(‘Your team kill data has been reset’);
} else {
await msg.channel.send(‘Goose TK Bot has not been set up on this server. Run !tkstart to do so.’);

This command will reset my stats, but currently its available to all users to run this command. I need to lock it off to certain roles. Could anyone please point me in the right direction? Sorry if this has been answered before or not in correct place.

Good morning,

This program is written in Node.js, so it’s a bit out of the scope of the Python Discourse forum. I’m sure that someone else will be able to help you here.