daily pastebin goal
3%
SHARE
TWEET

Untitled

a guest Apr 16th, 2018 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // XP SYSTEM
  2. let xpAdd = Math.floor(Math.random() * 7) + 8;
  3.   console.log(xpAdd);
  4.  
  5.   if(!xp[message.author.id]){
  6.     xp[message.author.id] = {
  7.       xp: 0,
  8.       level: 1
  9.     };
  10.   }
  11.  
  12.  
  13.   let curxp = xp[message.author.id].xp;
  14.   let curlvl = xp[message.author.id].level;
  15.   let nxtLvl = xp[message.author.id].level * 300;
  16.   xp[message.author.id].xp =  curxp + xpAdd;
  17.   if(nxtLvl <= xp[message.author.id].xp){
  18.     xp[message.author.id].level = curlvl + 1;
  19.     let lvlup = new Discord.RichEmbed()
  20.     .setTitle("Level Up!")
  21.     .setColor("#42f445")
  22.     .addField("New Level", curlvl + 1);
  23.  
  24.     message.channel.send(lvlup).then(msg => {msg.delete(5000)});
  25.   }
  26.   fs.writeFile("./xp.json", JSON.stringify(xp), (err) => {
  27.     if(err) console.log(err)
  28. });
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