This repository has been archived by the owner on Mar 25, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 153
Home
izy521 edited this page Oct 9, 2016
·
26 revisions
A library to create clients for Discord using Node.js.
This wiki is old and out of date, heavily. Use the documentation link on the Github's front page, please.
Required:
- Node.js 0.12.x or greater
- Needle module
- ws module
Optional:
- ffmpeg/avconv (and added to PATH)
- node-opus module (required for sending audio streams)
npm install discord.io
Token: This library requires your Discord OAuth2 bot's token, which you can retrieve from here: https://discordapp.com/developers/docs/intro.
var Discord = require('discord.io');
var bot = new Discord.Client({
autorun: true,
token: ""
});
bot.on('ready', function() {
console.log(bot.username + " - (" + bot.id + ")");
});
bot.on('message', function(user, userID, channelID, message, rawEvent) {
if (message === "ping") {
bot.sendMessage({
to: channelID,
message: "pong"
});
}
});