obama-bot/commands/karma.js
2020-11-28 17:38:23 +01:00

33 lines
1.1 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;
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);
}