mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-16 03:18:17 +00:00
fix(ws/shard): update status update payload (#559)
* fix(ws/shard): update status update payload * :( * Update src/types/discord.ts Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com> * it\'s activitypayload * Update src/types/discord.ts * idk * idk Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com>
This commit is contained in:
+3
-21
@@ -6,14 +6,15 @@ import {
|
||||
DiscordPayload,
|
||||
FetchMembersOptions,
|
||||
GatewayOpcode,
|
||||
GatewayStatusUpdatePayload,
|
||||
ReadyPayload,
|
||||
} from "../types/mod.ts";
|
||||
import { BotStatusRequest, delay } from "../util/utils.ts";
|
||||
import { delay } from "../util/utils.ts";
|
||||
import { decompressWith } from "./deps.ts";
|
||||
import { handleDiscordPayload } from "./shard_manager.ts";
|
||||
import { Collection } from "../util/collection.ts";
|
||||
|
||||
const basicShards = new Collection<number, BasicShard>();
|
||||
export const basicShards = new Collection<number, BasicShard>();
|
||||
const heartbeating = new Map<number, boolean>();
|
||||
const utf8decoder = new TextDecoder();
|
||||
const RequestMembersQueue: RequestMemberQueuedRequest[] = [];
|
||||
@@ -383,25 +384,6 @@ async function processGatewayQueue() {
|
||||
await processGatewayQueue();
|
||||
}
|
||||
|
||||
export function botGatewayStatusRequest(payload: BotStatusRequest) {
|
||||
basicShards.forEach((shard) => {
|
||||
sendWS({
|
||||
op: GatewayOpcode.StatusUpdate,
|
||||
d: {
|
||||
since: null,
|
||||
game: payload.game.name
|
||||
? {
|
||||
name: payload.game.name,
|
||||
type: payload.game.type,
|
||||
}
|
||||
: null,
|
||||
status: payload.status,
|
||||
afk: false,
|
||||
},
|
||||
}, shard.id);
|
||||
});
|
||||
}
|
||||
|
||||
/** Enqueues the specified data to be transmitted to the server over the WebSocket connection, */
|
||||
export function sendWS(payload: DiscordPayload, shardID = 0) {
|
||||
const shard = basicShards.get(shardID);
|
||||
|
||||
Reference in New Issue
Block a user