obama-bot/commands/setcoins.js

33 lines
940 B
JavaScript

const Discord = require('discord.js');
module.exports.meta = {
name: 'setcoins',
aliases: ['setcoin'],
staffOnly: true
}
const karma = require('../util/karma').karma;
const coins = require('../util/karma').coins;
/**
*
* @param {Discord.Message} message
* @param {Array<string>} args
*/
module.exports.run = async (message, args) => {
let member = message.mentions.members.first();
if (!member) return message.channel.send('You need to @mention a member!')
if (!coins.get(member.id)) coins.set(member.id, 0);
let old = coins.get(member.id);
if (isNaN(args[1])) return message.channel.send('Invalid number');
coins.set(member.id, Number(args[1]));
message.channel.send(
new Discord.MessageEmbed()
.setTitle('Coins updated')
.setDescription(`Coins for \`${member.user.tag}\` set to \`${coins.get(member.id)}\` (old: \`${old}\`)`)
.setColor('ddbd37')
)
}