Advertisement
Guest User

Untitled

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