feat(guide): port remaining prs/issues from legacy (#10974)

* chore: remove await wait placeholder

prefer using an explanatory placeholder rather than this artificial
example
original issue: https://github.com/discordjs/guide/issues/1360

* chore: remove implicit grant guide and add disclaimer

issue: https://github.com/discordjs/guide/issues/1370/
pr: https://github.com/discordjs/guide/pull/1543/

* chore(sharding): improve broadcast sample and use of context argument

original PR: https://github.com/discordjs/guide/pull/1624

* feat: add page about setup with proxy

original PR: https://github.com/discordjs/guide/pull/1623

* chore: clarify hiding of commands

original PR: https://github.com/discordjs/guide/pull/1617

* feat(voice): seeking

original PR: https://github.com/discordjs/guide/pull/1483

* chore(oauth2): typo

* chore: align with rest of the guide

remove abstraction layers in ws proxy handling in favour of directly setting globals

* chore: branding over grammar

* Apply suggestions from code review

Co-authored-by: Qjuh <76154676+Qjuh@users.noreply.github.com>

* chore: remove now obsolete example explanation from comments

---------

Co-authored-by: Qjuh <76154676+Qjuh@users.noreply.github.com>
This commit is contained in:
Souji
2025-07-12 02:13:54 +02:00
committed by GitHub
parent 1f0fe39156
commit 591668099e
8 changed files with 162 additions and 64 deletions

View File

@@ -79,14 +79,24 @@ You can access them later as usual via `process.argv`, which contains an array o
## Eval arguments
There may come the point where you will want to pass arguments from the outer scope into a `.broadcastEval()` call.
There may come the point where you will want to pass arguments from the outer scope into a `.broadcastEval()` call. The `context` parameter is useful for this purpose.
```js
function funcName(c, { arg }) {
// [!code word:context]
function funcName(client, context) {
// ...
}
client.shard.broadcastEval(funcName, { context: { arg: 'arg' } });
// Evaluate on all shards
client.shard.broadcastEval(funcName, {
context: { arg: 'arg' },
});
// Evaluate on a specific shard
client.shard.broadcastEval(funcName, {
shard: 0,
context: { arg: 'arg' },
});
```
The `BroadcastEvalOptions` typedef was introduced in discord.js v13 as the second parameter in `.broadcastEval()`. It accepts two properties: `shard` and `context`. The `context` property will be sent as the second argument to your function.