coeragames

Untitled

Feb 19th, 2021
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. const fs = require('fs')
  2. module.exports = {
  3. name: 'warn',
  4. description: 'Pour warn un membre',
  5. }
  6.  
  7. module.exports.execute = async (message, args, Client) => {
  8.  
  9.  
  10. if(!message.member.hasPermission("BAN_MEMBERS")) return message.channel.send("Tu n'as pas les permissions de warn un membre");
  11. if(message.channel.type == "dm") return;
  12. let mention = message.mentions.members.first();
  13. const reason = args.slice(1).join(' ')
  14. if(!mention){
  15. message.reply("Membre non-menntionné ou mal mentionné");
  16. }
  17. else {
  18. if (!reason) return message.channel.send("Veuillez indiquer une raison")
  19. if (!Client.warn.warns[mention.id]) Client.warn.warns[mention.id] = []
  20. Client.warn.warns[mention.id].unshift({
  21. reason,
  22. date: Date.now(),
  23. mod: message.author.id
  24. })
  25. fs.writeFileSync('./commands/bdd/warns.json', JSON.stringify(Client.warn))
  26. message.channel.send(`${mention} a été warn pour ${reason}`)
  27. }
  28. };
Advertisement
Add Comment
Please, Sign In to add comment