<div align=“center”>
<br />
<p>
<a href=“https://discord.js.org”><img src=“https://discord.js.org/static/logo.svg” width=“546” alt=“discord.js” /></a>
</p>
<br />
<p>
<a href=“https://discord.gg/bRCvFy9”><img src=“https://discord.com/api/guilds/222078108977594368/embed.png” alt=“Discord server” /></a>
<a href=“https://www.npmjs.com/package/discord.js”><img src=“https://img.shields.io/npm/v/discord.js.svg?maxAge=3600” alt=“NPM version” /></a>
<a href=“https://www.npmjs.com/package/discord.js”><img src=“https://img.shields.io/npm/dt/discord.js.svg?maxAge=3600” alt=“NPM downloads” /></a>
<a href=“https://github.com/discordjs/discord.js/actions”><img src=“https://github.com/discordjs/discord.js/workflows/Testing/badge.svg” alt=“Build status” /></a>
<a href=“https://david-dm.org/discordjs/discord.js”><img src=“https://img.shields.io/david/discordjs/discord.js.svg?maxAge=3600” alt=“Dependencies” /></a>
<a href=“https://www.patreon.com/discordjs”><img src=“https://img.shields.io/badge/donate-patreon-F96854.svg” alt=“Patreon” /></a>
</p>
<p>
<a href=“https://nodei.co/npm/discord.js/”><img src=“https://nodei.co/npm/discord.js.png?downloads=true&stars=true” alt=“npm installnfo” /></a>
</p>
</div>
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
Node.js 12.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 (@discordjs/opus): npm install discord.js @discordjs/opus
With voice support (opusscript): npm install discord.js opusscript
The preferred audio engine is @discordjs/opus, as it performs significantly better than opusscript. When both are available, discord.js will automatically choose @discordjs/opus.
Using opusscript is only recommended for development environments where @discordjs/opus is tough to get working.
For production bots, using @discordjs/opus should be considered a necessity, especially if they’re going to be running on multiple servers.
- zlib-sync for WebSocket data compression and inflation (
npm install zlib-sync
) - erlpack for significantly faster WebSocket data (de)serialisation (
npm install discord/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 (
- bufferutil for a much faster WebSocket connection (
npm install bufferutil
) - utf-8-validate in combination with
bufferutil
for much faster WebSocket processing (npm install utf-8-validate
)
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- Website (source)
- Documentation
- Guide (source) - this is still for stable
See also the Update Guide, including updated and removed items in the library. - Discord.js Discord server
- Discord API Discord server
- GitHub
- NPM
- Related libraries
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.
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.
<div>
<p>
<a href=“https://www.patreon.com/bePatron?u=806427” data-patreon-widget-type=“become-patron-button”><img src=“https://c5.patreon.com/external/logo/become_a_patron_button@2x.png” width=“85”></a>
<a href=“https://discord.gg/plexidev”><img src=“https://discordapp.com/api/guilds/343572980351107077/embed.png” alt=“Discord Server” /></a>
<a href=“https://GitHub.com/Plexi-Development/quick.db/stargazers/”><img src=“https://img.shields.io/github/stars/Plexi-Development/quick.db.svg?style=social&label=Star”></a>
</p>
Website / Documentation | Discord Support (17000+ Users) | NPM Page |
---|---|---|
quickdb.js.org | discord.gg/plexidev | npmjs.com/package/quick.db |
</div>
Quick.db is an open-sourced package meant to provide an easy way for beginners, and people of all levels to access & manage a database. All data is stored persistently, and comes with various extra features.
- Persistent storage w/ no setup (Data doesn’t disappear through restarts)
- Beginner Friendly
- Discord Support
- Multiple tables support
- and more!
All data in quick.db is stored persistently in a database. Here is an example of setting an object in the database, then fetching parts & the full object.
const db = require('quick.db');
// Setting an object in the database:
db.set('userInfo', { difficulty: 'Easy' })
// -> { difficulty: 'Easy' }
// Pushing an element to an array (that doesn't exist yet) in an object:
db.push('userInfo.items', 'Sword')
// -> { difficulty: 'Easy', items: ['Sword'] }
// Adding to a number (that doesn't exist yet) in an object:
db.add('userInfo.balance', 500)
// -> { difficulty: 'Easy', items: ['Sword'], balance: 500 }
// Repeating previous examples:
db.push('userInfo.items', 'Watch')
// -> { difficulty: 'Easy', items: ['Sword', 'Watch'], balance: 500 }
db.add('userInfo.balance', 500)
// -> { difficulty: 'Easy', items: ['Sword', 'Watch'], balance: 1000 }
// Fetching individual properties
db.get('userInfo.balance') // -> 1000
db.get('userInfo.items') // ['Sword', 'Watch']
If you’re having troubles installing, please follow this troubleshooting guide.
Linux & Windows
npm i quick.db
Note: Windows users may need to do additional steps listed here.
Mac
- Install: XCode
- Run:
npm i -g node-gyp
in terminal - Run:
node-gyp --python /path/to/python2.7
(skip this step if you didn’t install python 3.x) - Run:
npm i quick.db
Quick.db is an easy to use database wrapper for better-sqlite3, it was designed to be simple to let new users who are just getting into development and don’t want to worry about learning SQL just quite yet.
Over 16,000 open-source programs use Quick.db as a dependent! Source