forked from Lea/obama-bot
38 lines
1.2 KiB
JavaScript
38 lines
1.2 KiB
JavaScript
const Discord = require('discord.js');
|
|
|
|
module.exports.meta = {
|
|
name: 'karma',
|
|
aliases: ['coins'],
|
|
staffOnly: false
|
|
}
|
|
|
|
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) => {
|
|
const karmaID = '733339045463064607';
|
|
const coinsID = '733339908273602662';
|
|
|
|
const karmaEmote = message.guild.emojis.cache.get(karmaID).toString();
|
|
const coinsEmote = message.guild.emojis.cache.get(coinsID).toString();
|
|
|
|
let targetID = message.mentions.members.first() || message.author;
|
|
targetID = targetID.id;
|
|
|
|
let karmaembed = new Discord.MessageEmbed()
|
|
.setTitle(message.mentions.members.first() ? 'Balance of ' + message.mentions.members.first().user.username : 'Your balance')
|
|
.setDescription(`${karmaEmote} Karma: \`${karma.get(targetID) || '0'}\`\n${coinsEmote} Coins: \`${coins.get(targetID) || '0'}\``);
|
|
|
|
let kCount = karma.get(targetID);
|
|
if (kCount) {
|
|
if (kCount > 0) karmaembed.setColor('f36916');
|
|
if (kCount < 0) karmaembed.setColor('9494ff');
|
|
}
|
|
|
|
message.channel.send(karmaembed);
|
|
} |