Commit 5451f299 authored by Imran Hussain's avatar Imran Hussain
Browse files

Add the concept of dev only commands for testing and staff commands for staff...

parent 4ace6e2d
Pipeline #653 passed with stages
in 1 minute and 16 seconds
......@@ -5,6 +5,7 @@ module.exports = {
usage: '<user>',
cooldown: 10,
guildOnly: true,
staffOnly: true,
execute(message) {
const member = message.mentions.members.first();
......
......@@ -2,6 +2,8 @@ module.exports = {
name: 'ping',
description: 'Ping!',
cooldown: 5,
devOnly: false,
staffOnly: false,
execute(message) {
message.reply('Pong.');
},
......
......@@ -3,6 +3,7 @@ module.exports = {
description: 'Prune up to 99 messages.',
args: true,
usage: '<integer between 0 and 100>',
devOnly: true,
execute(message, args) {
const amount = parseInt(args[0]) + 1;
......
......@@ -4,6 +4,10 @@ const fs = require('fs');
const client = new Discord.Client();
client.commands = new Discord.Collection();
if (process.env.DEV_MODE === 'true') {
console.log('DEV_MODE set, enabling dev commands...');
}
// main event handler, look in a folder clled "events" and when one comes in
// that matches use that file
fs.readdir('./events/', (err, files) => {
......@@ -19,7 +23,11 @@ const commandFiles = fs.readdirSync('./commands')
for (const file of commandFiles) {
const command = require(`./commands/${file}`);
client.commands.set(command.name, command);
if ( command.devOnly && process.env.DEV_MODE !== 'true') {
console.log('Not loading command ' + command.name + ' as it\'s marked as dev but we are not in DEV_MODE');
} else {
client.commands.set(command.name, command);
}
}
/* global process */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment