Add support for admin/owner only commands #3

This commit is contained in:
SileNce5k 2021-03-11 02:47:53 +01:00
parent 5713c2c6af
commit 0b5156721d
No known key found for this signature in database
GPG key ID: C507260E7F2583AD

View file

@ -5,7 +5,8 @@ const {
prefix, prefix,
token, token,
loginMessage, loginMessage,
loginChannel loginChannel,
owners
} = require('./config.json'); } = require('./config.json');
client.commands = new Discord.Collection(); client.commands = new Discord.Collection();
@ -38,7 +39,7 @@ client.on('message', async message => {
if (!message.guild) return; if (!message.guild) return;
if (message.author.bot) return; if (message.author.bot) return;
if (!message.content.startsWith(prefix)) return; if (!message.content.startsWith(prefix)) return;
if (command.admin && owners.indexOf(message.author.id.toString()) == -1 ) return;
try { try {
command.execute({message:message, args:args, client: client}) command.execute({message:message, args:args, client: client})
} catch (error) { } catch (error) {