Skip to content
This repository has been archived by the owner on Mar 25, 2020. It is now read-only.
izy521 edited this page May 17, 2016 · 26 revisions

discord.io

A library to create clients for Discord using Node.js.

forthebadge

Requirements:

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)

Getting Started:

npm install discord.io

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"
        });
    }
});

Token

Token support has been brought back by request of the Discord Developers. If you provide a token, your email and password will be ignored. If you do not provide a token, the lib will log into Discord once, attempt to save the token on your file system as tenc within your bot's launch directory, encrypt it with your email and password and proceed to load it the next time you log in. If that fails (you use a different login) the lib will inform you that it was unable to parse tenc.

Clone this wiki locally