mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-02 08:50:07 +00:00
change: use RAW_SEND log
This commit is contained in:
@@ -4,41 +4,46 @@ import { DiscordenoShard } from "./ws.ts";
|
||||
/** The handler for logging different actions happening inside the ws. User can override and put custom handling per event. */
|
||||
export function log(
|
||||
type: "CLOSED",
|
||||
data: { shardId: number; payload: CloseEvent },
|
||||
data: { shardId: number; payload: CloseEvent }
|
||||
): unknown;
|
||||
export function log(
|
||||
type: "CLOSED_RECONNECT",
|
||||
data: { shardId: number; payload: CloseEvent },
|
||||
data: { shardId: number; payload: CloseEvent }
|
||||
): unknown;
|
||||
export function log(
|
||||
type: "ERROR",
|
||||
data: Record<string, unknown> & { shardId: number },
|
||||
data: Record<string, unknown> & { shardId: number }
|
||||
): unknown;
|
||||
export function log(
|
||||
type: "HEARTBEATING",
|
||||
data: { shardId: number; shard: DiscordenoShard },
|
||||
data: { shardId: number; shard: DiscordenoShard }
|
||||
): unknown;
|
||||
export function log(
|
||||
type: "HEARTBEATING_CLOSED",
|
||||
data: { shardId: number; shard: DiscordenoShard },
|
||||
data: { shardId: number; shard: DiscordenoShard }
|
||||
): unknown;
|
||||
export function log(
|
||||
type: "HEARTBEATING_DETAILS",
|
||||
data: { shardId: number; interval: number; shard: DiscordenoShard },
|
||||
data: { shardId: number; interval: number; shard: DiscordenoShard }
|
||||
): unknown;
|
||||
export function log(
|
||||
type: "HEARTBEATING_STARTED",
|
||||
data: { shardId: number; interval: number },
|
||||
data: { shardId: number; interval: number }
|
||||
): unknown;
|
||||
export function log(
|
||||
type: "IDENTIFYING",
|
||||
data: { shardId: number; maxShards: number },
|
||||
data: { shardId: number; maxShards: number }
|
||||
): unknown;
|
||||
export function log(
|
||||
type: "INVALID_SESSION",
|
||||
data: { shardId: number; payload: DiscordGatewayPayload },
|
||||
data: { shardId: number; payload: DiscordGatewayPayload }
|
||||
): unknown;
|
||||
export function log(type: "RAW", data: Record<string, unknown>): unknown;
|
||||
export function log(
|
||||
type: "RAW_SEND",
|
||||
shardId: number,
|
||||
data: Record<string, unknown>
|
||||
): unknown;
|
||||
export function log(type: "RECONNECT", data: { shardId: number }): unknown;
|
||||
export function log(type: "RESUMED", data: { shardId: number }): unknown;
|
||||
export function log(type: "RESUMING", data: { shardId: number }): unknown;
|
||||
@@ -55,11 +60,12 @@ export function log(
|
||||
| "IDENTIFYING"
|
||||
| "INVALID_SESSION"
|
||||
| "RAW"
|
||||
| "RAW_SEND"
|
||||
| "RECONNECT"
|
||||
| "RESUMED"
|
||||
| "RESUMING"
|
||||
| "DEBUG",
|
||||
data: unknown,
|
||||
data: unknown
|
||||
) {
|
||||
// This is just a placeholder for the dev to override
|
||||
if (!type && !data) console.log(type, data);
|
||||
|
||||
@@ -23,6 +23,7 @@ export async function processQueue(id: number) {
|
||||
|
||||
// Send a request that is next in line
|
||||
const request = shard.queue.shift();
|
||||
if (!request) return;
|
||||
|
||||
if (request?.d) {
|
||||
request.d = loopObject(
|
||||
@@ -37,11 +38,7 @@ export async function processQueue(id: number) {
|
||||
);
|
||||
}
|
||||
|
||||
ws.log("DEBUG", {
|
||||
message: "Sending gateway request",
|
||||
shardId: shard.id,
|
||||
request,
|
||||
});
|
||||
ws.log("RAW_SEND", shard.id, { ...request });
|
||||
|
||||
shard.ws.send(JSON.stringify(request));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user