mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-16 11:28:15 +00:00
types: add gateway opcodes enum (#711)
* bring opcodes enum back * Update src/types/gateway/opcodes.ts Co-authored-by: ayntee <ayyantee@gmail.com> * DiscordGatewayOpcodes Co-authored-by: ayntee <ayyantee@gmail.com>
This commit is contained in:
@@ -2,6 +2,7 @@ import { eventHandlers } from "../bot.ts";
|
||||
import { cache } from "../cache.ts";
|
||||
import { handlers } from "../handlers/mod.ts";
|
||||
import { Member } from "../structures/mod.ts";
|
||||
import { DiscordGatewayOpcodes } from "../types/mod.ts";
|
||||
import { Collection } from "../util/collection.ts";
|
||||
import { delay } from "../util/utils.ts";
|
||||
import { createShard, requestGuildMembers } from "./mod.ts";
|
||||
@@ -67,10 +68,10 @@ export async function handleDiscordPayload(
|
||||
await eventHandlers.dispatchRequirements?.(data, shardID);
|
||||
|
||||
switch (data.op) {
|
||||
case GatewayOpcode.HeartbeatACK:
|
||||
case DiscordGatewayOpcodes.HeartbeatACK:
|
||||
// In case the user wants to listen to heartbeat responses
|
||||
return eventHandlers.heartbeat?.();
|
||||
case GatewayOpcode.Dispatch:
|
||||
case DiscordGatewayOpcodes.Dispatch:
|
||||
if (!data.t) return;
|
||||
// Run the appropriate handler for this event.
|
||||
return handlers[data.t]?.(data, shardID);
|
||||
|
||||
Reference in New Issue
Block a user