Skip to content
A powerful JavaScript library for interacting with the Discord API
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github chore: remove user account checkbox from bug report template Nov 17, 2018
docs Partials (#3070) Feb 13, 2019
src Improve structure extension errors Mar 24, 2019
test Partials (#3070) Feb 13, 2019
travis Add deploy exception for dependabot branches Mar 25, 2018
typings feat(MessageStore): add cache parameter to fetchPinned() (#3154) Mar 19, 2019
.eslintrc.json
.gitattributes According to the spec just this should work Apr 19, 2017
.gitignore
.npmignore
.npmrc Fix .npmrc to not create package-lock.json (#1936) Sep 13, 2017
.tern-project Fix tern file Aug 6, 2017
.travis.yml
LICENSE
README.md
jsdoc.json Store and Model Refactor (#1618) Aug 25, 2017
package.json use official release of prism Feb 21, 2019
tsconfig.json Add missing EOF newlines Aug 14, 2018
tslint.json
webpack.config.js

README.md


discord.js


Discord server NPM version NPM downloads Build status Dependencies Patreon

npm installnfo

About

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

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

Installation

Node.js 8.0.0 or newer is required.
Ignore any warnings about unmet peer dependencies, as they're all optional.

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

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

  • zlib-sync for significantly faster WebSocket data inflation (npm install zlib-sync)
  • erlpack for significantly faster WebSocket data (de)serialisation (npm install discordapp/erlpack)
  • One of the following packages can be installed for faster voice packet encryption and decryption:
  • uws for a much faster WebSocket connection (npm install @discordjs/uws)
  • bufferutil for a much faster WebSocket connection when not using uws (npm install bufferutil)

Example usage

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

client.on('ready', () => {
  console.log(`Logged in as ${client.user.tag}!`);
});

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

client.login('token');

Links

Extensions

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.

You can’t perform that action at this time.