SHARE
TWEET

Pook bot code with reaction

a guest May 21st, 2019 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const Discord = require('discord.js')
  2. const client = new Discord.Client()
  3. client.once('ready', () => {
  4.  client.user.setActivity(`
  5. ${client.users.size} Pooklets and              
  6.   ${client.guilds.size} Caves`,
  7.   {type: "Watching"})
  8.     console.log('Ready!')
  9. })
  10.  
  11. client.on("message", (message) => {
  12.   let messageArray = message.content.split(" ");
  13.   let cmd = messageArray[0];
  14.   let args = messageArray.slice(1);
  15.  
  16. if(cmd == "+send") {
  17. let member = message.guild.members.find(x => x.toString() == args[0])
  18. if(!member) return message.channel.send("Please mention a user")
  19.  
  20. if(!args[1]) return message.channel.send("Write a message")
  21.  
  22. member.sendMessage(args.slice(1).join(" "))
  23. }
  24.      if (message.content.startsWith("+ban")) {
  25.    if(!message.member.hasPermissions("BAN_MEMBERS")) message.channel.send("You are not allowed to use this command")
  26.     // Easy way to get member object though mentions.
  27.     var member = message.mentions.members.first();
  28.     // kick change to ban for ban
  29.     member.ban().then((member) => {
  30.         // Successmessage
  31.         message.channel.send("User has been banned");
  32.     }).catch(() => {
  33.         // Failmessage
  34.         message.channel.send("My imagination is broken give me admin for lots of dreams");
  35.          message.react("575050237169631232");
  36.     });
  37.      }
  38. })
  39. // Set the bot's "Playing: " status (must be in an event!)
  40.  
  41. client.on("message", (message) => {
  42.   if(message.content === "+invite") {
  43.     message.channel.send("I sent you a DM with my invite link.")
  44.     message.author.send(" https://discordapp.com/oauth2/authorize?client_id=564534903757209623&permissions=8&redirect_uri=http://dbots.ml/&response_type=code&scope=bot%20identify");
  45.  
  46.    }
  47.   if(message.content === "+help") {
  48.     message.react("575050237169631232"); // If it's a valid emote id, yes
  49.      message.react("580180655124774914")
  50.     message.channel.send("Here you go")
  51.    message.channel.send({embed: {
  52.     color: 8598175,
  53.     author: {
  54.       name: message.author.username,
  55.       icon_url: message.author.avatarURL
  56.     },
  57.     title: "Website",
  58.     url: "https://pookbots.glitch.me/",
  59.     description: "Click for our website",
  60.     fields: [{
  61.         name: "My Commands:",
  62.         value: "+ban bans a member\n +leave leaves the server\n +help shows this message\n +me shows detailed info about your profile\n +serverinfo shows detailed server info\n +botinfo shows detailed info about the bot\n +send messages a staff\n +invite invites the bot"
  63.       },
  64.       {
  65.         name: "Bot",
  66.         value: "Invite our bot [Click here](https://discordapp.com/oauth2/authorize?client_id=564534903757209623&permissions=8&redirect_uri=http://dbots.ml/&response_type=code&scope=bot%20identify)"
  67.       },
  68.      
  69.    
  70.     ],
  71.     timestamp: new Date(),
  72.     footer: {
  73.       icon_url: client.user.avatarURL,
  74.       text: "Pook ©"
  75.     }
  76.   }
  77. });
  78.   }
  79.   if (message.content === "+serverinfo") {
  80.  message.react("575050237169631232");
  81.       const embed = new Discord.RichEmbed()
  82.   .addField("Server:", message.guild.name)
  83.   .setAuthor(message.author.username, message.author.avatarURL)
  84.   .setColor(8598175)
  85.   .setFooter("Pook ©", client.user.avatarURL)
  86.   .setThumbnail(message.guild.iconURL)
  87.   .setTimestamp()
  88.   .setURL("")
  89.  
  90.   .addField("Members:", message.guild.memberCount)
  91.   .addField("Region:", message.guild.region);
  92.     message.channel.send({embed});
  93.  
  94.   }
  95.      if (message.content === "+botinfo") {
  96.  message.react("575050237169631232");
  97.       const embed = new Discord.RichEmbed()
  98.   .addField("Users:", client.users.size)
  99.   .setAuthor("Cookies#3916", message.client.user.avatarURL)
  100.   .setColor(8598175)
  101.   .setFooter("Pook ©", client.user.avatarURL)
  102.   .setThumbnail(message.client.user.avatarURL)
  103.   .setTimestamp()
  104.   .setURL("")
  105.  
  106.   .addField("Servers:", client.guilds.size)
  107.   .addField("Channels:", client.channels.size);
  108.     message.channel.send({embed});
  109.  
  110. }
  111. if (message.content === "+me") {
  112.    message.react("575050237169631232");
  113.         const embed = new Discord.RichEmbed()
  114.   .addField("Are you a bot?", message.author.bot, true)
  115.   .setAuthor(message.author.username, message.author.avatarURL)
  116.   .setColor(8598175)
  117.   .setFooter("Pook ©", client.user.avatarURL)
  118.   .setThumbnail(message.author.avatarURL)
  119.   .setTimestamp()
  120.   .setURL("")
  121.   .addBlankField(true)
  122.   .addField("User Id", message.author.id, true)
  123.   .addField("User Created", message.author.createdAt , true);
  124.     message.channel.send({embed});
  125.    
  126. }
  127.  
  128.  if (message.content ==="+rate")
  129. message.react('😠').then(() => message.react('😍').then(() => message.react('🤷')));
  130. const filter = (reaction, user) => {
  131.     return ['😠', '😍','🤷'].includes(reaction.emoji.name) && user.id === message.author.id;
  132. };
  133.  
  134. message.awaitReactions(filter, { max: 1, time: 900000, errors: ['time'] })
  135.     .then(collected => {
  136.         const reaction = collected.first();
  137.  
  138.         if (reaction.emoji.name === '🤷') {
  139.             message.channel.send('Thanks for rating!');
  140.       client.users.get("517122540200787978").send(message.author.tag);
  141.        client.users.get("517122540200787978").send(reaction.emoji.name);
  142.        console.log(message.author.tag)
  143.        console.log(reaction.emoji.name)
  144.     }
  145.         if (reaction.emoji.name === '😍') {
  146.             message.channel.send('Thanks for rating');
  147.       client.users.get("517122540200787978").send(message.author.tag);
  148.        client.users.get("517122540200787978").send(reaction.emoji.name);
  149.        console.log(message.author.tag)
  150.        console.log(reaction.emoji.name)
  151.       }
  152.         if (reaction.emoji.name === '😠') {
  153.             message.channel.send('Sorry...');
  154.       client.users.get("517122540200787978").send(message.author.tag);
  155.        client.users.get("517122540200787978").send(reaction.emoji.name);
  156.        console.log(message.author.tag)
  157.        console.log(reaction.emoji.name)
  158.         }
  159.     })
  160.  
  161.  
  162. });
  163. client.login("My token would go here")
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