Added basic ping pong bot
Requires a config.json file with a token
This commit is contained in:
parent
b6c4e08737
commit
7f65c0c117
|
@ -53,3 +53,5 @@ jspm_packages
|
|||
|
||||
# Output of 'npm pack'
|
||||
*.tgz
|
||||
|
||||
/config.json
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
var Discord = require("discord.io");
|
||||
var Config = require("./config.json");
|
||||
var console = require("console");
|
||||
|
||||
var bot = new Discord.Client({
|
||||
token: Config.token,
|
||||
autorun: true
|
||||
});
|
||||
|
||||
bot.on("ready", function () {
|
||||
console.log(bot.username + " - (" + bot.id + ")");
|
||||
});
|
||||
|
||||
bot.on("message", function (user, userID, channelID, message) {
|
||||
if (message === "ping") {
|
||||
bot.sendMessage({
|
||||
to: channelID,
|
||||
message: "pong"
|
||||
});
|
||||
}
|
||||
});
|
Loading…
Reference in New Issue