Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const fs = require("fs")
- const Discord = require('discord.js')
- let coins = require('../coins.json')
- const cooldownMembers = new Set();
- module.exports = (client, msg) => {
- msg.msgs = JSON.parse(fs.readFileSync("./counter.json", "utf8"));
- require("../functions/counter.js")(msg)
- if(msg.channel.type == 'dm') return;
- if(msg.author.bot) return
- if(!coins[msg.author.id]){
- coins[msg.author.id] = {
- coins: 0
- }
- }
- let coinAmt = Math.floor(Math.random() * 15) + 1;
- let baseAmt = Math.floor(Math.random() * 15) + 4;
- if(msg.member.roles.has('654527317451735042')){
- coinAmt = Math.floor(Math.random() * 10) + 1;
- baseAmt = Math.floor(Math.random() * 10) + 2;
- }
- if(msg.member.roles.has('654560912589586432')){
- coinAmt = Math.floor(Math.random() * 50) + 1;
- baseAmt = Math.floor(Math.random() * 50) + 5;
- }
- if(msg.content.startsWith('!') && msg.content.startsWith('-') && msg.content.startsWith('+')) {
- coinAmt = 'x'
- baseAmt = 'y'
- }
- console.log(` ${msg.author} teve ${coinAmt} e ${baseAmt} %`)
- if(coinAmt === baseAmt){
- coins[msg.author.id] = {
- coins: coins[msg.author.id].coins + coinAmt
- }
- fs.writeFile("./coins.json", JSON.stringify(coins), (err) => {
- if (err) console.log(err)
- })
- let uCoins = coins[msg.author.id].coins
- let coinembed = new Discord.RichEmbed()
- .setTitle(`${msg.author.tag} ganhou moedas!`)
- .setDescription('Parabéns ' + `${msg.author} você ganhou moedas!`)
- .addField('Moedas Ganhas <a:coin:654123490034581504>', `\`${coinAmt}\``)
- .setColor('#90ff6e')
- .setFooter(`Você possui agora ${uCoins} moedas`)
- .setThumbnail('https://cdn.discordapp.com/attachments/652330287836954655/654059303057227780/cartoon-earth-transparent-1.png')
- msg.channel.send(coinembed).then(x => { x.delete(7000)})
- }
- if(msg.content.indexOf(client.config.prefix) !== 0) return;
- const args = msg.content.slice(client.config.prefix.length).trim().split(/ +/g)
- const command = args.shift().toLowerCase()
- client.warns = JSON.parse(fs.readFileSync("./warnings.json", "utf8"));
- const cmd = client.commands.get(command) || client.commands.get(client.aliases.get(command))
- if(!msg.member.hasPermission('ADMINISTRATOR') && msg.channel.id !== '651617500957507592' && msg.channel.id !== '654162577479303181') return msg.reply('Você não tem permissão para mandar comandos aqui.')
- if(!cmd) return;
- if (cooldownMembers.has(msg.author.id)) return msg.reply('Você esta usando meus comandos de mais! Aguarde alguns segundos e tente novamente.');
- cmd.run(client, msg, args)
- if(!msg.member.hasPermission('ADMINISTRATOR') && !msg.member.roles.has('654527317451735042')) cooldownMembers.add(msg.author.id)
- setTimeout(() => {
- cooldownMembers.delete(msg.author.id)
- }, 6 * 1000);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement