Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const Discord = require('discord.js')
- const db = require('../util/db.js')
- let gems = '💎';
- let cash = '<:cash:577826085157208064>';
- let digging = '<:shove_dig:578754542309605417>';
- let cooldown = '<:cooldown:579496045059375104>';
- let denied = '<:denied:578904707691577345>';
- module.exports.run = (client, msg, args, db, settings, util, lang) => {
- let sIcon = msg.guild.iconURL;
- let rAmount = Math.floor(Math.random() * 15);
- var responses = [
- 'fail',
- 'success'
- ]
- let answer = responses[Math.floor(Math.random() * responses.length)];
- db.dig(msg.author.id).then(dig => {
- db.MongoFind("users", { id: msg.author.id }).then(info => {
- let time = new Date().getTime()
- var userEco = info[0].economy;
- if (dig == true && answer == 'success') {
- db.MongoUpdate("users", { id: msg.author.id }, { 'economy.balance': userEco.gems + rAmount });
- db.lastSeen(msg.author.id, 'hourly')
- let dailyembed = new Discord.RichEmbed()
- .setAuthor(`${msg.author.tag}`, msg.author.displayAvatarURL)
- .setDescription(`${digging}| <@${msg.author.id}>, you have found \`${rAmount}\` ${gems} in a dusty mine shaft! \n :white_small_square: Your new balance is: \`${userEco.gems + rAmount}\` ${gems}`)
- .setTimestamp()
- .setColor("#36393f")
- .setFooter(msg.author.id, sIcon)
- return msg.channel.send(dailyembed);
- }
- else if (dig == true && answer == 'fail') {
- db.lastSeen(msg.author.id, 'hourly')
- let failembed = new Discord.RichEmbed()
- .setAuthor(`${msg.author.tag}`, msg.author.displayAvatarURL)
- .setDescription(`${digging}| <@${msg.author.id}>, you didn't find any ${gems}, instead you found a lump of coal.`)
- .setTimestamp()
- .setColor("#36393f")
- .setFooter(msg.author.id, sIcon)
- return msg.channel.send(failembed);
- } else {
- let claimed = new Discord.RichEmbed()
- .setAuthor(`${msg.author.tag}`, msg.author.displayAvatarURL)
- .setDescription(`${cooldown}| <@${msg.author.id}>, wait **\`${60 - parseInt(dig)}\`** minute(s) before running this command again!`)
- .setTimestamp()
- .setColor("#36393f")
- .setFooter(msg.author.id, sIcon)
- return msg.channel.send(claimed);
- }
- });
- });
- }
- module.exports.help = {
- name: "dig"
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement