Advertisement
Guest User

Disord.js

a guest
Apr 15th, 2019
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2.  * An example of how you can send embeds
  3.  */
  4.  
  5. // Extract the required classes from the discord.js module
  6. const { Client, RichEmbed } = require('discord.js');
  7.  
  8. // Create an instance of a Discord client
  9. const client = new Client();
  10.  
  11. /**
  12.  * The ready event is vital, it means that only _after_ this will your bot start reacting to information
  13.  * received from Discord
  14.  */
  15. client.on('ready', () => {
  16.   console.log('I am ready!');
  17. });
  18.  
  19. client.on('message', message => {
  20.   // If the message is "how to embed"
  21.   if (message.content === 'how to embed') {
  22.     // We can create embeds using the MessageEmbed constructor
  23.     // Read more about all that you can do with the constructor
  24.     // over at https://discord.js.org/#/docs/main/stable/class/RichEmbed
  25.     const embed = new RichEmbed()
  26.       // Set the title of the field
  27.       .setTitle('A slick little embed')
  28.       // Set the color of the embed
  29.       .setColor(0xFF0000)
  30.       // Set the main content of the embed
  31.       .setDescription('Hello, this is a slick embed!');
  32.     // Send the embed to the same channel as the message
  33.     message.channel.send(embed);
  34.   }
  35. });
  36.  
  37. // Log our bot in using the token from https://discordapp.com/developers/applications/me
  38. client.login('your token here');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement