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

discord.io

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

Outdated

This wiki is old and out of date, heavily. Use the documentation link on the Github's front page, please.

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

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"
        });
    }
});
Clone this wiki locally