{"meta":{"generator":"0.9.0","format":20,"date":1586106740653},"custom":{"general":{"name":"General","files":{"welcome":{"name":"Welcome","type":"md","content":"
\n\n# Welcome!\nWelcome to the discord.js v11.6 documentation.\nThe v11.6 release contains bugfixes from v11.5 and backports features from the in-development v12.\n\nv12 is still very much a work-in-progress, as we're aiming to make it the best it can possibly be before releasing.\nIf you are fond of living life on the bleeding-edge, check out the master branch.\n\n## About\ndiscord.js is a powerful [Node.js](https://nodejs.org) module that allows you to interact with the\n[Discord API](https://discordapp.com/developers/docs/intro) very easily.\n\n- Object-oriented\n- Predictable abstractions\n- Performant\n- 100% coverage of the Discord API\n\n## Installation\n**Node.js 6.0.0 or newer is required.** \nIgnore any warnings about unmet peer dependencies, as they're all optional.\n\nWithout voice support: `npm install discord.js` \nWith voice support ([@discordjs/opus](https://www.npmjs.com/package/@discordjs/opus)): `npm install discord.js @discordjs/opus` \nWith voice support ([opusscript](https://www.npmjs.com/package/opusscript)): `npm install discord.js opusscript`\n\n### Audio engines\nThe preferred audio engine is @discordjs/opus, as it performs significantly better than opusscript. When both are available, discord.js will automatically choose @discordjs/opus.\nUsing opusscript is only recommended for development environments where @discordjs/opus is tough to get working.\nFor production bots, using @discordjs/opus should be considered a necessity, especially if they're going to be running on multiple servers.\n\n### Optional packages\n- [bufferutil](https://www.npmjs.com/package/bufferutil) to greatly speed up the WebSocket when *not* using uws (`npm install bufferutil`)\n- [erlpack](https://github.com/hammerandchisel/erlpack) for significantly faster WebSocket data (de)serialisation (`npm install hammerandchisel/erlpack`)\n- One of the following packages can be installed for faster voice packet encryption and decryption:\n - [sodium](https://www.npmjs.com/package/sodium) (`npm install sodium`)\n - [libsodium.js](https://www.npmjs.com/package/libsodium-wrappers) (`npm install libsodium-wrappers`)\n- [uws](https://www.npmjs.com/package/@discordjs/uws) for a much faster WebSocket connection (`npm install @discordjs/uws`)\n\n## Example usage\n```js\nconst Discord = require('discord.js');\nconst client = new Discord.Client();\n\nclient.on('ready', () => {\n console.log(`Logged in as ${client.user.tag}!`);\n});\n\nclient.on('message', msg => {\n if (msg.content === 'ping') {\n msg.reply('pong');\n }\n});\n\nclient.login('token');\n```\n\n## Links\n* [Website](https://discord.js.org/) ([source](https://github.com/discordjs/website))\n* [Documentation](https://discord.js.org/#/docs)\n* [Guide](https://discordjs.guide/) ([source](https://github.com/discordjs/guide))\n* [Discord.js Discord server](https://discord.gg/bRCvFy9)\n* [Discord API Discord server](https://discord.gg/discord-api)\n* [GitHub](https://github.com/discordjs/discord.js)\n* [NPM](https://www.npmjs.com/package/discord.js)\n* [Related libraries](https://discordapi.com/unofficial/libs.html)\n\n### Extensions\n* [RPC](https://www.npmjs.com/package/discord-rpc) ([source](https://github.com/discordjs/RPC))\n\n## Contributing\nBefore creating an issue, please ensure that it hasn't already been reported/suggested, and double-check the\n[documentation](https://discord.js.org/#/docs). \nSee [the contribution guide](https://github.com/discordjs/discord.js/blob/master/.github/CONTRIBUTING.md) if you'd like to submit a PR.\n\n## Help\nIf you don't understand something in the documentation, you are experiencing problems, or you just need a gentle\nnudge in the right direction, please don't hesitate to join our official [Discord.js Server](https://discord.gg/bRCvFy9).\n","path":"docs/general/welcome.md"},"updating":{"name":"Updating your code","type":"md","content":"# Version 11.6.0\nv11.6.0 backports new features from the in-development v12, and fixes bugs in the v11.5.x releases.\nSee [the changelog](https://github.com/discordjs/discord.js/releases/tag/11.6.0) for a full list of changes, including information about deprecations.\n\n# Version 11.5.0\nv11.5.0 backports new features from the in-development v12, and fixes bugs in the v11.4.x releases.\nSee [the changelog](https://github.com/discordjs/discord.js/releases/tag/11.5.0) for a full list of changes, including information about deprecations.\n\n# Version 11.4.0\nv11.4.0 backports many new features such as Rich Presence and bugfixes from v11.3.0.\nSee [the changelog](https://github.com/discordjs/discord.js/releases/tag/11.4.0) for a full list of changes, including information about deprecations.\n\n# Version 11.3.0\nv11.3.0 backports many new features and bug fixes from the in-development v12.\nSee [the changelog](https://github.com/discordjs/discord.js/releases/tag/11.3.0) for a full list of changes, including information about deprecations.\n\n# Version 11.2.0\nv11.2.0 fixes a lot of bugs we encountered along the 11.1.0 release, as well as support for new features such as Message Attachments and UserGuildSettings.\nSee [the changelog](https://github.com/discordjs/discord.js/releases/tag/11.2.0) for a full list of changes, including information about deprecations.\n\n# Version 11.1.0\nv11.1.0 features improved voice and gateway stability, as well as support for new features such as audit logs and searching for messages.\nSee [the changelog](https://github.com/discordjs/discord.js/releases/tag/11.1.0) for a full list of changes, including\ninformation about deprecations.\n\n# Version 11\nVersion 11 contains loads of new and improved features, optimisations, and bug fixes.\nSee [the changelog](https://github.com/discordjs/discord.js/releases/tag/11.0.0) for a full list of changes.\n\n## Significant additions\n* Message Reactions and Embeds (rich text)\n* Support for uws and erlpack for better performance\n* OAuthApplication support\n* Web distributions\n\n## Breaking changes\n### Client.login() no longer supports logging in with email + password\nLogging in with an email and password has always been heavily discouraged since the advent of proper token support, but in v11 we have made the decision to completely remove the functionality, since Hammer & Chisel have [officially stated](https://github.com/hammerandchisel/discord-api-docs/issues/69#issuecomment-223886862) it simply shouldn't be done.\n\nUser accounts can still log in with tokens just like bot accounts. To obtain the token for a user account, you can log in to Discord with that account, and use Ctrl + Shift + I to open the developer tools. In the console tab, evaluating `localStorage.token` will give you the token for that account.\n\n### ClientUser.setEmail()/setPassword() now require the current password, as well as setUsername() on user accounts\nSince you can no longer log in with email and password, you must provide the current account password to the `setEmail()`, `setPassword()`, and `setUsername()` methods for user accounts (self-bots).\n\n### Removed TextBasedChannel.sendTTSMessage()\nThis method was deemed to be an entirely pointless shortcut that virtually nobody even used.\nThe same results can be achieved by passing options to `send()` or `sendMessage()`.\n\nExample:\n```js\nchannel.send('Hi there', { tts: true });\n```\n\n### Using Collection.find()/exists() with IDs will throw an error\nThis is simply to help prevent a common mistake that is made frequently.\nTo find something or check its existence using an ID, you should use `.get()` and `.has()` which are part of the [ES6 Map class](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Map), which Collection is an extension of.\n\n# Version 10\nVersion 10's non-BC changes focus on cleaning up some inconsistencies that exist in previous versions.\nUpgrading from v9 should be quick and painless.\n\n## Client options\nAll client options have been converted to camelCase rather than snake_case, and `max_message_cache` was renamed to `messageCacheMaxSize`.\n\nv9 code example:\n```js\nconst client = new Discord.Client({\n disable_everyone: true,\n max_message_cache: 500,\n message_cache_lifetime: 120,\n message_sweep_interval: 60\n});\n```\n\nv10 code example:\n```js\nconst client = new Discord.Client({\n disableEveryone: true,\n messageCacheMaxSize: 500,\n messageCacheLifetime: 120,\n messageSweepInterval: 60\n});\n```\n\n## Presences\nPresences have been completely restructured.\nPrevious versions of discord.js assumed that users had the same presence amongst all guilds - with the introduction of sharding, however, this is no longer the case.\n\nv9 discord.js code may look something like this:\n```js\nUser.status; // the status of the user\nUser.game; // the game that the user is playing\nClientUser.setStatus(status, game, url); // set the new status for the user\n```\n\nv10 moves presences to GuildMember instances. For the sake of simplicity, though, User classes also expose presences.\nWhen accessing a presence on a User object, it simply finds the first GuildMember for the user, and uses its presence.\nAdditionally, the introduction of the Presence class keeps all of the presence data organised.\n\n**It is strongly recommended that you use a GuildMember's presence where available, rather than a User.\nA user may have an entirely different presence between two different guilds.**\n\nv10 code:\n```js\nMemberOrUser.presence.status; // the status of the member or user\nMemberOrUser.presence.game; // the game that the member or user is playing\nClientUser.setStatus(status); // online, idle, dnd, offline\nClientUser.setGame(game, streamingURL); // a game\nClientUser.setPresence(fullPresence); // status and game combined\n```\n\n## Voice\nVoice has been rewritten internally, but in a backwards-compatible manner.\nThere is only one breaking change here; the `disconnected` event was renamed to `disconnect`.\nSeveral more events have been made available to a VoiceConnection, so see the documentation.\n\n## Events\nMany events have been renamed or had their arguments change.\n\n### Client events\n| Version 9 | Version 10 |\n|------------------------------------------------------|-----------------------------------------------|\n| guildMemberAdd(guild, member) | guildMemberAdd(member) |\n| guildMemberAvailable(guild, member) | guildMemberAvailable(member) |\n| guildMemberRemove(guild, member) | guildMemberRemove(member) |\n| guildMembersChunk(guild, members) | guildMembersChunk(members) |\n| guildMemberUpdate(guild, oldMember, newMember) | guildMemberUpdate(oldMember, newMember) |\n| guildRoleCreate(guild, role) | roleCreate(role) |\n| guildRoleDelete(guild, role) | roleDelete(role) |\n| guildRoleUpdate(guild, oldRole, newRole) | roleUpdate(oldRole, newRole) |\n\nThe guild parameter that has been dropped from the guild-related events can still be derived using `member.guild` or `role.guild`.\n\n### VoiceConnection events\n| Version 9 | Version 10 |\n|--------------|------------|\n| disconnected | disconnect |\n\n## Dates and timestamps\nAll dates/timestamps on the structures have been refactored to have a consistent naming scheme and availability.\nAll of them are named similarly to this:\n**Date:** `Message.createdAt`\n**Timestamp:** `Message.createdTimestamp`\nSee the docs for each structure to see which date/timestamps are available on them.\n\n\n# Version 9\nThe version 9 (v9) rewrite takes a much more object-oriented approach than previous versions,\nwhich allows your code to be much more readable and manageable.\nIt's been rebuilt from the ground up and should be much more stable, fixing caching issues that affected\nolder versions. It also has support for newer Discord Features, such as emojis.\n\nVersion 9, while containing a sizable number of breaking changes, does not require much change in your code's logic -\nmost of the concepts are still the same, but loads of functions have been moved around.\nThe vast majority of methods you're used to using have been moved out of the Client class,\ninto other more relevant classes where they belong.\nBecause of this, you will need to convert most of your calls over to the new methods.\n\nHere are a few examples of methods that have changed:\n* `Client.sendMessage(channel, message)` ==> `TextChannel.sendMessage(message)`\n * `Client.sendMessage(user, message)` ==> `User.sendMessage(message)`\n* `Client.updateMessage(message, \"New content\")` ==> `Message.edit(\"New Content\")`\n* `Client.getChannelLogs(channel, limit)` ==> `TextChannel.fetchMessages({options})`\n* `Server.detailsOfUser(User)` ==> `Server.members.get(User).properties` (retrieving a member gives a GuildMember object)\n* `Client.joinVoiceChannel(voicechannel)` => `VoiceChannel.join()`\n\nA couple more important details:\n* `Client.loginWithToken(\"token\")` ==> `client.login(\"token\")`\n* `Client.servers.length` ==> `client.guilds.size` (all instances of `server` are now `guild`)\n\n## No more callbacks!\nVersion 9 eschews callbacks in favour of Promises. This means all code relying on callbacks must be changed.\nFor example, the following code:\n\n```js\nclient.getChannelLogs(channel, 100, function(messages) {\n console.log(`${messages.length} messages found`);\n});\n```\n\n```js\nchannel.fetchMessages({limit: 100}).then(messages => {\n console.log(`${messages.size} messages found`);\n});\n```\n","path":"docs/general/updating.md"},"faq":{"name":"FAQ","type":"md","content":"# Frequently Asked Questions\nThese are just questions that get asked frequently, that usually have a common resolution.\nIf you have issues not listed here, please ask in the [official Discord server](https://discord.gg/bRCvFy9).\nAlways make sure to read the documentation.\n\n## No matter what, I get `SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode`‽\nUpdate to Node.js 6.0.0 or newer.\n\n## How do I get voice working?\n- Install FFMPEG.\n- Install either the `@discordjs/opus` package or the `opusscript` package.\n @discordjs/opus is greatly preferred, due to it having significantly better performance.\n\n## How do I install FFMPEG?\n- **npm:** `npm install ffmpeg-binaries`\n- **Ubuntu 16.04:** `sudo apt install ffmpeg`\n- **Ubuntu 14.04:** `sudo apt-get install libav-tools`\n- **Windows:** `npm install ffmpeg-binaries` or see the [FFMPEG section of AoDude's guide](https://github.com/bdistin/OhGodMusicBot/blob/master/README.md#download-ffmpeg).\n\n## How do I set up @discordjs/opus?\n- **Ubuntu:** Simply run `npm install @discordjs/opus`, and it's done. Congrats!\n- **Windows:** Run `npm install --global --production windows-build-tools` in an admin command prompt or PowerShell.\n Then, running `npm install @discordjs/opus` in your bot's directory should successfully build it. Woo!\n","path":"docs/general/faq.md"}}},"topics":{"name":"Topics","files":{"voice":{"name":"Voice","type":"md","content":"# Introduction to Voice\nVoice in discord.js can be used for many things, such as music bots, recording or relaying audio.\n\nIn discord.js, you can use voice by connecting to a `VoiceChannel` to obtain a `VoiceConnection`, where you can start streaming and receiving audio.\n\nTo get started, make sure you have:\n* FFmpeg - `npm install ffmpeg-binaries`\n* an opus encoder, choose one from below:\n * `npm install opusscript`\n * `npm install @discordjs/opus`\n* a good network connection\n\nThe preferred opus engine is @discordjs/opus, as it performs significantly better than opusscript. When both are available, discord.js will automatically choose @discordjs/opus.\nUsing opusscript is only recommended for development environments where @discordjs/opus is tough to get working.\nFor production bots, using @discordjs/opus should be considered a necessity, especially if they're going to be running on multiple servers.\n\n## Joining a voice channel\nThe example below reacts to a message and joins the sender's voice channel, catching any errors. This is important\nas it allows us to obtain a `VoiceConnection` that we can start to stream audio with.\n\n```js\nconst Discord = require('discord.js');\nconst client = new Discord.Client();\n\nclient.login('token here');\n\nclient.on('message', message => {\n // Voice only works in guilds, if the message does not come from a guild,\n // we ignore it\n if (!message.guild) return;\n\n if (message.content === '/join') {\n // Only try to join the sender's voice channel if they are in one themselves\n if (message.member.voiceChannel) {\n message.member.voiceChannel.join()\n .then(connection => { // Connection is an instance of VoiceConnection\n message.reply('I have successfully connected to the channel!');\n })\n .catch(console.log);\n } else {\n message.reply('You need to join a voice channel first!');\n }\n }\n});\n```\n\n## Streaming to a Voice Channel\nIn the previous example, we looked at how to join a voice channel in order to obtain a `VoiceConnection`. Now that we\nhave obtained a voice connection, we can start streaming audio to it. The following example shows how to stream an mp3\nfile:\n\n**Playing a file:**\n```js\n// To play a file, we need to give an absolute path to it\nconst dispatcher = connection.playFile('C:/Users/Discord/Desktop/myfile.mp3');\n```\n\nYour file doesn't have to be just an mp3; ffmpeg can convert videos and audios of many formats.\n\nThe `dispatcher` variable is an instance of a `StreamDispatcher`, which manages streaming a specific resource to a voice\nchannel. We can do many things with the dispatcher, such as finding out when the stream ends or changing the volume:\n\n```js\ndispatcher.on('end', () => {\n // The song has finished\n});\n\ndispatcher.on('error', e => {\n // Catch any errors that may arise\n console.log(e);\n});\n\ndispatcher.setVolume(0.5); // Set the volume to 50%\ndispatcher.setVolume(1); // Set the volume back to 100%\n\nconsole.log(dispatcher.time); // The time in milliseconds that the stream dispatcher has been playing for\n\ndispatcher.pause(); // Pause the stream\ndispatcher.resume(); // Carry on playing\n\ndispatcher.end(); // End the dispatcher, emits 'end' event\n```\n\nIf you have an existing [ReadableStream](https://nodejs.org/api/stream.html#stream_readable_streams),\nthis can also be used:\n\n**Playing a ReadableStream:**\n```js\nconnection.playStream(myReadableStream);\n\n// If you don't want to use absolute paths, you can use\n// fs.createReadStream to circumvent it\n\nconst fs = require('fs');\nconst stream = fs.createReadStream('./test.mp3');\nconnection.playStream(stream);\n```\n\nIt's important to note that creating a readable stream to a file is less efficient than simply using `connection.playFile()`.\n\n**Playing anything else:**\n\nFor anything else, such as a URL to a file, you can use `connection.playArbitraryInput()`. You should consult the [ffmpeg protocol documentation](https://ffmpeg.org/ffmpeg-protocols.html) to see what you can use this for.\n\n```js\n// Play an mp3 from a URL\nconnection.playArbitraryInput('http://mysite.com/sound.mp3');\n```\n\nAgain, playing a file from a URL like this is more performant than creating a ReadableStream to the file.\n\n## Advanced Topics\nsoon:tm:\n","path":"docs/topics/voice.md"},"web":{"name":"Web builds","type":"md","content":"# Web builds\nIn addition to your usual Node applications, discord.js has special distributions available that are capable of running in web browsers.\nThis is useful for client-side web apps that need to interact with the Discord API.\n[Webpack 3](https://webpack.js.org/) is used to build these.\n\n## Usage\nYou can obtain your desired version of discord.js' web build from the [webpack branch](https://github.com/discordjs/discord.js/tree/webpack) of the GitHub repository.\nThere is a file for each branch and version of the library, and the ones ending in `.min.js` are minified to substantially reduce the size of the source code.\n\nInclude the file on the page just as you would any other JS library, like so:\n```html\n\n```\n\nRather than importing discord.js with `require('discord.js')`, the entire `Discord` object is available as a global (on the `window`) object.\nThe usage of the API isn't any different from using it in Node.js.\n\n## Restrictions\n- Any voice-related functionality is unavailable, as there is currently no audio encoding/decoding capabilities without external native libraries,\n which web browsers do not support.\n- The ShardingManager cannot be used, since it relies on being able to spawn child processes for shards.\n- None of the optional packages are usable, since they're native libraries.\n\n## Example\n```html\n\n\n```\n","path":"docs/topics/web.md"}}},"examples":{"name":"Examples","files":{"ping":{"name":"Ping","type":"js","content":"/**\n * A ping pong bot, whenever you send \"ping\", it replies \"pong\".\n */\n\n// Import the discord.js module\nconst Discord = require('discord.js');\n\n// Create an instance of a Discord client\nconst client = new Discord.Client();\n\n/**\n * The ready event is vital, it means that only _after_ this will your bot start reacting to information\n * received from Discord\n */\nclient.on('ready', () => {\n console.log('I am ready!');\n});\n\n// Create an event listener for messages\nclient.on('message', message => {\n // If the message is \"ping\"\n if (message.content === 'ping') {\n // Send \"pong\" to the same channel\n message.channel.send('pong');\n }\n});\n\n// Log our bot in using the token from https://discordapp.com/developers/applications/me\nclient.login('your token here');\n","path":"docs/examples/ping.js"},"avatars":{"name":"Avatars","type":"js","content":"/**\n * Send a user a link to their avatar\n */\n\n// Import the discord.js module\nconst Discord = require('discord.js');\n\n// Create an instance of a Discord client\nconst client = new Discord.Client();\n\n/**\n * The ready event is vital, it means that only _after_ this will your bot start reacting to information\n * received from Discord\n */\nclient.on('ready', () => {\n console.log('I am ready!');\n});\n\n// Create an event listener for messages\nclient.on('message', message => {\n // If the message is \"what is my avatar\"\n if (message.content === 'what is my avatar') {\n // Send the user's avatar URL\n message.reply(message.author.avatarURL);\n }\n});\n\n// Log our bot in using the token from https://discordapp.com/developers/applications/me\nclient.login('your token here');\n","path":"docs/examples/avatars.js"},"attachments":{"name":"Attachments","type":"md","content":"# Sending Attachments\n\nIn here you'll see a few examples showing how you can send an attachment using discord.js.\n\n## Sending an attachment using a URL\n\nThere are a few ways you can do this, but we'll show you the easiest.\n\nThe following examples use [Attachment](/#/docs/main/stable/class/Attachment).\n\n```js\n// Extract the required classes from the discord.js module\nconst { Client, Attachment } = require('discord.js');\n\n// Create an instance of a Discord client\nconst client = new Client();\n\n/**\n * The ready event is vital, it means that only _after_ this will your bot start reacting to information\n * received from Discord\n */\nclient.on('ready', () => {\n console.log('I am ready!');\n});\n\nclient.on('message', message => {\n\t// If the message is '!rip'\n\tif (message.content === '!rip') {\n\t\t// Create the attachment using Attachment\n\t\tconst attachment = new Attachment('https://i.imgur.com/w3duR07.png');\n\t\t// Send the attachment in the message channel\n\t\tmessage.channel.send(attachment);\n\t}\n});\n\n// Log our bot in using the token from https://discordapp.com/developers/applications/me\nclient.login('your token here');\n```\n\nAnd here is the result:\n\n\n\nBut what if you want to send an attachment with a message content? Fear not, for it is easy to do that too! We'll recommend reading [the TextChannel's \"send\" function documentation](/#/docs/main/stable/class/TextChannel?scrollTo=send) to see what other options are available.\n\n```js\n// Extract the required classes from the discord.js module\nconst { Client, Attachment } = require('discord.js');\n\n// Create an instance of a Discord client\nconst client = new Client();\n\n/**\n * The ready event is vital, it means that only _after_ this will your bot start reacting to information\n * received from Discord\n */\nclient.on('ready', () => {\n console.log('I am ready!');\n});\n\nclient.on('message', message => {\n\t// If the message is '!rip'\n\tif (message.content === '!rip') {\n\t\t// Create the attachment using Attachment\n\t\tconst attachment = new Attachment('https://i.imgur.com/w3duR07.png');\n\t\t// Send the attachment in the message channel with a content\n\t\tmessage.channel.send(`${message.author},`, attachment);\n\t}\n});\n\n// Log our bot in using the token from https://discordapp.com/developers/applications/me\nclient.login('your token here');\n```\n\nAnd here's the result of this one:\n\n\n\n## Sending a local file or buffer\n\nSending a local file isn't hard either! We'll be using [Attachment](/#/docs/main/stable/class/Attachment) for these examples too.\n\n```js\n// Extract the required classes from the discord.js module\nconst { Client, Attachment } = require('discord.js');\n\n// Create an instance of a Discord client\nconst client = new Client();\n\n/**\n * The ready event is vital, it means that only _after_ this will your bot start reacting to information\n * received from Discord\n */\nclient.on('ready', () => {\n console.log('I am ready!');\n});\n\nclient.on('message', message => {\n\t// If the message is '!rip'\n\tif (message.content === '!rip') {\n\t\t// Create the attachment using Attachment\n\t\tconst attachment = new Attachment('./rip.png');\n\t\t// Send the attachment in the message channel with a content\n\t\tmessage.channel.send(`${message.author},`, attachment);\n\t}\n});\n\n// Log our bot in using the token from https://discordapp.com/developers/applications/me\nclient.login('your token here');\n```\n\nThe results are the same as the URL examples:\n\n\n\nBut what if you have a buffer from an image? Or a text document? Well, it's the same as sending a local file or a URL!\n\nIn the following example, we'll be getting the buffer from a `memes.txt` file, and send it in the message channel.\nYou can use any buffer you want, and send it. Just make sure to overwrite the filename if it isn't an image!\n\n```js\n// Extract the required classes from the discord.js module\nconst { Client, Attachment } = require('discord.js');\n\n// Import the native fs module\nconst fs = require('fs');\n\n// Create an instance of a Discord client\nconst client = new Client();\n\n/**\n * The ready event is vital, it means that only _after_ this will your bot start reacting to information\n * received from Discord\n */\nclient.on('ready', () => {\n console.log('I am ready!');\n});\n\nclient.on('message', message => {\n\t// If the message is '!memes'\n\tif (message.content === '!memes') {\n\t\t// Get the buffer from the 'memes.txt', assuming that the file exists\n\t\tconst buffer = fs.readFileSync('./memes.txt');\n\n\t\t/**\n\t\t * Create the attachment using Attachment,\n\t\t * overwritting the default file name to 'memes.txt'\n\t\t * Read more about it over at\n\t\t * http://discord.js.org/#/docs/main/stable/class/Attachment\n\t\t */\n\t\tconst attachment = new Attachment(buffer, 'memes.txt');\n\t\t// Send the attachment in the message channel with a content\n\t\tmessage.channel.send(`${message.author}, here are your memes!`, attachment);\n\t}\n});\n\n// Log our bot in using the token from https://discordapp.com/developers/applications/me\nclient.login('your token here');\n```\n\nAnd of course, the results are:\n\n\n","path":"docs/examples/attachments.md"},"greeting":{"name":"Server greeting","type":"js","content":"/**\n * A bot that welcomes new guild members when they join\n */\n\n// Import the discord.js module\nconst Discord = require('discord.js');\n\n// Create an instance of a Discord client\nconst client = new Discord.Client();\n\n/**\n * The ready event is vital, it means that only _after_ this will your bot start reacting to information\n * received from Discord\n */\nclient.on('ready', () => {\n console.log('I am ready!');\n});\n\n// Create an event listener for new guild members\nclient.on('guildMemberAdd', member => {\n // Send the message to a designated channel on a server:\n const channel = member.guild.channels.find(ch => ch.name === 'member-log');\n // Do nothing if the channel wasn't found on this server\n if (!channel) return;\n // Send the message, mentioning the member\n channel.send(`Welcome to the server, ${member}`);\n});\n\n// Log our bot in using the token from https://discordapp.com/developers/applications/me\nclient.login('your token here');\n","path":"docs/examples/greeting.js"},"embed":{"name":"Message Embed","type":"js","content":"/**\n * An example of how you can send embeds\n */\n\n// Extract the required classes from the discord.js module\nconst { Client, RichEmbed } = require('discord.js');\n\n// Create an instance of a Discord client\nconst client = new Client();\n\n/**\n * The ready event is vital, it means that only _after_ this will your bot start reacting to information\n * received from Discord\n */\nclient.on('ready', () => {\n console.log('I am ready!');\n});\n\nclient.on('message', message => {\n // If the message is \"how to embed\"\n if (message.content === 'how to embed') {\n // We can create embeds using the MessageEmbed constructor\n // Read more about all that you can do with the constructor\n // over at https://discord.js.org/#/docs/main/stable/class/RichEmbed\n const embed = new RichEmbed()\n // Set the title of the field\n .setTitle('A slick little embed')\n // Set the color of the embed\n .setColor(0xFF0000)\n // Set the main content of the embed\n .setDescription('Hello, this is a slick embed!');\n // Send the embed to the same channel as the message\n message.channel.send(embed);\n }\n});\n\n// Log our bot in using the token from https://discordapp.com/developers/applications/me\nclient.login('your token here');\n","path":"docs/examples/embed.js"},"moderation":{"name":"Moderation","type":"md","content":"# Moderation\n\nIn here, you'll see some basic examples for kicking and banning a member.\n\n## Kicking a member\n\nLet's say you have a member that you'd like to kick. Here is an example of how you *can* do it.\n\n```js\n// Import the discord.js module\nconst Discord = require('discord.js');\n\n// Create an instance of a Discord client\nconst client = new Discord.Client();\n\n/**\n * The ready event is vital, it means that only _after_ this will your bot start reacting to information\n * received from Discord\n */\nclient.on('ready', () => {\n console.log('I am ready!');\n});\n\nclient.on('message', message => {\n // Ignore messages that aren't from a guild\n if (!message.guild) return;\n\n // If the message content starts with \"!kick\"\n if (message.content.startsWith('!kick')) {\n // Assuming we mention someone in the message, this will return the user\n // Read more about mentions over at https://discord.js.org/#/docs/main/stable/class/MessageMentions\n const user = message.mentions.users.first();\n // If we have a user mentioned\n if (user) {\n // Now we get the member from the user\n const member = message.guild.member(user);\n // If the member is in the guild\n if (member) {\n /**\n * Kick the member\n * Make sure you run this on a member, not a user!\n * There are big differences between a user and a member\n */\n member.kick('Optional reason that will display in the audit logs').then(() => {\n // We let the message author know we were able to kick the person\n message.reply(`Successfully kicked ${user.tag}`);\n }).catch(err => {\n // An error happened\n // This is generally due to the bot not being able to kick the member,\n // either due to missing permissions or role hierarchy\n message.reply('I was unable to kick the member');\n // Log the error\n console.error(err);\n });\n } else {\n // The mentioned user isn't in this guild\n message.reply('That user isn\\'t in this guild!');\n }\n // Otherwise, if no user was mentioned\n } else {\n message.reply('You didn\\'t mention the user to kick!');\n }\n }\n});\n\n// Log our bot in using the token from https://discordapp.com/developers/applications/me\nclient.login('your token here');\n```\n\nAnd the result is:\n\n\n\n## Banning a member\n\nBanning works the same way as kicking, but it has slightly more options that can be changed.\n\n```js\n// Import the discord.js module\nconst Discord = require('discord.js');\n\n// Create an instance of a Discord client\nconst client = new Discord.Client();\n\n/**\n * The ready event is vital, it means that only _after_ this will your bot start reacting to information\n * received from Discord\n */\nclient.on('ready', () => {\n console.log('I am ready!');\n});\n\nclient.on('message', message => {\n // Ignore messages that aren't from a guild\n if (!message.guild) return;\n\n // if the message content starts with \"!ban\"\n if (message.content.startsWith('!ban')) {\n // Assuming we mention someone in the message, this will return the user\n // Read more about mentions over at https://discord.js.org/#/docs/main/stable/class/MessageMentions\n const user = message.mentions.users.first();\n // If we have a user mentioned\n if (user) {\n // Now we get the member from the user\n const member = message.guild.member(user);\n // If the member is in the guild\n if (member) {\n /**\n * Ban the member\n * Make sure you run this on a member, not a user!\n * There are big differences between a user and a member\n * Read more about what ban options there are over at\n * https://discord.js.org/#/docs/main/stable/class/GuildMember?scrollTo=ban\n */\n member.ban({\n reason: 'They were bad!',\n }).then(() => {\n // We let the message author know we were able to ban the person\n message.reply(`Successfully banned ${user.tag}`);\n }).catch(err => {\n // An error happened\n // This is generally due to the bot not being able to ban the member,\n // either due to missing permissions or role hierarchy\n message.reply('I was unable to ban the member');\n // Log the error\n console.error(err);\n });\n } else {\n // The mentioned user isn't in this guild\n message.reply('That user isn\\'t in this guild!');\n }\n } else {\n // Otherwise, if no user was mentioned\n message.reply('You didn\\'t mention the user to ban!');\n }\n }\n});\n\n// Log our bot in using the token from https://discordapp.com/developers/applications/me\nclient.login('your token here');\n```\n\nAnd the result is:\n\n\n","path":"docs/examples/moderation.md"},"webhook":{"name":"Webhook","type":"js","content":"/**\n * Send a message using a webhook\n */\n\n// Import the discord.js module\nconst Discord = require('discord.js');\n\n// Create a new webhook\nconst hook = new Discord.WebhookClient('webhook id', 'webhook token');\n\n// Send a message using the webhook\nhook.send('I am now alive!');\n","path":"docs/examples/webhook.js"}}}},"classes":[{"name":"Client","description":"The main hub for interacting with the Discord API, and the starting point for any bot.","extends":[[["EventEmitter"]]],"construct":{"name":"Client","params":[{"name":"options","description":"Options for the client","optional":true,"type":[[["ClientOptions"]]]}]},"props":[{"name":"options","description":"The options the client was instantiated with","type":[[["ClientOptions"]]],"meta":{"line":36,"file":"Client.js","path":"src/client"}},{"name":"rest","description":"The REST manager of the client","access":"private","type":[[["RESTManager"]]],"meta":{"line":44,"file":"Client.js","path":"src/client"}},{"name":"dataManager","description":"The data manager of the client","access":"private","type":[[["ClientDataManager"]]],"meta":{"line":51,"file":"Client.js","path":"src/client"}},{"name":"manager","description":"The manager of the client","access":"private","type":[[["ClientManager"]]],"meta":{"line":58,"file":"Client.js","path":"src/client"}},{"name":"ws","description":"The WebSocket manager of the client","access":"private","type":[[["WebSocketManager"]]],"meta":{"line":65,"file":"Client.js","path":"src/client"}},{"name":"resolver","description":"The data resolver of the client","access":"private","type":[[["ClientDataResolver"]]],"meta":{"line":72,"file":"Client.js","path":"src/client"}},{"name":"actions","description":"The action manager of the client","access":"private","type":[[["ActionsManager"]]],"meta":{"line":79,"file":"Client.js","path":"src/client"}},{"name":"voice","description":"The voice manager of the client (`null` in browsers)","access":"private","nullable":true,"type":[[["ClientVoiceManager"]]],"meta":{"line":86,"file":"Client.js","path":"src/client"}},{"name":"shard","description":"The shard helpers for the client\n(only if the process was spawned as a child, such as from a {@link ShardingManager})","nullable":true,"type":[[["ShardClientUtil"]]],"meta":{"line":93,"file":"Client.js","path":"src/client"}},{"name":"users","description":"All of the {@link User} objects that have been cached at any point, mapped by their IDs","type":[[["Collection","<"],["Snowflake",", "],["User",">"]]],"meta":{"line":99,"file":"Client.js","path":"src/client"}},{"name":"guilds","description":"All of the guilds the client is currently handling, mapped by their IDs -\nas long as sharding isn't being used, this will be *every* guild the bot is a member of","type":[[["Collection","<"],["Snowflake",", "],["Guild",">"]]],"meta":{"line":106,"file":"Client.js","path":"src/client"}},{"name":"channels","description":"All of the {@link Channel}s that the client is currently handling, mapped by their IDs -\nas long as sharding isn't being used, this will be *every* channel in *every* guild, and all DM channels","type":[[["Collection","<"],["Snowflake",", "],["Channel",">"]]],"meta":{"line":113,"file":"Client.js","path":"src/client"}},{"name":"presences","description":"Presences that have been received for the client user's friends, mapped by user IDs\n