diff --git a/commands/levels.js b/commands/levels.js deleted file mode 100644 index ce6ad43..0000000 --- a/commands/levels.js +++ /dev/null @@ -1,33 +0,0 @@ -const Revolt = require('revolt.js'); -const { client, logger, config } = require('..'); -const { levels, levelups } = require('../util/levels'); - -module.exports.meta = { - name: 'levels', - aliases: [], - description: 'Enable or disable XP.' -} - -/** - * - * @param { Revolt.Message } message - * @param { string[] } args - */ -module.exports.run = async (message, args) => new Promise(async (resolve, reject) => { - return client.channels.sendMessage(message.channel, 'It is currently not possible to disable leveling.'); // to-do: make it possible - switch(args[0]?.toLowerCase()) { - case 'on': - case 'enable': - case 'undie': - - break; - case 'off': - case 'disable': - case 'die': - case 'stfu': - - break; - default: - client.channels.sendMessage(message.channel, 'Valid options: `enable`, `disable`'); - } -}); \ No newline at end of file diff --git a/commands/rank.js b/commands/rank.js index 81aeeb5..011a22d 100644 --- a/commands/rank.js +++ b/commands/rank.js @@ -26,7 +26,8 @@ module.exports.run = async (message, args) => new Promise(async (resolve, reject `${target ? `${target.username} doesn't` : `You don't`} have any XP yet. Check back later!`); const response = `${target ? `${target.username} is` : 'You are'} level **${level}** with **${xp}** XP. ` - + `XP required for level up: **${levelups.find(l => l > xp) - xp}**.`; + + `XP required for level up: **${levelups.find(l => l > xp) - xp}**.\n` + + (process.env.DISABLE_LEVELS ? '**Warning:** You can\'t currently gain XP on this instance.' : ''); client.channels.sendMessage(message.channel, response) .catch(console.warn); diff --git a/util/levels.js b/util/levels.js index 8552e5e..b0dfeeb 100644 --- a/util/levels.js +++ b/util/levels.js @@ -4,7 +4,11 @@ const { client, logger, config, db } = require('..'); const levels = new Enmap({ name: "levels" }); let cooldowns = {} +if (process.env.DISABLE_LEVELS) logger.info('DISABLE_LEVELS is set, users won\'t be able to gain XP.'); + client.on('message', async message => { + if (process.env.DISABLE_LEVELS) return; + if (message.author === client.user._id) return; try { if (db.blacklist.get(message.author)?.blacklisted) return;