Advertisement
Guest User

Discord.js Bot Basics

a guest
Nov 24th, 2019
1,154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const Discord = require('discord.js')
  2. const bot = new Discord.Client();
  3. const token = 'Your Bots Token Here';
  4.  
  5. bot.on('ready', () =>{
  6.     console.log('Yo this is ready!');//informs you when the bot is online(in console)
  7. })
  8.  
  9. bot.on('message', async message =>{
  10.  if (message.content === ('hi')) {//this is what you will send/run
  11.      message.channel.send('hello')//this what the bot will reply
  12.  }  
  13. },)
  14.  
  15.  
  16. bot.login(token);//the bot logins at the end
  17.  
  18. //CTRL ~ to open terminal and node . or node index.js to open your bot and to close it do CTRL C
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement