-
Notifications
You must be signed in to change notification settings - Fork 45
Home
Umaru-kun edited this page Oct 24, 2015
·
9 revisions
Discordie
A Node.js module providing a set of interfaces to interact with Discord API.
`var Discordie = require("discordie");
var auth = { email: "[email protected]", password: "" };
var client = new Discordie();
function connect() { client.connect(auth); } connect();
client.Dispatcher.on(Discordie.Events.DISCONNECTED, (e) => { console.log("Reconnecting"); setTimeout(connect, 5000); });
client.Dispatcher.on(Discordie.Events.GATEWAY_READY, (e) => { console.log("Connected as: " + client.User.username); });
client.Dispatcher.on(Discordie.Events.MESSAGE_CREATE, (e) => { console.log("new message: "); console.log(JSON.stringify(e.message, null, " "));
if (e.message.content == "ping") { e.message.channel.sendMessage("pong"); } });`