SHARE
TWEET

Untitled

a guest Aug 20th, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const fs = require('fs');
  2. const exp = require("./exp.json")
  3. let cooldown = new Set();
  4. let cdseconds = 3;
  5. const active = new Map()
  6. const ownerID = "560392655939436555"
  7.  
  8. module.exports = (client, message) => {
  9.     if (message.author.bot) return;
  10.  
  11.     let i = message.author.id;
  12.     let addExp = Math.floor(Math.random() * 5) + 1;
  13.     if (addExp[i].id == client.user.id){
  14.       addExp[i].slice(i, 1)
  15.     }
  16.     if(!exp[message.author.id]) {
  17.       exp[message.author.id] = {
  18.       exp: 0,
  19.       niveau: 1
  20.  
  21.       };
  22.     }
  23.  
  24.     let currentExp = exp[message.author.id].exp;
  25.     let currentNiv = exp[message.author.id].niveau;
  26.     let nextLevel = currentNiv * 100;
  27.     exp[message.author.id].exp = currentExp + addExp;
  28.  
  29.     if(nextLevel <= currentExp) {
  30.       exp[message.author.id].niveau += 1;
  31.       message.reply(`**Bravo, tu est passé niveau ${currentNiv + 1} !**`)
  32.     }
  33.     fs.writeFile('./exp.json', JSON.stringify(exp), err => {
  34.       if (err) console.log(err);
  35.     });
  36.     let prefixes = JSON.parse(fs.readFileSync("./prefixes.json", "utf8"));
  37.  
  38.     if (!prefixes[message.guild.id]) {
  39.       prefixes[message.guild.id] = {
  40.         prefixes: config.prefix
  41.       }
  42.     }
  43.     let prefix = prefixes[message.guild.id].prefixes
  44.     if(!message.content.startsWith(prefix)) return;
  45.     if(cooldown.has(message.author.id)) {
  46.       message.delete()
  47.       return message.reply("**Vous devez attendre 3 seconde pour utilisé une commande !**")
  48.     }
  49.     //if(!message.member.hasPermission("ADMINISTRATOR")) {
  50.       cooldown.add(message.author.id);
  51.    // }
  52.    let ops = {
  53.      ownerID: ownerID,
  54.      active: active
  55.    }
  56.       setTimeout(() => {
  57.         cooldown.delete(message.author.id)
  58.       }, cdseconds * 3000)
  59.  
  60.       if(!cmd) return;
  61.       cmd.run(client, message,  ops, args);
  62. };
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top