No description
Find a file
Gus Caplan 3eca3ba95e add handler in case heartbeat is not acked (#1013)
* add handler in case heartbeat is not acked

* ffs
2016-12-24 11:04:27 +00:00
deploy Fix paths 2016-11-22 18:34:08 -05:00
docs Change welcome logo to reference static one on site 2016-12-14 21:05:48 -05:00
src add handler in case heartbeat is not acked (#1013) 2016-12-24 11:04:27 +00:00
test new errors for richembed yay (#966) 2016-12-09 22:09:55 -05:00
typings Add RichEmbed to typings (#1009) 2016-12-22 14:50:28 -05:00
.eslintrc.json Fix another JSDoc type issue 2016-11-12 21:10:28 -05:00
.gitignore Fix paths 2016-11-22 18:34:08 -05:00
.tern-project Create .tern-project (#1003) 2016-12-20 23:37:19 +00:00
.travis.yml Switch Travis to Ubuntu 14.04 2016-11-28 23:35:25 -05:00
CONTRIBUTING.md Add branch info to contributing guide 2016-11-12 23:50:06 -05:00
LICENSE initial 2016-04-16 22:58:49 +01:00
package.json fix runkit/tonicdev example (#998) 2016-12-17 17:44:25 +00:00
README.md Switch to SVG logo 2016-12-14 20:42:51 -05:00
webpack.config.js Change the way modules are excluded from webpack 2016-11-20 23:19:53 -05:00


discord.js


Discord server NPM version NPM downloads Build status Dependencies

NPM info

About

discord.js is a powerful node.js module that allows you to interact with the Discord API very easily.

  • Object-oriented
  • Predictable abstractions
  • Performant
  • Nearly 100% coverage of the Discord API

Installation

Node.js 6.0.0 or newer is required.
Ignore any warnings about unmet peer dependencies - all peer dependencies are optional.

Without voice support: npm install discord.js --save
With voice support (node-opus): npm install discord.js node-opus --save
With voice support (opusscript): npm install discord.js opusscript --save

Audio engines

The preferred audio engine is node-opus, as it performs significantly better than opusscript. When both are available, discord.js will automatically choose node-opus. Using opusscript is only recommended for development environments where node-opus is tough to get working. For production bots, using node-opus should be considered a necessity, especially if they're going to be running on multiple servers.

Optional packages

  • uws for much a much faster WebSocket connection (npm install uws --save)
  • erlpack for significantly faster WebSocket data (de)serialisation (npm install hammerandchisel/erlpack --save)

Example Usage

const Discord = require('discord.js');
const client = new Discord.Client();

client.on('ready', () => {
  console.log('I am ready!');
});

client.on('message', message => {
  if (message.content === 'ping') {
    message.reply('pong');
  }
});

client.login('your token');

A bot template using discord.js can be generated using generator-discordbot.

Web distributions

Web builds of discord.js that are fully capable of running in browsers are available here. These are built using Webpack 2. The API is identical, but rather than using require('discord.js'), the entire Discord object is available as a global (on the window object). The ShardingManager and any voice-related functionality is unavailable in these builds.

Contributing

Before creating an issue, please ensure that it hasn't already been reported/suggested, and double-check the documentation.
See the contribution guide if you'd like to submit a PR.

Help

If you don't understand something in the documentation, you are experiencing problems, or you just need a gentle nudge in the right direction, please don't hesitate to join our official Discord.js Server.