dyno-bot/eris-dev/examples/pingpong.js
2020-09-12 19:08:48 +01:00

21 lines
687 B
JavaScript

const Eris = require("eris");
var bot = new Eris("BOT_TOKEN");
// Replace BOT_TOKEN with your bot account's token
bot.on("ready", () => { // When the bot is ready
console.log("Ready!"); // Log "Ready!"
});
bot.on("messageCreate", (msg) => { // When a message is created
if(msg.content === "!ping") { // If the message content is "!ping"
bot.createMessage(msg.channel.id, "Pong!");
// Send a message in the same channel with "Pong!"
} else if(msg.content === "!pong") { // Otherwise, if the message is "!pong"
bot.createMessage(msg.channel.id, "Ping!");
// Respond with "Ping!"
}
});
bot.connect(); // Get the bot to connect to Discord