mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-03 05:26:07 +00:00
fix: wrong function call
This commit is contained in:
parent
5471fbb0e1
commit
54b0cb2326
2
vendor/gateway/shard/deps.ts
vendored
2
vendor/gateway/shard/deps.ts
vendored
@ -1 +1 @@
|
|||||||
export { deflate as decompressWith } from "../../zlib.js";
|
export { inflate as decompressWith } from "../../zlib.js";
|
||||||
|
11
vendor/gateway/shard/handleMessage.ts
vendored
11
vendor/gateway/shard/handleMessage.ts
vendored
@ -7,17 +7,14 @@ import { GATEWAY_RATE_LIMIT_RESET_INTERVAL, Shard, ShardState } from "./types.ts
|
|||||||
|
|
||||||
const decoder = new TextDecoder();
|
const decoder = new TextDecoder();
|
||||||
|
|
||||||
export async function handleMessage(shard: Shard, message: MessageEvent<any>): Promise<void> {
|
export async function handleMessage(shard: Shard, message_: MessageEvent<any>): Promise<void> {
|
||||||
message = message.data;
|
let message = message_.data;
|
||||||
|
|
||||||
// If message compression is enabled,
|
// If message compression is enabled,
|
||||||
// Discord might send zlib compressed payloads.
|
// Discord might send zlib compressed payloads.
|
||||||
if (shard.gatewayConfig.compress && message instanceof Blob) {
|
if (shard.gatewayConfig.compress && message instanceof Blob) {
|
||||||
message = decompressWith(
|
message = decoder.decode(decompressWith(new Uint8Array(await message.arrayBuffer())));
|
||||||
new Uint8Array(await message.arrayBuffer()),
|
console.log(message);
|
||||||
0,
|
|
||||||
(slice: Uint8Array) => decoder.decode(slice),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Safeguard incase decompression failed to make a string.
|
// Safeguard incase decompression failed to make a string.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user