\n\t
\n\t
\n\t\t\n\t
\n\t
\n\t
\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t
\n\t
\n\t\t\n\t\t\n\t
\n
\n\n## About\n\ndiscord.js is a powerful [Node.js](https://nodejs.org) module that allows you to easily interact with the\n[Discord API](https://discord.com/developers/docs/intro).\n\n- Object-oriented\n- Predictable abstractions\n- Performant\n- 100% coverage of the Discord API\n\n## Installation\n\n**Node.js 16.11.0 or newer is required.**\n\n```sh\nnpm install discord.js\nyarn add discord.js\npnpm add discord.js\nbun add discord.js\n```\n\n### Optional packages\n\n- [zlib-sync](https://www.npmjs.com/package/zlib-sync) for WebSocket data compression and inflation (`npm install zlib-sync`)\n- [bufferutil](https://www.npmjs.com/package/bufferutil) for a much faster WebSocket connection (`npm install bufferutil`)\n- [utf-8-validate](https://www.npmjs.com/package/utf-8-validate) in combination with `bufferutil` for much faster WebSocket processing (`npm install utf-8-validate`)\n- [@discordjs/voice](https://www.npmjs.com/package/@discordjs/voice) for interacting with the Discord Voice API (`npm install @discordjs/voice`)\n\n## Example usage\n\nInstall discord.js:\n\n```sh\nnpm install discord.js\nyarn add discord.js\npnpm add discord.js\nbun add discord.js\n```\n\nRegister a slash command against the Discord API:\n\n```js\nimport { REST, Routes } from 'discord.js';\n\nconst commands = [\n {\n name: 'ping',\n description: 'Replies with Pong!',\n },\n];\n\nconst rest = new REST({ version: '10' }).setToken(TOKEN);\n\ntry {\n console.log('Started refreshing application (/) commands.');\n\n await rest.put(Routes.applicationCommands(CLIENT_ID), { body: commands });\n\n console.log('Successfully reloaded application (/) commands.');\n} catch (error) {\n console.error(error);\n}\n```\n\nAfterwards we can create a quite simple example bot:\n\n```js\nimport { Client, GatewayIntentBits } from 'discord.js';\nconst client = new Client({ intents: [GatewayIntentBits.Guilds] });\n\nclient.on('ready', () => {\n console.log(`Logged in as ${client.user.tag}!`);\n});\n\nclient.on('interactionCreate', async interaction => {\n if (!interaction.isChatInputCommand()) return;\n\n if (interaction.commandName === 'ping') {\n await interaction.reply('Pong!');\n }\n});\n\nclient.login(TOKEN);\n```\n\n## Links\n\n- [Website][website] ([source][website-source])\n- [Documentation][documentation]\n- [Guide][guide] ([source][guide-source])\n Also see the v13 to v14 [Update Guide][guide-update], which includes updated and removed items from the library.\n- [discord.js Discord server][discord]\n- [Discord API Discord server][discord-api]\n- [GitHub][source]\n- [npm][npm]\n- [Related libraries][related-libs]\n\n### Extensions\n\n- [RPC][rpc] ([source][rpc-source])\n\n## Contributing\n\nBefore creating an issue, please ensure that it hasn't already been reported/suggested, and double-check the\n[documentation][documentation]. \nSee [the contribution guide][contributing] if you'd like to submit a PR.\n\n## Help\n\nIf 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][discord].\n\n[website]: https://discord.js.org\n[website-source]: https://github.com/discordjs/discord.js/tree/main/apps/website\n[documentation]: https://discord.js.org/docs/packages/discord.js/stable\n[guide]: https://discordjs.guide/\n[guide-source]: https://github.com/discordjs/guide\n[guide-update]: https://discordjs.guide/additional-info/changes-in-v14.html\n[discord]: https://discord.gg/djs\n[discord-api]: https://discord.gg/discord-api\n[source]: https://github.com/discordjs/discord.js/tree/main/packages/discord.js\n[npm]: https://www.npmjs.com/package/discord.js\n[related-libs]: https://discord.com/developers/docs/topics/community-resources#libraries\n[rpc]: https://www.npmjs.com/package/discord-rpc\n[rpc-source]: https://github.com/discordjs/RPC\n[contributing]: https://github.com/discordjs/discord.js/blob/main/.github/CONTRIBUTING.md\n","path":"packages/discord.js/README.md"}}}}}