-
-
Notifications
You must be signed in to change notification settings - Fork 4k
feat(guide): port legacy guide #10938
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
698d2f8
to
32a1058
Compare
* top link should be installation * add docs link to sidebar
apps/guide/content/docs/legacy/app-creation/handling-events.mdx
Outdated
Show resolved
Hide resolved
style={ | ||
{ | ||
color, | ||
backgroundColor: `color-mix(in oklab, ${color} 10%, transparent)`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couldn't this be a CSS class instead? To have all styling in one place instead of mixed into the code here.
- How to get a bot [up and running](/guide/legacy/preparations/app-setup) from scratch; | ||
- How to properly [create](/guide/legacy/app-creation/project-setup), [organize](/guide/legacy/app-creation/handling-commands), and expand on your commands; | ||
- In-depth explanations and examples regarding popular topics (e.g. [components](/guide/legacy/popular-topics/display-components) ,[reactions](/guide/legacy/popular-topics/reactions), [embeds](/guide/legacy/popular-topics/embeds), [canvas](/guide/legacy/popular-topics/canvas)); | ||
- Working with databases (e.g. [sequelize](/guide/legacy/sequelize/) and [keyv](/guide/legacy/keyv/)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Working with databases (e.g. [sequelize](/guide/legacy/sequelize/) and [keyv](/guide/legacy/keyv/)); | |
- Working with databases (e.g. [sequelize](./sequelize/) and [keyv](./keyv/keyv)); |
|
||
<Callout> | ||
If you want to learn more about reactions, check out [this dedicated guide on | ||
reactions](/guide/legacy/popular-topics/reactions.md)! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reactions](/guide/legacy/popular-topics/reactions.md)! | |
reactions](./reactions)! |
{ | ||
"pages": [ | ||
"[Info][Introduction](/guide/legacy)", | ||
"[MessageCircleQuestion][FAQ](/guide/legacy/popular-topics/faq)", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd move this down, as it feels weird when using the "Next page" navigation in the guide to go from introduction to FAQ. I always felt the same on the old guide, it should jump right into the actual "Getting Started" instead of information that a new user won't need/understand.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
true, but also the POI people will be trying to find - and if just to reference - when visiting the guide
|
||
<Callout title="Danger" type="error"> | ||
If you're using Git, you should not commit this file and should [ignore it via | ||
`.gitignore`](/creating-your-bot/#git-and-gitignore). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
`.gitignore`](/creating-your-bot/#git-and-gitignore). | |
`.gitignore`](#git-and-gitignore). |
<Callout> | ||
You can find the methods available for the ShardingManager class `ShardingManager`. Though, you may not be making much | ||
use of this section, unlike the next feature we will explore, which you may learn about by clicking [this | ||
link](/sharding/additional-information.md). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
link](/sharding/additional-information.md). | |
link](./additional-information). |
<Callout> | ||
**Voice connections can be subscribed to one audio player at most.** If you try to subscribe to another audio player while already subscribed to one, the current audio player is unsubscribed and replaced with the new one. | ||
|
||
It is also worth noting that the **GuildVoiceStates** [gateway intent](/popular-topics/intents.md#gateway-intents) is required. Without it, the connection will permanently stay in the `signalling` state, and you'll be unable to play audio. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is also worth noting that the **GuildVoiceStates** [gateway intent](/popular-topics/intents.md#gateway-intents) is required. Without it, the connection will permanently stay in the `signalling` state, and you'll be unable to play audio. | |
It is also worth noting that the **GuildVoiceStates** [gateway intent](/guide/legacy/popular-topics/intents#gateway-intents) is required. Without it, the connection will permanently stay in the `signalling` state, and you'll be unable to play audio. |
|
||
## Life cycle | ||
|
||
Voice connections have their own life cycle, with five distinct states. You can follow the methods discussed in the [life cycles](/voice/life-cycles.md) section to subscribe to changes to voice connections. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Voice connections have their own life cycle, with five distinct states. You can follow the methods discussed in the [life cycles](/voice/life-cycles.md) section to subscribe to changes to voice connections. | |
Voice connections have their own life cycle, with five distinct states. You can follow the methods discussed in the [life cycles](./life-cycles) section to subscribe to changes to voice connections. |
|
||
### Playing audio | ||
|
||
You can create [audio resources](./audio-resources.md) and then play them on an audio player. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can create [audio resources](./audio-resources.md) and then play them on an audio player. | |
You can create [audio resources](./audio-resources) and then play them on an audio player. |
|
||
## Life cycle | ||
|
||
Voice connections have their own life cycle, with five distinct states. You can follow the methods discussed in the [life cycles](/voice/life-cycles.md) section to subscribe to changes to voice connections. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Voice connections have their own life cycle, with five distinct states. You can follow the methods discussed in the [life cycles](/voice/life-cycles.md) section to subscribe to changes to voice connections. | |
Voice connections have their own life cycle, with five distinct states. You can follow the methods discussed in the [life cycles](./life-cycles) section to subscribe to changes to voice connections. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #10938 +/- ##
=======================================
Coverage 42.69% 42.70%
=======================================
Files 262 262
Lines 16086 16084 -2
Branches 1545 1543 -2
=======================================
Hits 6868 6868
+ Misses 9206 9204 -2
Partials 12 12
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
- Whitelist -> Allowlist | ||
- Blacklist -> Denylist |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not a fan of this butchering to have 1 word that represents a list of allowed/disallowed values, imo a phrase is better but 🤷
Spam is something you generally want to avoid, especially if one of your commands require calls to other APIs or takes a bit of time to build/send. | ||
|
||
<Callout> | ||
This section assumes you followed the [Command Handling](/guide/legacy/app-creation/handling-commands) part of the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we use relative paths wherever possible?
When writing your commands, you may find it tedious to restart your bot every time for testing the smallest changes. With a command handler, you can eliminate this issue and reload your commands while your bot is running. | ||
|
||
<Callout> | ||
ESM does not support require and clearing import cache. You can use [hot-esm](https://www.npmjs.com/package/hot-esm) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean there's always import(`./file.mjs?d=${Date.now()}`)
but that has the disadvantage of leaking small amounts of memory per reload
<File name="packge-lock.json" /> | ||
<File name="packge.json" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Find packge
-> replace package
|
||
Environment variables are special values for your environment (e.g., terminal session, Docker container, or environment variable file). You can pass these values into your code's scope so that you can use them. | ||
|
||
One way to pass in environment variables is via the command line interface. When starting your app, instead of `node index.js`, use `TOKEN=your-token-goes-here node index.js`. You can repeat this pattern to expose other values as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep in mind this will only work on unix systems. Windows will throw if you try this, maybe we can add a callout for using cross-env?
<Cards> | ||
<Card icon={<Grid2x2 />} title="Windows"> | ||
Download the latest version from [the Node.js website](https://nodejs.org/), open the downloaded file, and follow | ||
the steps from the installer. | ||
</Card> | ||
<Card icon={<Apple />} title="macOS"> | ||
Download the latest version from [the Node.js website](https://nodejs.org/), open the package installer, and follow | ||
the instructions - Use a package manager like [Homebrew](https://brew.sh/) with the command `brew install node` | ||
</Card> | ||
<Card icon={<Cpu />} title="Linux"> | ||
Consult [this page](https://nodejs.org/en/download/package-manager/) to determine how you should install Node. | ||
</Card> | ||
</Cards> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this is for legacy docs but I feel like even here we should point people towards fnm/volta/nvm
```sh tab="npm" | ||
npm install @discordjs/voice libsodium-wrappers | ||
``` | ||
|
||
```sh tab="yarn" | ||
yarn add @discordjs/voice libsodium-wrappers | ||
``` | ||
|
||
```sh tab="pnpm" | ||
pnpm add @discordjs/voice libsodium-wrappers | ||
``` | ||
|
||
```sh tab="bun" | ||
bun add @discordjs/voice libsodium-wrappers | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- An Opus encoding library | ||
- [`@discordjs/opus`](https://github.com/discordjs/opus) (best performance) | ||
- [`opusscript`](https://github.com/abalabahaha/opusscript/) | ||
- FFmpeg – allows you to play a range of media (e.g. MP3s). | ||
- [`ffmpeg`](https://ffmpeg.org/) - install and add to your system environment | ||
- [`ffmpeg-static`](https://www.npmjs.com/package/ffmpeg-static) - to install FFmpeg via npm | ||
- Encryption packages | ||
- [`sodium`](https://www.npmjs.com/package/sodium) (best performance) | ||
- [`sodium-native`](https://www.npmjs.com/package/sodium-native) | ||
- [`libsodium-wrappers`](https://www.npmjs.com/package/libsodium-wrappers) | ||
- [`tweetnacl`](https://www.npmjs.com/package/tweetnacl) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs an update to add the new libs supported
If you're struggling to install these dependencies, make sure you have build tools installed first. On Windows, this is as easy as running the following command! | ||
|
||
```sh tab="npm" | ||
npm install --global --production --add-python-to-path windows-build-tools | ||
``` | ||
|
||
```sh tab="yarn" | ||
yarn global add --production --add-python-to-path windows-build-tools | ||
``` | ||
|
||
```sh tab="pnpm" | ||
pnpm add --global --production --add-python-to-path windows-build-tools | ||
``` | ||
|
||
```sh tab="bun" | ||
bun add --global --production --add-python-to-path windows-build-tools | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should not recommend this anymore, instead just telling users to install vs with c++ (winget install "Visual Studio Community 2022" --override "--add Microsoft.VisualStudio.Workload.NativeDesktop " -s msstore
) and python
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But its also not required since some modules have prebuilts, and most systems have aed encryption already and will work out of the box
{ | ||
color, | ||
backgroundColor: `color-mix(in oklab, ${color} 10%, transparent)`, | ||
} as object |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This cast feels redundant, it is an object, whats the ts error without it?
Co-authored-by: Naiyar <137700126+imnaiyar@users.noreply.github.com>
Initial release:
/guide/legacy/category/page.mdx
Considerations:
Note
serves
/guide/legacy
and/guide/voice