<<<<<<< HEAD
discord.js is a node module used as a way of interfacing with Discord. It is a very useful module for creating bots.
Requires node 0.12+
npm install --save discord.js
=======
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
Node.js 10.0.0 or newer is required.
Ignore any warnings about unmet peer dependencies, as they're all optional.
Without voice support: npm install discordjs/discord.js
With voice support (node-opus): npm install discordjs/discord.js node-opus
With voice support (opusscript): npm install discordjs/discord.js opusscript
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.
- zlib-sync for faster WebSocket data inflation (
npm install zlib-sync
) - zucc for significantly faster WebSocket data inflation (
npm install zucc
) - 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:
- sodium (
npm install sodium
) - libsodium.js (
npm install libsodium-wrappers
)
- sodium (
- 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
)
upstream/master
var Discord = require("discord.js");
var mybot = new Discord.Client();
mybot.on("message", function(message){
if(message.content === "ping")
mybot.reply(message, "pong");
});
mybot.login("email", "password");
Feel free to contribute! Just clone the repo and edit the files in the src folder, not the lib folder.
Whenever you come to making a pull request, make sure it's to the indev branch and that you have built the lib files by running grunt --dev
Here is a list of other Discord APIs:
discord.io (similar to discord.js but lower level)
If you have an issue or want to know if a feature exists, read the documentation before contacting me about any issues! If it's badly/wrongly implemented, let me know!
If you would like to contact me, you can create an issue on the GitHub repo, e-mail me via the one available on my NPM profile.
<<<<<<< HEAD Alternatively, you could just send a DM to hydrabolt in Discord API.
- Website (source)
- Documentation
- Guide (source) - this is still for stable
See also the WIP Update Guide also including updated and removed items in the library. - Discord.js Discord server
- Discord API Discord server
- GitHub
- NPM
- Related libraries
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.
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.
upstream/master