fix(WS): Get gateway data
This commit is contained in:
parent
6d90b1610e
commit
b672427756
@ -127,6 +127,8 @@ class WebSocketManager extends EventEmitter {
|
|||||||
*/
|
*/
|
||||||
async connect() {
|
async connect() {
|
||||||
const invalidToken = new Error(WSCodes[4004]);
|
const invalidToken = new Error(WSCodes[4004]);
|
||||||
|
/*
|
||||||
|
BOT
|
||||||
const {
|
const {
|
||||||
url: gatewayURL,
|
url: gatewayURL,
|
||||||
shards: recommendedShards,
|
shards: recommendedShards,
|
||||||
@ -134,6 +136,17 @@ class WebSocketManager extends EventEmitter {
|
|||||||
} = await this.client.api.gateway.bot.get().catch(error => {
|
} = await this.client.api.gateway.bot.get().catch(error => {
|
||||||
throw error.httpStatus === 401 ? invalidToken : error;
|
throw error.httpStatus === 401 ? invalidToken : error;
|
||||||
});
|
});
|
||||||
|
*/
|
||||||
|
|
||||||
|
const { url: gatewayURL } = await this.client.api.gateway.get({ auth: false }).catch(error => {
|
||||||
|
// Never throw error :v
|
||||||
|
throw error.httpStatus === 401 ? invalidToken : error;
|
||||||
|
});
|
||||||
|
const recommendedShards = 1;
|
||||||
|
const sessionStartLimit = {
|
||||||
|
total: 1000000000,
|
||||||
|
remaining: 1000000000,
|
||||||
|
};
|
||||||
|
|
||||||
const { total, remaining } = sessionStartLimit;
|
const { total, remaining } = sessionStartLimit;
|
||||||
|
|
||||||
|
@ -175,6 +175,7 @@ exports.Endpoints = {
|
|||||||
invite: (root, code, eventId) => (eventId ? `${root}/${code}?event=${eventId}` : `${root}/${code}`),
|
invite: (root, code, eventId) => (eventId ? `${root}/${code}?event=${eventId}` : `${root}/${code}`),
|
||||||
scheduledEvent: (root, guildId, eventId) => `${root}/${guildId}/${eventId}`,
|
scheduledEvent: (root, guildId, eventId) => `${root}/${guildId}/${eventId}`,
|
||||||
botGateway: '/gateway/bot',
|
botGateway: '/gateway/bot',
|
||||||
|
userGateway: '/gateway',
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
1
typings/index.d.ts
vendored
1
typings/index.d.ts
vendored
@ -3066,6 +3066,7 @@ export const Constants: {
|
|||||||
};
|
};
|
||||||
Endpoints: {
|
Endpoints: {
|
||||||
botGateway: string;
|
botGateway: string;
|
||||||
|
userGateway: string;
|
||||||
invite: (root: string, code: string, eventId?: Snowflake) => string;
|
invite: (root: string, code: string, eventId?: Snowflake) => string;
|
||||||
scheduledEvent: (root: string, guildId: Snowflake, eventId: Snowflake) => string;
|
scheduledEvent: (root: string, guildId: Snowflake, eventId: Snowflake) => string;
|
||||||
CDN: (root: string) => {
|
CDN: (root: string) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user