mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-04 09:50:07 +00:00
hotfix: release: 13.0.0-rc45
Fixed: - startBot shard data calculation - propper handling for websocket close code 1000 Changed: - shard shutdown code to 3000
This commit is contained in:
2
bot.ts
2
bot.ts
@@ -260,7 +260,7 @@ export function createEventHandlers(
|
||||
}
|
||||
|
||||
export async function startBot(bot: Bot) {
|
||||
if (!bot.botGatewayData) {
|
||||
if (!Object.keys(bot.botGatewayData ?? {}).length) {
|
||||
bot.gateway.gatewayBot = await bot.helpers.getGatewayBot();
|
||||
bot.gateway.lastShardId = bot.gateway.gatewayBot.shards - 1;
|
||||
bot.gateway.manager.totalShards = bot.gateway.gatewayBot.shards;
|
||||
|
||||
@@ -7,7 +7,6 @@ export async function handleClose(shard: Shard, close: CloseEvent): Promise<void
|
||||
shard.stopHeartbeating();
|
||||
|
||||
switch (close.code) {
|
||||
// These events
|
||||
case ShardSocketCloseCodes.TestingFinished: {
|
||||
shard.state = ShardState.Offline;
|
||||
shard.events.disconnected?.(shard);
|
||||
@@ -15,11 +14,11 @@ export async function handleClose(shard: Shard, close: CloseEvent): Promise<void
|
||||
return;
|
||||
}
|
||||
// On these codes a manual start will be done.
|
||||
case ShardSocketCloseCodes.Shutdown:
|
||||
case ShardSocketCloseCodes.ReIdentifying:
|
||||
case ShardSocketCloseCodes.Resharded:
|
||||
case ShardSocketCloseCodes.ResumeClosingOldConnection:
|
||||
case ShardSocketCloseCodes.ZombiedConnection:
|
||||
case ShardSocketCloseCodes.Shutdown: {
|
||||
case ShardSocketCloseCodes.ZombiedConnection: {
|
||||
shard.state = ShardState.Disconnected;
|
||||
shard.events.disconnected?.(shard);
|
||||
|
||||
|
||||
@@ -126,10 +126,8 @@ export interface ShardEvents {
|
||||
}
|
||||
|
||||
export enum ShardSocketCloseCodes {
|
||||
/** A regular Shard shutdown.
|
||||
* Discord will display this Shard as offline for other users.
|
||||
*/
|
||||
Shutdown = 1000,
|
||||
/** A regular Shard shutdown. */
|
||||
Shutdown = 3000,
|
||||
/** A resume has been requested and therefore the old connection needs to be closed. */
|
||||
ResumeClosingOldConnection = 3024,
|
||||
/** Did not receive a heartbeat ACK in time.
|
||||
|
||||
@@ -915,6 +915,10 @@ export enum HTTPResponseCodes {
|
||||
|
||||
/** https://discord.com/developers/docs/topics/opcodes-and-status-codes#opcodes-and-status-codes */
|
||||
export enum GatewayCloseEventCodes {
|
||||
/** A normal closure of the gateway.
|
||||
* You may attempt to reconnect.
|
||||
*/
|
||||
NormalClosure = 1000,
|
||||
/** We're not sure what went wrong. Try reconnecting? */
|
||||
UnknownError = 4000,
|
||||
/** You sent an invalid [Gateway opcode](https://discord.com/developers/docs/topics/opcodes-and-status-codes#gateway-gateway-opcodes) or an invalid payload for an opcode. Don't do that! */
|
||||
|
||||
@@ -25,7 +25,7 @@ export const GATEWAY_VERSION = 10;
|
||||
|
||||
// TODO: update this version
|
||||
/** https://github.com/discordeno/discordeno/releases */
|
||||
export const DISCORDENO_VERSION = "13.0.0-rc44";
|
||||
export const DISCORDENO_VERSION = "13.0.0-rc45";
|
||||
|
||||
/** https://discord.com/developers/docs/reference#user-agent */
|
||||
export const USER_AGENT = `DiscordBot (https://github.com/discordeno/discordeno, v${DISCORDENO_VERSION})`;
|
||||
|
||||
Reference in New Issue
Block a user