gaming
This commit is contained in:
parent
32ef944a50
commit
93f34d1681
|
@ -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`');
|
|
||||||
}
|
|
||||||
});
|
|
|
@ -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!`);
|
`${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. `
|
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)
|
client.channels.sendMessage(message.channel, response)
|
||||||
.catch(console.warn);
|
.catch(console.warn);
|
||||||
|
|
|
@ -4,7 +4,11 @@ const { client, logger, config, db } = require('..');
|
||||||
const levels = new Enmap({ name: "levels" });
|
const levels = new Enmap({ name: "levels" });
|
||||||
let cooldowns = {}
|
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 => {
|
client.on('message', async message => {
|
||||||
|
if (process.env.DISABLE_LEVELS) return;
|
||||||
|
|
||||||
if (message.author === client.user._id) return;
|
if (message.author === client.user._id) return;
|
||||||
try {
|
try {
|
||||||
if (db.blacklist.get(message.author)?.blacklisted) return;
|
if (db.blacklist.get(message.author)?.blacklisted) return;
|
||||||
|
|
Loading…
Reference in a new issue