Skip to content

Instantly share code, notes, and snippets.

@Coocla33
Created April 13, 2017 10:05
Show Gist options
  • Save Coocla33/17b9c6e92730156b3edeb344f2505ad4 to your computer and use it in GitHub Desktop.
Save Coocla33/17b9c6e92730156b3edeb344f2505ad4 to your computer and use it in GitHub Desktop.
//Require Discord.js
const Discord = require('discord.js')
//Create a new bot Account
const bot = new Discord.Client()
//Bot token
const token = 'Your bot token here'
//Logging in with the bot Account
bot.login(token)
//When the bot is read, send a message to the console saying the bot is ready
bot.on('ready', () => {
console.log('Bot is ready!')
})
//Whenever the bot detects a new message, this code will be ran
bot.on('message', (message) => {
//Check if the content of the incoming message is equal to 'ping'
if (message.content == 'ping') {
//Send a message with the content of 'Pong!'
message.channel.sendMessage('Pong!')
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment