Added basic ping pong bot
Requires a config.json file with a token
This commit is contained in:
parent
b6c4e08737
commit
7f65c0c117
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -53,3 +53,5 @@ jspm_packages
|
||||||
|
|
||||||
# Output of 'npm pack'
|
# Output of 'npm pack'
|
||||||
*.tgz
|
*.tgz
|
||||||
|
|
||||||
|
/config.json
|
||||||
|
|
21
feed-bot.js
Normal file
21
feed-bot.js
Normal file
|
@ -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 a new issue