SHARE
TWEET

bot code

godowsky Feb 14th, 2020 (edited) 94 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const Discord = require("discord.js");
  2.  
  3. const client = new Discord.Client();
  4. const auth = require('./auth.json');
  5.  
  6. client.on("ready", () => {
  7.   console.log(`Logged in as ${client.user.tag}!`);
  8.   client.user.setActivity(`Trabajando con amor~`);
  9. });
  10.  
  11. //no bot answer
  12. client.on("message", async message => {
  13.   if (!message.content.startsWith(auth.prefix)) return;
  14.  
  15.   const args = message.content.slice(auth.prefix.length).trim().split(/ +/g);
  16.    const command = args.shift().toLowerCase();
  17.     //commands
  18.  
  19.  //kick
  20.  if(command === "kick") {
  21.  
  22.      if(!message.member.roles.some(r=>["☾ ⋅ « Moonstone » ⋅ ☽", "✭ ⋅ « Angels » ⋅ ✭", "✭ ⋅ « Guardiansᴹᵒᵈˢ » ⋅ ✭"].includes(r.name)) )
  23.        return message.reply("Perdon, pero no tienes los permisos adecuados!");
  24.  
  25.        let member = message.mentions.members.first() || message.guild.members.get(args[0]);
  26.           if(!member)
  27.             return message.reply("A quien quieres expulsar?");
  28.           if(!member.kickable) {
  29.             return message.reply("No puedo expulsar a este miembro :c");
  30.  }
  31.             let reason = args.slice(1).join(' ');
  32.                if(!reason) reason = "La razon no fue dada";
  33.  
  34.         await member.kick(reason)
  35.         .catch(error => message.reply(`No pude ejecutar esto por : ${error}`));
  36.         message.reply(`${member.user.tag} ha sido expulsado por ${message.author.mention} . Razon: ${reason}`);
  37.  
  38.    }
  39.  
  40.  
  41. //ban
  42.    if(command === "ban") {
  43.  
  44.    if(!message.member.roles.some(r=>["☾ ⋅ « Moonstone » ⋅ ☽", "✭ ⋅ « Angels » ⋅ ✭", "✭ ⋅ « Guardiansᴹᵒᵈˢ » ⋅ ✭"].includes(r.name)) ){
  45.      return message.reply("Perdon, pero no tienes los permisos adecuados!");
  46. }
  47.    let member = message.mentions.members.first();
  48.    if(!member){
  49.      return message.reply("A quien quieres bannear?");
  50. }
  51.    if(!member.bannable) {
  52.      return message.reply("No puedo bannear a este usuario :c");
  53. }
  54.    let reason = args.slice(1).join(' ');
  55.    if(!reason) reason = "La razon no fue dada";
  56.  
  57.    await member.ban(reason)
  58.      .catch(error => message.reply(`No pude ejecutar esto por : ${error}`));
  59.    message.reply(`${member.user.tag} ha sido expulsado por ${message.author.mention} . Razon: ${reason}`);
  60.  }
  61.  
  62.  
  63.  if(command === "purge" || "clear" || "clean") {
  64.     // delete from 2-100.
  65.  
  66.     const deleteCount = parseInt(args[0], 10);
  67.  
  68.     //nice, combined conditions. <3 if only they worked
  69.     if(!deleteCount) {
  70.       return message.reply("Un numero del 2-100");
  71.  
  72.     // So we get our messages, and delete them. Simple enough, right? not
  73.     const fetched = await message.channel.fetchMessages({limit: deleteCount});
  74.     message.channel.bulkDelete(fetched)
  75.       .catch(error => message.reply(`Error: ${error}`)) ;
  76. }
  77.   }
  78.  
  79.   if(command === "say" || "di") {
  80.  
  81.       const sayMessage = args.join(" ");
  82.  
  83.       message.delete().catch(O_o=>{});
  84.  
  85.       message.channel.send(sayMessage);
  86.     }
  87.  
  88.  
  89.  
  90.  
  91. client.on('message', message => {
  92.   if (message.content === 'holi')
  93.     message.reply('hola nwn');
  94.   });
  95.  
  96. client.login(auth.token);
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