Skip to content

Commit c78d4af

Browse files
committed
chore(core): document gateway
1 parent 06f694e commit c78d4af

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

packages/core/src/Gateway.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,20 @@ import type { Awaitable } from '@discordjs/util';
22
import type { ManagerShardEventsMap, WebSocketShardEvents } from '@discordjs/ws';
33
import type { GatewaySendPayload } from 'discord-api-types/v10';
44

5+
/**
6+
* A Discord gateway-like interface that can be used to send & recieve events.
7+
*/
58
export interface Gateway {
9+
/**
10+
* Gets how many shards your bot is running.
11+
*/
612
getShardCount(): Awaitable<number>;
713
on(
814
event: WebSocketShardEvents.Dispatch,
915
listener: (...params: ManagerShardEventsMap[WebSocketShardEvents.Dispatch]) => Awaitable<void>,
1016
): this;
17+
/**
18+
* Sends a payload to the specified shard
19+
*/
1120
send(shardId: number, payload: GatewaySendPayload): Awaitable<void>;
1221
}

0 commit comments

Comments
 (0)