mirror of
https://github.com/discordeno/discordeno.git
synced 2026-05-29 15:00:07 +00:00
18 lines
502 B
TypeScript
18 lines
502 B
TypeScript
import { GatewayManager } from "./gateway_manager.ts";
|
|
import { DiscordenoShard, WebSocketRequest } from "./shard.ts";
|
|
|
|
export function sendShardMessage(
|
|
gateway: GatewayManager,
|
|
shard: number | DiscordenoShard,
|
|
message: WebSocketRequest,
|
|
highPriority = false,
|
|
) {
|
|
if (typeof shard === "number") shard = gateway.shards.get(shard)!;
|
|
if (!shard) return;
|
|
|
|
if (highPriority) shard.queue.unshift(message);
|
|
else shard.queue.push(message);
|
|
|
|
gateway.processGatewayQueue(gateway, shard.id);
|
|
}
|