mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-14 10:33:30 +01:00
docs: fence examples in codeblocks
This commit is contained in:
@@ -5,7 +5,9 @@ export type Awaitable<T> = T | Promise<T>;
|
||||
/**
|
||||
* Yields the numbers in the given range as an array
|
||||
* @example
|
||||
* ```
|
||||
* range({ start: 3, end: 5 }); // [3, 4, 5]
|
||||
* ```
|
||||
*/
|
||||
export function range({ start, end }: ShardRange): number[] {
|
||||
return Array.from({ length: end - start + 1 }, (_, i) => i + start);
|
||||
|
||||
@@ -80,16 +80,21 @@ export interface OptionalWebSocketManagerOptions {
|
||||
* The ids of the shards this WebSocketManager should manage.
|
||||
* Use `null` to simply spawn 0 through `shardCount - 1`
|
||||
* @example
|
||||
* ```
|
||||
* const manager = new WebSocketManager({
|
||||
* shardIds: [1, 3, 7], // spawns shard 1, 3, and 7, nothing else
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* @example
|
||||
* ```
|
||||
* const manager = new WebSocketManager({
|
||||
* shardIds: {
|
||||
* start: 3,
|
||||
* end: 6,
|
||||
* }, // spawns shards 3, 4, 5, and 6
|
||||
* });
|
||||
* ```
|
||||
*/
|
||||
shardIds: number[] | ShardRange | null;
|
||||
/**
|
||||
@@ -122,6 +127,7 @@ export interface OptionalWebSocketManagerOptions {
|
||||
/**
|
||||
* Function used to retrieve session information (and attempt to resume) for a given shard
|
||||
* @example
|
||||
* ```
|
||||
* const manager = new WebSocketManager({
|
||||
* async retrieveSessionInfo(shardId): Awaitable<SessionInfo | null> {
|
||||
* // Fetch this info from redis or similar
|
||||
@@ -129,6 +135,7 @@ export interface OptionalWebSocketManagerOptions {
|
||||
* // Return null if no information is found
|
||||
* },
|
||||
* });
|
||||
* ```
|
||||
*/
|
||||
retrieveSessionInfo: (shardId: number) => Awaitable<SessionInfo | null>;
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user