Created
April 13, 2017 10:05
-
-
Save Coocla33/17b9c6e92730156b3edeb344f2505ad4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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