mirror of
https://github.com/discordeno/discordeno.git
synced 2026-05-31 07:50:07 +00:00
refactor: add gateway version to constants
This commit is contained in:
@@ -4,7 +4,7 @@ import {
|
||||
DiscordBotGatewayData,
|
||||
EventHandlers,
|
||||
} from "./types/types.ts";
|
||||
import { baseEndpoints, endpoints } from "./util/constants.ts";
|
||||
import { baseEndpoints, endpoints, GATEWAY_VERSION } from "./util/constants.ts";
|
||||
import { spawnShards } from "./ws/shard_manager.ts";
|
||||
|
||||
export let authorization = "";
|
||||
@@ -13,7 +13,7 @@ export let botID = "";
|
||||
export let eventHandlers: EventHandlers = {};
|
||||
|
||||
export let botGatewayData: DiscordBotGatewayData;
|
||||
export let proxyWSURL = "wss://gateway.discord.gg?v=8&encoding=json";
|
||||
export let proxyWSURL = `wss://gateway.discord.gg`;
|
||||
|
||||
export const identifyPayload: IdentifyPayload = {
|
||||
token: "",
|
||||
@@ -48,6 +48,9 @@ export async function startBot(config: BotConfig) {
|
||||
endpoints.GATEWAY_BOT,
|
||||
) as DiscordBotGatewayData;
|
||||
|
||||
// Explicitly append gateway version and encoding
|
||||
botGatewayData.url += `?v=${GATEWAY_VERSION}&encoding=json`;
|
||||
|
||||
proxyWSURL = botGatewayData.url;
|
||||
identifyPayload.token = config.token;
|
||||
identifyPayload.intents = config.intents.reduce(
|
||||
|
||||
@@ -4,6 +4,9 @@ export const BASE_URL = "https://discord.com/api";
|
||||
/** https://discord.com/developers/docs/reference#api-versioning-api-versions */
|
||||
export const API_VERSION = 8;
|
||||
|
||||
/** https://discord.com/developers/docs/topics/gateway#gateways-gateway-versions */
|
||||
export const GATEWAY_VERSION = 8;
|
||||
|
||||
/** https://discord.com/developers/docs/reference#user-agent */
|
||||
export const USER_AGENT = "DiscordBot (https://github.com/discordeno/discordeno, v10)";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user