SHARE
TWEET

Code Discord Bot Creation by SUPRAZY #7

a guest Feb 18th, 2020 113 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Pour kick.js =>
  2.  
  3. const Discord = require("discord.js");
  4. const colours = require("../colours.json");
  5.  
  6. module.exports.run = async (bot, message, args) => {
  7.  
  8.    let kickedUser = message.guild.member(message.mentions.users.first() || message.guild.members.get(args[0]));
  9.    if(!kickedUser) {
  10.        return message.channel.send("**Not found.**")
  11.    }
  12.    let kickReason = args.join(" ").slice(22);
  13.    if(!message.member.hasPermission("MANAGE_MESSAGES")) {
  14.        return message.channel.send("You don't have permission !")
  15.    }
  16.    if(kickedUser.hasPermission("MANAGE_MESSAGES")) {
  17.        return message.channel.send("You don't kick this person")
  18.    }
  19.    let kickEmbed = new Discord.RichEmbed()
  20.    .setDescription("-Kick-")
  21.    .setColor(colours.red_light)
  22.    .addField("User kicked", `${kickedUser} (ID: ${kickedUser.id})`)
  23.    .addField("Autor of kick", `${message.author} (ID: ${message.author.id})`)
  24.    .addField("Canal", message.channel)
  25.    .addField("Raison", kickReason)
  26.  
  27.    let kickChannel = message.guild.channels.find(`name`, "tutodev-log");
  28.    if(!kickChannel) {
  29.        return message.channel.send("Canal 'tutodev-log' not found. Please create it")
  30.    }
  31.    message.guild.member(kickedUser).kick(kickReason)
  32.    kickChannel.send(kickEmbed)
  33. }
  34.  
  35. module.exports.help = {
  36.     name: "kick"
  37. }
  38.  
  39. Pour ban.js =>
  40.  
  41. const Discord = require("discord.js");
  42. const colours = require("../colours.json");
  43.  
  44. module.exports.run = async (bot, message, args) => {
  45.  
  46.    let bannedUser = message.guild.member(message.mentions.users.first() || message.guild.members.get(args[0]));
  47.    if(!bannedUser) {
  48.        return message.channel.send("**Not found.**")
  49.    }
  50.    let banReason = args.join(" ").slice(22);
  51.    if(!message.member.hasPermission("MANAGE_MESSAGES")) {
  52.        return message.channel.send("You don't have permission !")
  53.    }
  54.    if(bannedUser.hasPermission("MANAGE_MESSAGES")) {
  55.        return message.channel.send("You don't ban this person")
  56.    }
  57.    let banEmbed = new Discord.RichEmbed()
  58.    .setDescription("~Ban~")
  59.    .setColor(colours.red_light)
  60.    .addField("User banned", `${bannedUser} (ID: ${bannedUser.id})`)
  61.    .addField("Autor of ban", `${message.author} (ID: ${message.author.id})`)
  62.    .addField("Canal", message.channel)
  63.    .addField("Raison", banReason)
  64.  
  65.    let banChannel = message.guild.channels.find(`name`, "tutodev-log");
  66.    if(!banChannel) {
  67.        return message.channel.send("Canal 'tutodev-log' not found. Please create it")
  68.    }
  69.    message.guild.member(bannedUser).ban(banReason)
  70.    banChannel.send(banEmbed)
  71. }
  72.  
  73. module.exports.help = {
  74.     name: "ban"
  75. }
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