Guest User

Untitled

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