mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-16 03:18:17 +00:00
refactor: use updated identify payload instead
This commit is contained in:
+7
-11
@@ -1,12 +1,8 @@
|
||||
import {
|
||||
botGatewayData,
|
||||
eventHandlers,
|
||||
IdentifyPayload,
|
||||
proxyWSURL,
|
||||
} from "../bot.ts";
|
||||
import { botGatewayData, eventHandlers, proxyWSURL } from "../bot.ts";
|
||||
import {
|
||||
DiscordBotGatewayData,
|
||||
DiscordHeartbeatPayload,
|
||||
DiscordIdentify,
|
||||
DiscordPayload,
|
||||
FetchMembersOptions,
|
||||
GatewayOpcode,
|
||||
@@ -41,7 +37,7 @@ interface RequestMemberQueuedRequest {
|
||||
|
||||
export function createShard(
|
||||
data: DiscordBotGatewayData,
|
||||
identifyPayload: IdentifyPayload,
|
||||
identifyPayload: DiscordIdentify,
|
||||
resuming = false,
|
||||
shardID = 0,
|
||||
) {
|
||||
@@ -174,7 +170,7 @@ export function createShard(
|
||||
};
|
||||
}
|
||||
|
||||
function identify(shard: BasicShard, payload: IdentifyPayload) {
|
||||
function identify(shard: BasicShard, payload: DiscordIdentify) {
|
||||
eventHandlers.debug?.(
|
||||
{
|
||||
type: "gatewayIdentify",
|
||||
@@ -190,7 +186,7 @@ function identify(shard: BasicShard, payload: IdentifyPayload) {
|
||||
}, shard.id);
|
||||
}
|
||||
|
||||
function resume(shard: BasicShard, payload: IdentifyPayload) {
|
||||
function resume(shard: BasicShard, payload: DiscordIdentify) {
|
||||
sendWS({
|
||||
op: GatewayOpcode.Resume,
|
||||
d: {
|
||||
@@ -204,7 +200,7 @@ function resume(shard: BasicShard, payload: IdentifyPayload) {
|
||||
async function heartbeat(
|
||||
shard: BasicShard,
|
||||
interval: number,
|
||||
payload: IdentifyPayload,
|
||||
payload: DiscordIdentify,
|
||||
data: DiscordBotGatewayData,
|
||||
) {
|
||||
// We lost socket connection between heartbeats, resume connection
|
||||
@@ -257,7 +253,7 @@ async function heartbeat(
|
||||
|
||||
async function resumeConnection(
|
||||
data: DiscordBotGatewayData,
|
||||
payload: IdentifyPayload,
|
||||
payload: DiscordIdentify,
|
||||
shardID: number,
|
||||
) {
|
||||
const shard = basicShards.get(shardID);
|
||||
|
||||
Reference in New Issue
Block a user