You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: apps/guide/src/content/01-home/01-introduction.mdx
+8-11Lines changed: 8 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,15 +8,12 @@ category: Home
8
8
If you're reading this, it probably means you want to learn how to make a bot with discord.js. Awesome! You've come to the right place.
9
9
This guide will teach you things such as:
10
10
11
-
- How to get a bot [up and running](/preparations/) from scratch;
12
-
- How to properly [create](/creating-your-bot/), [organize](/creating-your-bot/handling-command-interactions.md), and expand on your commands;
13
-
- In-depth explanations and examples regarding popular topics (e.g. [reactions](/popular-topics/reactions.md), [embeds](/popular-topics/embeds.md), [canvas](/popular-topics/canvas.md));
14
-
- Working with databases (e.g. [sequelize](/sequelize/) and [keyv](/keyv/));
15
-
- Getting started with [sharding](/sharding/);
11
+
- How to get a bot [up and running](../getting-started/starting-out) from scratch;
12
+
- In-depth explanations regarding features and concepts of the API (e.g. [intents](../topics/intents), [threads](../topics/threads), [webhooks](../topics/webhooks));
16
13
- And much more.
17
14
18
15
This guide will also cover subjects like common errors and how to solve them, keeping your code clean, setting up a proper development environment, etc.
19
-
Sounds good? Great! Let's get started, then.
16
+
Sounds good? Great! Let's get started.
20
17
21
18
## Before you begin...
22
19
@@ -25,11 +22,11 @@ While you _can_ make a bot with very little JavaScript and programming knowledge
25
22
26
23
If you don't know JavaScript but would like to learn about it, here are a few links to help get you started:
27
24
28
-
-[Eloquent JavaScript, a free online book](http://eloquentjavascript.net/)
29
-
-[JavaScript.info, a modern javascript tutorial](https://javascript.info/)
Copy file name to clipboardExpand all lines: apps/guide/src/content/01-home/02-whats-new.mdx
+4-22Lines changed: 4 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,9 +21,7 @@ category: Home
21
21
time: 'Today at 21:00',
22
22
}}
23
23
>
24
-
discord.js v14 has released and the guide has been updated!
25
-
<br />
26
-
This includes additions and changes made in Discord, such as slash commands and message components.
24
+
This website is new! We will no longer be updating the old guide website.
27
25
</DiscordMessage>
28
26
</DiscordMessages>
29
27
@@ -33,25 +31,9 @@ We have moved from VuePress to [Next.js](https://nextjs.org/)! The source can be
33
31
34
32
## Pages
35
33
36
-
All content has been updated to use discord.js v14 syntax. The v13 version of the guide can be found at https://v13.discordjs.guide.
37
-
38
-
### New
39
-
40
-
-[Updating from v13 to v14](/additional-info/changes-in-v14.md): A list of the changes from discord.js v13 to v14
41
-
-[Slash commands](/interactions/slash-commands.md): Registering, replying to slash commands and permissions
42
-
-[Buttons](/interactions/buttons.md): Building, sending, and receiving buttons
43
-
-[Select menus](/interactions/select-menus.md): Building, sending, and receiving select menus
44
-
-[Threads](/popular-topics/threads.md): Creating and managing threads
45
-
-[Builders](/popular-topics/builders.md): A collection of builders to use with your bot
46
-
47
-
### Updated
48
-
49
-
- Commando: Replaced with [Sapphire](https://sapphirejs.dev/docs/Guide/getting-started/getting-started-with-sapphire)
50
-
-[Voice](/voice/): Rewritten to use the [_`@discordjs/voice`_](https://github.com/discordjs/discord.js/tree/main/packages/voice) package
51
-
-[Command handling](/creating-your-bot/handling-command-interactions.md/): Updated to use slash commands
52
-
- Obsolete sections removed
53
-
-_`client.on('message')`_ snippets updated to _`client.on(Events.InteractionCreate)`_
54
-
-[Message content became a privileged intent on August 31, 2022](https://support-dev.discord.com/hc/articles/4404772028055)
34
+
- Pages have been revamped to account for our new [create-discord-bot](https://github.com/discordjs/discord.js/tree/main/packages/create-discord-bot) command-line interface.
35
+
- Popular topic are now simply "topics" that detail usage of a particular concept of the API.
36
+
- Focus is primarily on discord.js, so irrelevant topics have been removed. It may be better to visit the documentation of the package you are using to learn how to use them.
Copy file name to clipboardExpand all lines: apps/guide/src/content/01-home/03-how-to-contribute.mdx
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,16 +7,16 @@ category: Home
7
7
8
8
Since this guide is made specifically for the discord.js community, we want to be sure to provide the most relevant and up-to-date content. We will, of course, make additions to the current pages and add new ones as we see fit, but fulfilling requests is how we know we're providing content you all want the most.
9
9
10
-
Requests may be as simple as "add an example to the [frequently asked questions](/popular-topics/faq.html) page", or as elaborate as "add a page regarding [sharding](/sharding/)". We'll do our best to fulfill all requests, as long as they're reasonable.
10
+
Requests may be as simple as "add an example to the [frequently asked questions](../topics/frequently-asked-questions) page", or as elaborate as "add a page regarding [sharding](../topics/sharding)". We'll do our best to fulfill all requests, as long as they're reasonable.
11
11
12
12
To make a request, simply head over to [the repository's issue tracker](https://github.com/discordjs/discord.js/issues) and [create a new issue](https://github.com/discordjs/discord.js/issues/new)! Title it appropriately, and let us know exactly what you mean inside the issue description. Make sure that you've looked around the site before making a request; what you want to request might already exist!
13
13
14
-
<Alerttitle="Tip"type="success">
14
+
<Alerttitle="Tip"type="info">
15
15
Remember that you can always [fork the repository](https://github.com/discordjs/discord.js/fork) and [make a pull
16
16
request](https://github.com/discordjs/discord.js/pulls) if you want to add anything to the guide yourself!
17
17
</Alert>
18
18
19
-
We'll also get into some of the more advanced features this guide does below.
19
+
We'll also get into some of the more advanced features this guide uses below. We recommended you have a look at the [source](https://github.com/discordjs/discord.js/blob/main/apps/guide/src/content/01-home/03-how-to-contribute.mdx) of this page to see exactly how they work.
Our [create-discord-bot](https://github.com/discordjs/discord.js/tree/main/packages/create-discord-bot) command-line interface sets up a basic Discord bot to help you get started on your journey.
9
+
10
+
## Creating your bot
11
+
12
+
To use discord.js, you'll need to install [Node.js](https://nodejs.org), [Deno](https://deno.com), or [Bun](https://bun.sh). discord.js v14 requires Node.js v16.11.0 or higher, but the long-term support (LTS) version is always recommended. For the purposes of this guide, we will be using Node.js.
13
+
14
+
<Alerttitle="Tip"type="info">
15
+
To check if you already have Node.js installed, run _`node --version`_ in your terminal. If it outputs _`v16.11.0`_ or
16
+
higher, then you're good to go!
17
+
</Alert>
18
+
19
+
### Windows
20
+
21
+
- Download from the [Node.js website](https://nodejs.org).
22
+
- Use [fnm](https://github.com/Schniz/fnm).
23
+
- Use [Volta](https://volta.sh).
24
+
25
+
### macOS
26
+
27
+
- Download from the [Node.js website](https://nodejs.org/).
28
+
- Use [fnm](https://github.com/Schniz/fnm).
29
+
- Use [Homebrew](https://formulae.brew.sh/formula/node).
30
+
- Use [nvm](https://github.com/nvm-sh/nvm?tab=readme-ov-file#installing-and-updating).
31
+
- Use [Volta](https://volta.sh).
32
+
33
+
### Linux
34
+
35
+
- Visit [this page](https://nodejs.org/en/download/package-manager) to determine how you should install Node.js.
36
+
- Use [fnm](https://github.com/Schniz/fnm).
37
+
- Use [nvm](https://github.com/nvm-sh/nvm).
38
+
- Use [Volta](https://volta.sh).
39
+
40
+
After installing Node.js, you'll be able to create a new application from your desired package manager. If you're starting out fresh, installing Node.js will also install npm, a package manager for Node.js.
41
+
42
+
<CH.CodelineNumbers={false}showCopyButton={true}>
43
+
44
+
```sh npm
45
+
npm create discord-bot
46
+
```
47
+
48
+
```sh yarn
49
+
yarn create discord-bot
50
+
```
51
+
52
+
```sh pnpm
53
+
pnpm create discord-bot
54
+
```
55
+
56
+
```sh bun
57
+
bun create discord-bot
58
+
```
59
+
60
+
</CH.Code>
61
+
62
+
You'll be asked the directory to create the application in, as well as whether TypeScript should be used. Dependencies will automatically be installed for you. After this, you've just got your startup Discord bot template _nearly_ ready!
63
+
64
+
In the next section, we will explain how to create an application to interact with Discord's API.
Copy file name to clipboardExpand all lines: apps/guide/src/content/02-getting-started/02-setting-up-an-application.mdx
+15-12Lines changed: 15 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,25 +1,28 @@
1
1
---
2
-
title: Setting up a bot application
3
-
category: Installations and preparations
2
+
title: Setting up an application
3
+
category: Getting started
4
4
---
5
5
6
-
# Setting up a bot application
6
+
# Setting up an application
7
7
8
-
## Creating your bot
8
+
You'll need to create an application on Discord's developer portal so your bot has a token to interact with Discord's API.
9
9
10
-
Now that you've installed Node, discord.js, and hopefully a linter, you're almost ready to start coding! The next step you need to take is setting up an actual Discord bot application via Discord's website.
10
+
## Creating the application
11
11
12
-
It's effortless to create one. The steps you need to take are as follows:
12
+
Follow these steps:
13
13
14
-
1. Open the [Discord developer portal](https://discord.com/developers/applications) and log into your account.
14
+
1. Open the [Discord developer portal](https://discord.com/developers/applications). You'll need to be logged in.
15
15
2. Click on the "New Application" button.
16
16
3. Enter a name and confirm the pop-up window by clicking the "Create" button.
17
+
- You'll need to agree to the [Developer Terms of Service](https://discord.com/developers/docs/policies-and-agreements/terms-of-service) and [Developer Policy](https://discord.com/developers/docs/policies-and-agreements/developer-policy).
17
18
18
19
You should see a page like this:
19
20
20
21

21
22
22
-
You can edit your application's name, description, and avatar here. Once you've saved your changes, move on by selecting the "Bot" tab in the left pane.
23
+
You can edit your application's name, description, and avatar here. Copy the application id and paste it in the .env file after _`APPLICATION_ID=`_.
24
+
25
+
Once you've saved your changes, move on by selecting the "Bot" tab in the left pane.
23
26
24
27
## Your bot's token
25
28
@@ -32,9 +35,11 @@ On the bot tab, you'll see a section like this:
32
35
33
36

34
37
35
-
In this panel, you can give your bot a snazzy avatar, set its username, and make it public or private. Your bot's token will be revealed when you press the "Reset Token" button and confirm. When we ask you to paste your bot's token somewhere, this is the value that you need to put in. If you happen to lose your bot's token at some point, you need to come back to this page and reset your bot's token again which will reveal the new token, invalidating all old ones.
38
+
In this panel, you can give your bot a snazzy avatar, set its username, and make it public or private. Your bot's token will be revealed when you press the "Reset Token" button and confirm. Once you've done this, copy it and paste it in the .env file after _`DISCORD_TOKEN=`_.
39
+
40
+
If you happen to lose this token at some point, you will need to come back to this page and reset it, which will reveal the new token, invalidating all old ones.
36
41
37
-
### What is a token, anyway?
42
+
### Bot token explanation
38
43
39
44
A token is essentially your bot's password; it's what your bot uses to login to Discord. With that said, **it is vital that you do not ever share this token with anybody, purposely or accidentally**. If someone does manage to get a hold of your bot's token, they can use your bot as if it were theirs—this means they can perform malicious acts with it.
40
45
@@ -52,8 +57,6 @@ Let's imagine that you have a bot on over 1,000 servers, and it took you many, m
52
57
53
58
All that and much, much more. Sounds pretty terrible, right? So make sure to keep your bot's token as safe as possible!
54
59
55
-
In the [configuration files](../creating-your-bot/configuration-files) page of the guide, we cover how to safely store your bot's token in a configuration file.
56
-
57
60
<Alerttitle="Compromised tokens"type="danger">
58
61
If your bot token has been compromised by committing it to a public repository, posting it in discord.js support etc.
59
62
or otherwise see your bot's token in danger, return to this page and press "Reset Token". This will invalidate all old
0 commit comments