seyfert 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (345) hide show
  1. package/LICENSE +190 -0
  2. package/README.md +57 -0
  3. package/lib/api/CDN.d.ts +220 -0
  4. package/lib/api/CDN.js +236 -0
  5. package/lib/api/REST.d.ts +127 -0
  6. package/lib/api/REST.js +424 -0
  7. package/lib/api/Router.d.ts +17 -0
  8. package/lib/api/Router.js +63 -0
  9. package/lib/api/Routes/applications.d.ts +46 -0
  10. package/lib/api/Routes/applications.js +2 -0
  11. package/lib/api/Routes/cdn.d.ts +66 -0
  12. package/lib/api/Routes/cdn.js +2 -0
  13. package/lib/api/Routes/channels.d.ts +109 -0
  14. package/lib/api/Routes/channels.js +2 -0
  15. package/lib/api/Routes/gateway.d.ts +11 -0
  16. package/lib/api/Routes/gateway.js +2 -0
  17. package/lib/api/Routes/guilds.d.ts +171 -0
  18. package/lib/api/Routes/guilds.js +2 -0
  19. package/lib/api/Routes/index.d.ts +13 -0
  20. package/lib/api/Routes/index.js +17 -0
  21. package/lib/api/Routes/interactions.d.ts +14 -0
  22. package/lib/api/Routes/interactions.js +2 -0
  23. package/lib/api/Routes/invites.d.ts +9 -0
  24. package/lib/api/Routes/invites.js +2 -0
  25. package/lib/api/Routes/stage-instances.d.ts +13 -0
  26. package/lib/api/Routes/stage-instances.js +2 -0
  27. package/lib/api/Routes/stickers.d.ts +11 -0
  28. package/lib/api/Routes/stickers.js +2 -0
  29. package/lib/api/Routes/users.d.ts +35 -0
  30. package/lib/api/Routes/users.js +2 -0
  31. package/lib/api/Routes/voice.d.ts +10 -0
  32. package/lib/api/Routes/voice.js +2 -0
  33. package/lib/api/Routes/webhooks.d.ts +29 -0
  34. package/lib/api/Routes/webhooks.js +2 -0
  35. package/lib/api/errors/DiscordAPIError.d.ts +51 -0
  36. package/lib/api/errors/DiscordAPIError.js +81 -0
  37. package/lib/api/errors/HTTPError.d.ts +20 -0
  38. package/lib/api/errors/HTTPError.js +28 -0
  39. package/lib/api/errors/RateLimitError.d.ts +19 -0
  40. package/lib/api/errors/RateLimitError.js +37 -0
  41. package/lib/api/handlers/BurstHandler.d.ts +51 -0
  42. package/lib/api/handlers/BurstHandler.js +124 -0
  43. package/lib/api/handlers/SequentialHandler.d.ts +81 -0
  44. package/lib/api/handlers/SequentialHandler.js +365 -0
  45. package/lib/api/handlers/Shared.d.ts +14 -0
  46. package/lib/api/handlers/Shared.js +125 -0
  47. package/lib/api/index.d.ts +5 -0
  48. package/lib/api/index.js +21 -0
  49. package/lib/api/interfaces/Handler.d.ts +21 -0
  50. package/lib/api/interfaces/Handler.js +2 -0
  51. package/lib/api/shared.d.ts +7 -0
  52. package/lib/api/shared.js +27 -0
  53. package/lib/api/utils/constants.d.ts +39 -0
  54. package/lib/api/utils/constants.js +50 -0
  55. package/lib/api/utils/types.d.ts +335 -0
  56. package/lib/api/utils/types.js +14 -0
  57. package/lib/api/utils/utils.d.ts +52 -0
  58. package/lib/api/utils/utils.js +159 -0
  59. package/lib/builders/ActionRow.d.ts +40 -0
  60. package/lib/builders/ActionRow.js +58 -0
  61. package/lib/builders/Attachment.d.ts +106 -0
  62. package/lib/builders/Attachment.js +196 -0
  63. package/lib/builders/Base.d.ts +10 -0
  64. package/lib/builders/Base.js +13 -0
  65. package/lib/builders/Button.d.ts +59 -0
  66. package/lib/builders/Button.js +94 -0
  67. package/lib/builders/MessageEmbed.d.ts +116 -0
  68. package/lib/builders/MessageEmbed.js +159 -0
  69. package/lib/builders/Modal.d.ts +111 -0
  70. package/lib/builders/Modal.js +162 -0
  71. package/lib/builders/SelectMenu.d.ts +201 -0
  72. package/lib/builders/SelectMenu.js +293 -0
  73. package/lib/builders/index.d.ts +12 -0
  74. package/lib/builders/index.js +54 -0
  75. package/lib/builders/types.d.ts +21 -0
  76. package/lib/builders/types.js +2 -0
  77. package/lib/cache/adapters/default.d.ts +24 -0
  78. package/lib/cache/adapters/default.js +118 -0
  79. package/lib/cache/adapters/index.d.ts +4 -0
  80. package/lib/cache/adapters/index.js +20 -0
  81. package/lib/cache/adapters/redis.d.ts +35 -0
  82. package/lib/cache/adapters/redis.js +180 -0
  83. package/lib/cache/adapters/types.d.ts +25 -0
  84. package/lib/cache/adapters/types.js +2 -0
  85. package/lib/cache/adapters/workeradapter.d.ts +24 -0
  86. package/lib/cache/adapters/workeradapter.js +76 -0
  87. package/lib/cache/index.d.ts +97 -0
  88. package/lib/cache/index.js +394 -0
  89. package/lib/cache/resources/channels.d.ts +7 -0
  90. package/lib/cache/resources/channels.js +20 -0
  91. package/lib/cache/resources/default/base.d.ts +25 -0
  92. package/lib/cache/resources/default/base.js +75 -0
  93. package/lib/cache/resources/default/guild-based.d.ts +33 -0
  94. package/lib/cache/resources/default/guild-based.js +91 -0
  95. package/lib/cache/resources/default/guild-related.d.ts +32 -0
  96. package/lib/cache/resources/default/guild-related.js +102 -0
  97. package/lib/cache/resources/emojis.d.ts +7 -0
  98. package/lib/cache/resources/emojis.js +17 -0
  99. package/lib/cache/resources/guilds.d.ts +10 -0
  100. package/lib/cache/resources/guilds.js +117 -0
  101. package/lib/cache/resources/members.d.ts +10 -0
  102. package/lib/cache/resources/members.js +41 -0
  103. package/lib/cache/resources/presence.d.ts +9 -0
  104. package/lib/cache/resources/presence.js +14 -0
  105. package/lib/cache/resources/roles.d.ts +7 -0
  106. package/lib/cache/resources/roles.js +17 -0
  107. package/lib/cache/resources/stage-instances.d.ts +5 -0
  108. package/lib/cache/resources/stage-instances.js +8 -0
  109. package/lib/cache/resources/stickers.d.ts +7 -0
  110. package/lib/cache/resources/stickers.js +17 -0
  111. package/lib/cache/resources/threads.d.ts +7 -0
  112. package/lib/cache/resources/threads.js +17 -0
  113. package/lib/cache/resources/users.d.ts +7 -0
  114. package/lib/cache/resources/users.js +17 -0
  115. package/lib/cache/resources/voice-states.d.ts +9 -0
  116. package/lib/cache/resources/voice-states.js +13 -0
  117. package/lib/client/base.d.ts +244 -0
  118. package/lib/client/base.js +178 -0
  119. package/lib/client/client.d.ts +32 -0
  120. package/lib/client/client.js +156 -0
  121. package/lib/client/httpclient.d.ts +21 -0
  122. package/lib/client/httpclient.js +143 -0
  123. package/lib/client/index.d.ts +4 -0
  124. package/lib/client/index.js +19 -0
  125. package/lib/client/oninteraction.d.ts +4 -0
  126. package/lib/client/oninteraction.js +180 -0
  127. package/lib/client/workerclient.d.ts +28 -0
  128. package/lib/client/workerclient.js +213 -0
  129. package/lib/collection.d.ts +233 -0
  130. package/lib/collection.js +371 -0
  131. package/lib/commands/applications/chat.d.ts +139 -0
  132. package/lib/commands/applications/chat.js +173 -0
  133. package/lib/commands/applications/chatcontext.d.ts +28 -0
  134. package/lib/commands/applications/chatcontext.js +53 -0
  135. package/lib/commands/applications/menu.d.ts +39 -0
  136. package/lib/commands/applications/menu.js +87 -0
  137. package/lib/commands/applications/menucontext.d.ts +25 -0
  138. package/lib/commands/applications/menucontext.js +64 -0
  139. package/lib/commands/applications/options.d.ts +67 -0
  140. package/lib/commands/applications/options.js +44 -0
  141. package/lib/commands/applications/shared.d.ts +35 -0
  142. package/lib/commands/applications/shared.js +2 -0
  143. package/lib/commands/decorators.d.ts +107 -0
  144. package/lib/commands/decorators.js +85 -0
  145. package/lib/commands/handler.d.ts +15 -0
  146. package/lib/commands/handler.js +140 -0
  147. package/lib/commands/index.d.ts +8 -0
  148. package/lib/commands/index.js +24 -0
  149. package/lib/commands/optionresolver.d.ts +49 -0
  150. package/lib/commands/optionresolver.js +146 -0
  151. package/lib/common/bot/watcher.d.ts +53 -0
  152. package/lib/common/bot/watcher.js +104 -0
  153. package/lib/common/index.d.ts +13 -0
  154. package/lib/common/index.js +30 -0
  155. package/lib/common/it/colors.d.ts +274 -0
  156. package/lib/common/it/colors.js +453 -0
  157. package/lib/common/it/constants.d.ts +36 -0
  158. package/lib/common/it/constants.js +40 -0
  159. package/lib/common/it/logger.d.ts +114 -0
  160. package/lib/common/it/logger.js +189 -0
  161. package/lib/common/it/utils.d.ts +107 -0
  162. package/lib/common/it/utils.js +275 -0
  163. package/lib/common/shorters/base.d.ts +5 -0
  164. package/lib/common/shorters/base.js +10 -0
  165. package/lib/common/shorters/channels.d.ts +90 -0
  166. package/lib/common/shorters/channels.js +95 -0
  167. package/lib/common/shorters/guilds.d.ts +389 -0
  168. package/lib/common/shorters/guilds.js +350 -0
  169. package/lib/common/shorters/members.d.ts +115 -0
  170. package/lib/common/shorters/members.js +179 -0
  171. package/lib/common/shorters/messages.d.ts +27 -0
  172. package/lib/common/shorters/messages.js +117 -0
  173. package/lib/common/shorters/roles.d.ts +12 -0
  174. package/lib/common/shorters/roles.js +51 -0
  175. package/lib/common/shorters/templates.d.ts +12 -0
  176. package/lib/common/shorters/templates.js +29 -0
  177. package/lib/common/shorters/users.d.ts +11 -0
  178. package/lib/common/shorters/users.js +42 -0
  179. package/lib/common/shorters/webhook.d.ts +33 -0
  180. package/lib/common/shorters/webhook.js +69 -0
  181. package/lib/common/types/options.d.ts +10 -0
  182. package/lib/common/types/options.js +2 -0
  183. package/lib/common/types/resolvables.d.ts +10 -0
  184. package/lib/common/types/resolvables.js +2 -0
  185. package/lib/common/types/util.d.ts +90 -0
  186. package/lib/common/types/util.js +2 -0
  187. package/lib/common/types/write.d.ts +21 -0
  188. package/lib/common/types/write.js +2 -0
  189. package/lib/components/ActionRow.d.ts +10 -0
  190. package/lib/components/ActionRow.js +13 -0
  191. package/lib/components/ButtonComponent.d.ts +19 -0
  192. package/lib/components/ButtonComponent.js +34 -0
  193. package/lib/components/ChannelSelectMenuComponent.d.ts +6 -0
  194. package/lib/components/ChannelSelectMenuComponent.js +12 -0
  195. package/lib/components/MentionableSelectMenuComponent.d.ts +4 -0
  196. package/lib/components/MentionableSelectMenuComponent.js +7 -0
  197. package/lib/components/RoleSelectMenuComponent.d.ts +4 -0
  198. package/lib/components/RoleSelectMenuComponent.js +7 -0
  199. package/lib/components/StringSelectMenuComponent.d.ts +6 -0
  200. package/lib/components/StringSelectMenuComponent.js +12 -0
  201. package/lib/components/TextInputComponent.d.ts +7 -0
  202. package/lib/components/TextInputComponent.js +14 -0
  203. package/lib/components/UserSelectMenuComponent.d.ts +4 -0
  204. package/lib/components/UserSelectMenuComponent.js +7 -0
  205. package/lib/components/command.d.ts +23 -0
  206. package/lib/components/command.js +15 -0
  207. package/lib/components/handler.d.ts +48 -0
  208. package/lib/components/handler.js +231 -0
  209. package/lib/components/index.d.ts +20 -0
  210. package/lib/components/index.js +55 -0
  211. package/lib/components/listener.d.ts +11 -0
  212. package/lib/components/listener.js +18 -0
  213. package/lib/events/event.d.ts +23 -0
  214. package/lib/events/event.js +2 -0
  215. package/lib/events/handler.d.ts +19 -0
  216. package/lib/events/handler.js +112 -0
  217. package/lib/events/hooks/application_command.d.ts +12 -0
  218. package/lib/events/hooks/application_command.js +8 -0
  219. package/lib/events/hooks/auto_moderation.d.ts +22 -0
  220. package/lib/events/hooks/auto_moderation.js +21 -0
  221. package/lib/events/hooks/channel.d.ts +11 -0
  222. package/lib/events/hooks/channel.js +24 -0
  223. package/lib/events/hooks/custom.d.ts +4 -0
  224. package/lib/events/hooks/custom.js +11 -0
  225. package/lib/events/hooks/dispatch.d.ts +5 -0
  226. package/lib/events/hooks/dispatch.js +12 -0
  227. package/lib/events/hooks/entitlement.d.ts +35 -0
  228. package/lib/events/hooks/entitlement.js +16 -0
  229. package/lib/events/hooks/guild.d.ts +228 -0
  230. package/lib/events/hooks/guild.js +101 -0
  231. package/lib/events/hooks/index.d.ts +23 -0
  232. package/lib/events/hooks/index.js +34 -0
  233. package/lib/events/hooks/integration.d.ts +94 -0
  234. package/lib/events/hooks/integration.js +27 -0
  235. package/lib/events/hooks/interactions.d.ts +4 -0
  236. package/lib/events/hooks/interactions.js +8 -0
  237. package/lib/events/hooks/invite.d.ts +21 -0
  238. package/lib/events/hooks/invite.js +12 -0
  239. package/lib/events/hooks/message.d.ts +69 -0
  240. package/lib/events/hooks/message.js +37 -0
  241. package/lib/events/hooks/presence.d.ts +27 -0
  242. package/lib/events/hooks/presence.js +8 -0
  243. package/lib/events/hooks/stage.d.ts +29 -0
  244. package/lib/events/hooks/stage.js +16 -0
  245. package/lib/events/hooks/thread.d.ts +198 -0
  246. package/lib/events/hooks/thread.js +29 -0
  247. package/lib/events/hooks/typing.d.ts +16 -0
  248. package/lib/events/hooks/typing.js +14 -0
  249. package/lib/events/hooks/user.d.ts +4 -0
  250. package/lib/events/hooks/user.js +8 -0
  251. package/lib/events/hooks/voice.d.ts +37 -0
  252. package/lib/events/hooks/voice.js +18 -0
  253. package/lib/events/hooks/webhook.d.ts +6 -0
  254. package/lib/events/hooks/webhook.js +8 -0
  255. package/lib/events/index.d.ts +2 -0
  256. package/lib/events/index.js +18 -0
  257. package/lib/index.d.ts +79 -0
  258. package/lib/index.js +104 -0
  259. package/lib/langs/handler.d.ts +11 -0
  260. package/lib/langs/handler.js +34 -0
  261. package/lib/langs/index.d.ts +2 -0
  262. package/lib/langs/index.js +18 -0
  263. package/lib/langs/router.d.ts +18 -0
  264. package/lib/langs/router.js +42 -0
  265. package/lib/structures/AnonymousGuild.d.ts +7 -0
  266. package/lib/structures/AnonymousGuild.js +11 -0
  267. package/lib/structures/AutoModerationRule.d.ts +22 -0
  268. package/lib/structures/AutoModerationRule.js +34 -0
  269. package/lib/structures/ClientUser.d.ts +25 -0
  270. package/lib/structures/ClientUser.js +52 -0
  271. package/lib/structures/Guild.d.ts +86 -0
  272. package/lib/structures/Guild.js +66 -0
  273. package/lib/structures/GuildEmoji.d.ts +29 -0
  274. package/lib/structures/GuildEmoji.js +47 -0
  275. package/lib/structures/GuildMember.d.ts +92 -0
  276. package/lib/structures/GuildMember.js +137 -0
  277. package/lib/structures/GuildPreview.d.ts +10 -0
  278. package/lib/structures/GuildPreview.js +14 -0
  279. package/lib/structures/GuildRole.d.ts +21 -0
  280. package/lib/structures/GuildRole.js +32 -0
  281. package/lib/structures/GuildTemplate.d.ts +23 -0
  282. package/lib/structures/GuildTemplate.js +36 -0
  283. package/lib/structures/Interaction.d.ts +152 -0
  284. package/lib/structures/Interaction.js +409 -0
  285. package/lib/structures/Message.d.ts +53 -0
  286. package/lib/structures/Message.js +123 -0
  287. package/lib/structures/Sticker.d.ts +27 -0
  288. package/lib/structures/Sticker.js +44 -0
  289. package/lib/structures/User.d.ts +20 -0
  290. package/lib/structures/User.js +37 -0
  291. package/lib/structures/Webhook.d.ts +42 -0
  292. package/lib/structures/Webhook.js +63 -0
  293. package/lib/structures/channels.d.ts +232 -0
  294. package/lib/structures/channels.js +366 -0
  295. package/lib/structures/extra/Base.d.ts +7 -0
  296. package/lib/structures/extra/Base.js +39 -0
  297. package/lib/structures/extra/BaseComponent.d.ts +9 -0
  298. package/lib/structures/extra/BaseComponent.js +12 -0
  299. package/lib/structures/extra/BaseGuild.d.ts +40 -0
  300. package/lib/structures/extra/BaseGuild.js +71 -0
  301. package/lib/structures/extra/BaseSelectMenuComponent.d.ts +9 -0
  302. package/lib/structures/extra/BaseSelectMenuComponent.js +13 -0
  303. package/lib/structures/extra/BitField.d.ts +14 -0
  304. package/lib/structures/extra/BitField.js +56 -0
  305. package/lib/structures/extra/DiscordBase.d.ts +18 -0
  306. package/lib/structures/extra/DiscordBase.js +28 -0
  307. package/lib/structures/extra/Permissions.d.ts +54 -0
  308. package/lib/structures/extra/Permissions.js +9 -0
  309. package/lib/structures/extra/functions.d.ts +11 -0
  310. package/lib/structures/extra/functions.js +69 -0
  311. package/lib/structures/index.d.ts +15 -0
  312. package/lib/structures/index.js +31 -0
  313. package/lib/websocket/SharedTypes.d.ts +128 -0
  314. package/lib/websocket/SharedTypes.js +2 -0
  315. package/lib/websocket/constants/index.d.ts +26 -0
  316. package/lib/websocket/constants/index.js +31 -0
  317. package/lib/websocket/discord/basesocket.d.ts +12 -0
  318. package/lib/websocket/discord/basesocket.js +37 -0
  319. package/lib/websocket/discord/events/memberUpdate.d.ts +16 -0
  320. package/lib/websocket/discord/events/memberUpdate.js +47 -0
  321. package/lib/websocket/discord/events/presenceUpdate.d.ts +24 -0
  322. package/lib/websocket/discord/events/presenceUpdate.js +46 -0
  323. package/lib/websocket/discord/handlemessage.d.ts +0 -0
  324. package/lib/websocket/discord/handlemessage.js +1 -0
  325. package/lib/websocket/discord/index.d.ts +4 -0
  326. package/lib/websocket/discord/index.js +20 -0
  327. package/lib/websocket/discord/memberUpdate.d.ts +16 -0
  328. package/lib/websocket/discord/memberUpdate.js +47 -0
  329. package/lib/websocket/discord/shard.d.ts +46 -0
  330. package/lib/websocket/discord/shard.js +278 -0
  331. package/lib/websocket/discord/sharder.d.ts +25 -0
  332. package/lib/websocket/discord/sharder.js +153 -0
  333. package/lib/websocket/discord/shared.d.ts +99 -0
  334. package/lib/websocket/discord/shared.js +8 -0
  335. package/lib/websocket/discord/worker.d.ts +43 -0
  336. package/lib/websocket/discord/worker.js +2 -0
  337. package/lib/websocket/discord/workermanager.d.ts +69 -0
  338. package/lib/websocket/discord/workermanager.js +273 -0
  339. package/lib/websocket/index.d.ts +3 -0
  340. package/lib/websocket/index.js +19 -0
  341. package/lib/websocket/structures/index.d.ts +117 -0
  342. package/lib/websocket/structures/index.js +261 -0
  343. package/lib/websocket/structures/timeout.d.ts +20 -0
  344. package/lib/websocket/structures/timeout.js +75 -0
  345. package/package.json +70 -0
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MemberUpdateHandler = void 0;
4
+ class MemberUpdateHandler {
5
+ guildMemberUpdate = new Map();
6
+ check(member) {
7
+ if (!this.guildMemberUpdate.has(member.user.id)) {
8
+ this.setMember(member);
9
+ return true;
10
+ }
11
+ const data = this.guildMemberUpdate.get(member.user.id);
12
+ if (this.usersEqual(data.member.user, member.user)) {
13
+ return this.membersEquals(data.member, member);
14
+ }
15
+ clearTimeout(data.timeout);
16
+ this.setMember(member);
17
+ return true;
18
+ }
19
+ setMember(member) {
20
+ this.guildMemberUpdate.set(member.user.id, {
21
+ member,
22
+ timeout: setTimeout(() => {
23
+ this.guildMemberUpdate.delete(member.user.id);
24
+ }, 1.5e3),
25
+ });
26
+ }
27
+ membersEquals(old, member) {
28
+ return (old.joined_at === member.joined_at &&
29
+ old.nick === member.nick &&
30
+ old.avatar === member.avatar &&
31
+ old.pending === member.pending &&
32
+ old.communication_disabled_until === member.communication_disabled_until &&
33
+ old.flags === member.flags &&
34
+ (old.roles === member.roles ||
35
+ (old.roles.length === member.roles.length && old.roles.every((role, i) => role === member.roles[i]))));
36
+ }
37
+ usersEqual(old, user) {
38
+ return (old.username === user.username &&
39
+ old.discriminator === user.discriminator &&
40
+ old.global_name === user.global_name &&
41
+ old.avatar === user.avatar &&
42
+ old.public_flags === user.public_flags &&
43
+ old.banner === user.banner &&
44
+ old.accent_color === user.accent_color);
45
+ }
46
+ }
47
+ exports.MemberUpdateHandler = MemberUpdateHandler;
@@ -0,0 +1,46 @@
1
+ /// <reference types="node" />
2
+ import type WS from 'ws';
3
+ import { type CloseEvent } from 'ws';
4
+ import type { GatewayReceivePayload, GatewaySendPayload, Logger } from '../../common';
5
+ import { DynamicBucket, PriorityQueue } from '../structures';
6
+ import { ConnectTimeout } from '../structures/timeout';
7
+ import { BaseSocket } from './basesocket';
8
+ import type { ShardData, ShardOptions } from './shared';
9
+ export interface ShardHeart {
10
+ interval: number;
11
+ nodeInterval?: NodeJS.Timeout;
12
+ lastAck?: number;
13
+ lastBeat?: number;
14
+ ack: boolean;
15
+ }
16
+ export declare class Shard {
17
+ id: number;
18
+ options: ShardOptions;
19
+ debugger?: Logger;
20
+ data: Partial<ShardData> | ShardData;
21
+ websocket: BaseSocket | null;
22
+ connectTimeout: ConnectTimeout;
23
+ heart: ShardHeart;
24
+ bucket: DynamicBucket;
25
+ offlineSendQueue: PriorityQueue<(_?: unknown) => void>;
26
+ constructor(id: number, options: ShardOptions);
27
+ get latency(): number;
28
+ get isOpen(): boolean;
29
+ get gatewayURL(): string;
30
+ get resumeGatewayURL(): string | undefined;
31
+ get currentGatewayURL(): string;
32
+ connect(): Promise<void>;
33
+ send<T extends GatewaySendPayload = GatewaySendPayload>(priority: number, message: T): Promise<void>;
34
+ identify(): Promise<void>;
35
+ get resumable(): boolean;
36
+ resume(): Promise<void>;
37
+ heartbeat(requested: boolean): Promise<void>;
38
+ disconnect(): Promise<void>;
39
+ reconnect(): Promise<void>;
40
+ onpacket(packet: GatewayReceivePayload): Promise<void>;
41
+ protected handleClosed(close: CloseEvent): Promise<void>;
42
+ close(code: number, reason: string): Promise<void>;
43
+ protected handleMessage({ data }: WS.MessageEvent): Promise<void>;
44
+ checkOffline(priority: number): Promise<unknown>;
45
+ calculateSafeRequests(): number;
46
+ }
@@ -0,0 +1,278 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Shard = void 0;
4
+ const node_zlib_1 = require("node:zlib");
5
+ const ws_1 = require("ws");
6
+ const common_1 = require("../../common");
7
+ const constants_1 = require("../constants");
8
+ const structures_1 = require("../structures");
9
+ const timeout_1 = require("../structures/timeout");
10
+ const basesocket_1 = require("./basesocket");
11
+ const shared_1 = require("./shared");
12
+ class Shard {
13
+ id;
14
+ options;
15
+ debugger;
16
+ data = {
17
+ resumeSeq: null,
18
+ };
19
+ websocket = null;
20
+ connectTimeout = new timeout_1.ConnectTimeout();
21
+ heart = {
22
+ interval: 30e3,
23
+ ack: true,
24
+ };
25
+ bucket;
26
+ offlineSendQueue = new structures_1.PriorityQueue();
27
+ constructor(id, options) {
28
+ this.id = id;
29
+ this.options = options;
30
+ this.options.ratelimitOptions ??= {
31
+ rateLimitResetInterval: 60_000,
32
+ maxRequestsPerRateLimitTick: 120,
33
+ };
34
+ if (options.debugger)
35
+ this.debugger = options.debugger;
36
+ const safe = this.calculateSafeRequests();
37
+ this.bucket = new structures_1.DynamicBucket({
38
+ limit: safe,
39
+ refillAmount: safe,
40
+ refillInterval: 6e4,
41
+ debugger: this.debugger,
42
+ });
43
+ }
44
+ get latency() {
45
+ return this.heart.lastAck && this.heart.lastBeat ? this.heart.lastAck - this.heart.lastBeat : Infinity;
46
+ }
47
+ get isOpen() {
48
+ return this.websocket?.readyState === ws_1.WebSocket.OPEN;
49
+ }
50
+ get gatewayURL() {
51
+ return this.options.info.url;
52
+ }
53
+ get resumeGatewayURL() {
54
+ return this.data.resume_gateway_url;
55
+ }
56
+ get currentGatewayURL() {
57
+ const url = new URL(this.resumeGatewayURL ?? this.options.info.url);
58
+ url.searchParams.set('v', '10');
59
+ return url.href;
60
+ }
61
+ async connect() {
62
+ await this.connectTimeout.wait();
63
+ if (this.isOpen) {
64
+ this.debugger?.debug(`[Shard #${this.id}] attempted to connect while open`);
65
+ return;
66
+ }
67
+ this.debugger?.debug(`[Shard #${this.id}] Connecting to ${this.currentGatewayURL}`);
68
+ // @ts-expect-error @types/bun cause erros in compile
69
+ this.websocket = new basesocket_1.BaseSocket(typeof Bun === 'undefined' ? 'ws' : 'bun', this.currentGatewayURL);
70
+ this.websocket.onmessage = (event) => this.handleMessage(event);
71
+ this.websocket.onclose = (event) => this.handleClosed(event);
72
+ this.websocket.onerror = (event) => this.debugger?.error(event);
73
+ this.websocket.onopen = () => {
74
+ this.heart.ack = true;
75
+ };
76
+ }
77
+ async send(priority, message) {
78
+ this.debugger?.info(`[Shard #${this.id}] Sending: ${common_1.GatewayOpcodes[message.op]} ${JSON.stringify(message.d, (_, value) => {
79
+ if (typeof value === 'string')
80
+ return value.replace(this.options.token, v => {
81
+ const split = v.split('.');
82
+ return `${split[0]}.${'*'.repeat(split[1].length)}.${'*'.repeat(split[2].length)}`;
83
+ });
84
+ return value;
85
+ }, 1)}`);
86
+ await this.checkOffline(priority);
87
+ await this.bucket.acquire(priority);
88
+ await this.checkOffline(priority);
89
+ this.websocket?.send(JSON.stringify(message));
90
+ }
91
+ async identify() {
92
+ await this.send(0, {
93
+ op: common_1.GatewayOpcodes.Identify,
94
+ d: {
95
+ token: `Bot ${this.options.token}`,
96
+ compress: this.options.compress,
97
+ properties: constants_1.properties,
98
+ shard: [this.id, this.options.info.shards],
99
+ intents: this.options.intents,
100
+ presence: this.options.presence,
101
+ },
102
+ });
103
+ }
104
+ get resumable() {
105
+ return !!(this.data.resume_gateway_url && this.data.session_id && this.data.resumeSeq !== null);
106
+ }
107
+ async resume() {
108
+ await this.send(0, {
109
+ op: common_1.GatewayOpcodes.Resume,
110
+ d: {
111
+ seq: this.data.resumeSeq,
112
+ session_id: this.data.session_id,
113
+ token: `Bot ${this.options.token}`,
114
+ },
115
+ });
116
+ }
117
+ async heartbeat(requested) {
118
+ this.debugger?.debug(`[Shard #${this.id}] Sending ${requested ? '' : 'un'}requested heartbeat (Ack=${this.heart.ack})`);
119
+ if (!requested) {
120
+ if (!this.heart.ack) {
121
+ await this.close(shared_1.ShardSocketCloseCodes.ZombiedConnection, 'Zombied connection');
122
+ return;
123
+ }
124
+ this.heart.ack = false;
125
+ }
126
+ this.heart.lastBeat = Date.now();
127
+ this.websocket.send(JSON.stringify({
128
+ op: common_1.GatewayOpcodes.Heartbeat,
129
+ d: this.data.resumeSeq ?? null,
130
+ }));
131
+ }
132
+ async disconnect() {
133
+ this.debugger?.info(`[Shard #${this.id}] Disconnecting`);
134
+ await this.close(shared_1.ShardSocketCloseCodes.Shutdown, 'Shard down request');
135
+ }
136
+ async reconnect() {
137
+ this.debugger?.info(`[Shard #${this.id}] Reconnecting`);
138
+ await this.disconnect();
139
+ await this.connect();
140
+ }
141
+ async onpacket(packet) {
142
+ if (packet.s !== null) {
143
+ this.data.resumeSeq = packet.s;
144
+ }
145
+ this.debugger?.debug(`[Shard #${this.id}]`, packet.t ? packet.t : common_1.GatewayOpcodes[packet.op], this.data.resumeSeq);
146
+ switch (packet.op) {
147
+ case common_1.GatewayOpcodes.Hello:
148
+ {
149
+ clearInterval(this.heart.nodeInterval);
150
+ this.heart.interval = packet.d.heartbeat_interval;
151
+ await this.heartbeat(false);
152
+ this.heart.nodeInterval = setInterval(() => this.heartbeat(false), this.heart.interval);
153
+ if (this.resumable) {
154
+ return this.resume();
155
+ }
156
+ await this.identify();
157
+ }
158
+ break;
159
+ case common_1.GatewayOpcodes.HeartbeatAck:
160
+ this.heart.ack = true;
161
+ this.heart.lastAck = Date.now();
162
+ break;
163
+ case common_1.GatewayOpcodes.Heartbeat:
164
+ this.heartbeat(true);
165
+ break;
166
+ case common_1.GatewayOpcodes.Reconnect:
167
+ await this.reconnect();
168
+ break;
169
+ case common_1.GatewayOpcodes.InvalidSession:
170
+ if (packet.d) {
171
+ if (!this.resumable) {
172
+ return this.debugger?.fatal(`[Shard #${this.id}] This is a completely unexpected error message.`);
173
+ }
174
+ await this.resume();
175
+ }
176
+ else {
177
+ this.data.resumeSeq = 0;
178
+ this.data.session_id = undefined;
179
+ await this.identify();
180
+ }
181
+ break;
182
+ case common_1.GatewayOpcodes.Dispatch:
183
+ {
184
+ switch (packet.t) {
185
+ case common_1.GatewayDispatchEvents.Resumed:
186
+ this.offlineSendQueue.toArray().map((resolve) => resolve());
187
+ this.options.handlePayload(this.id, packet);
188
+ break;
189
+ case common_1.GatewayDispatchEvents.Ready: {
190
+ this.data.resume_gateway_url = packet.d.resume_gateway_url;
191
+ this.data.session_id = packet.d.session_id;
192
+ this.offlineSendQueue.toArray().map((resolve) => resolve());
193
+ this.options.handlePayload(this.id, packet);
194
+ break;
195
+ }
196
+ default:
197
+ this.options.handlePayload(this.id, packet);
198
+ break;
199
+ }
200
+ }
201
+ break;
202
+ }
203
+ }
204
+ async handleClosed(close) {
205
+ clearInterval(this.heart.nodeInterval);
206
+ this.debugger?.warn(`[Shard #${this.id}] ${shared_1.ShardSocketCloseCodes[close.code] ?? common_1.GatewayCloseCodes[close.code] ?? close.code} (${close.code})`);
207
+ switch (close.code) {
208
+ case shared_1.ShardSocketCloseCodes.Shutdown:
209
+ break;
210
+ case 1000:
211
+ case 1001:
212
+ case 1006:
213
+ case shared_1.ShardSocketCloseCodes.ZombiedConnection:
214
+ case common_1.GatewayCloseCodes.UnknownError:
215
+ case common_1.GatewayCloseCodes.UnknownOpcode:
216
+ case common_1.GatewayCloseCodes.DecodeError:
217
+ case common_1.GatewayCloseCodes.NotAuthenticated:
218
+ case common_1.GatewayCloseCodes.AlreadyAuthenticated:
219
+ case common_1.GatewayCloseCodes.InvalidSeq:
220
+ case common_1.GatewayCloseCodes.RateLimited:
221
+ case common_1.GatewayCloseCodes.SessionTimedOut:
222
+ this.debugger?.info(`[Shard #${this.id}] Trying to reconnect`);
223
+ await this.reconnect();
224
+ break;
225
+ case common_1.GatewayCloseCodes.AuthenticationFailed:
226
+ case common_1.GatewayCloseCodes.DisallowedIntents:
227
+ case common_1.GatewayCloseCodes.InvalidAPIVersion:
228
+ case common_1.GatewayCloseCodes.InvalidIntents:
229
+ case common_1.GatewayCloseCodes.InvalidShard:
230
+ case common_1.GatewayCloseCodes.ShardingRequired:
231
+ this.debugger?.fatal(`[Shard #${this.id}] cannot reconnect`);
232
+ break;
233
+ default:
234
+ this.debugger?.warn(`[Shard #${this.id}] Unknown close code, trying to reconnect anyways`);
235
+ await this.reconnect();
236
+ break;
237
+ }
238
+ }
239
+ async close(code, reason) {
240
+ if (this.websocket?.readyState !== ws_1.WebSocket.OPEN) {
241
+ return this.debugger?.warn(`[Shard #${this.id}] Is not open`);
242
+ }
243
+ this.debugger?.warn(`[Shard #${this.id}] Called close`);
244
+ this.websocket?.close(code, reason);
245
+ }
246
+ handleMessage({ data }) {
247
+ if (data instanceof Buffer) {
248
+ data = (0, node_zlib_1.inflateSync)(data);
249
+ }
250
+ /**
251
+ * Idk why, but Bun sends this event when websocket connects.
252
+ * MessageEvent {
253
+ * type: "message",
254
+ * data: "Already authenticated."
255
+ * }
256
+ */
257
+ if (data.startsWith('{')) {
258
+ data = JSON.parse(data);
259
+ }
260
+ const packet = data;
261
+ return this.onpacket(packet);
262
+ }
263
+ checkOffline(priority) {
264
+ if (!this.isOpen) {
265
+ return new Promise(resolve => this.offlineSendQueue.push(resolve, priority));
266
+ }
267
+ return Promise.resolve();
268
+ }
269
+ calculateSafeRequests() {
270
+ const safeRequests = this.options.ratelimitOptions.maxRequestsPerRateLimitTick -
271
+ Math.ceil(this.options.ratelimitOptions.rateLimitResetInterval / this.heart.interval) * 2;
272
+ if (safeRequests < 0) {
273
+ return 0;
274
+ }
275
+ return safeRequests;
276
+ }
277
+ }
278
+ exports.Shard = Shard;
@@ -0,0 +1,25 @@
1
+ import { Logger, type GatewaySendPayload, type GatewayUpdatePresence, type GatewayVoiceStateUpdate, type ObjectToLower } from '../../common';
2
+ import { ConnectQueue } from '../structures/timeout';
3
+ import { Shard } from './shard.js';
4
+ import type { ShardManagerOptions } from './shared';
5
+ export declare class ShardManager extends Map<number, Shard> {
6
+ connectQueue: ConnectQueue;
7
+ options: ShardManagerOptions;
8
+ debugger?: Logger;
9
+ constructor(options: ShardManagerOptions);
10
+ get remaining(): number;
11
+ get concurrency(): number;
12
+ get latency(): number;
13
+ calculeShardId(guildId: string): number;
14
+ spawn(shardId: number): Shard;
15
+ spawnShards(): Promise<void>;
16
+ spawnBuckets(): Shard[][];
17
+ forceIdentify(shardId: number): Promise<void>;
18
+ disconnect(shardId: number): Promise<void> | undefined;
19
+ disconnectAll(): Promise<unknown>;
20
+ setShardPresence(shardId: number, payload: GatewayUpdatePresence['d']): void;
21
+ setPresence(payload: GatewayUpdatePresence['d']): Promise<void> | undefined;
22
+ joinVoice(guild_id: string, channel_id: string, options: ObjectToLower<Pick<GatewayVoiceStateUpdate['d'], 'self_deaf' | 'self_mute'>>): void;
23
+ leaveVoice(guild_id: string): void;
24
+ send<T extends GatewaySendPayload>(shardId: number, payload: T): void;
25
+ }
@@ -0,0 +1,153 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ShardManager = void 0;
4
+ const node_worker_threads_1 = require("node:worker_threads");
5
+ const common_1 = require("../../common");
6
+ const constants_1 = require("../constants");
7
+ const structures_1 = require("../structures");
8
+ const timeout_1 = require("../structures/timeout");
9
+ const shard_js_1 = require("./shard.js");
10
+ class ShardManager extends Map {
11
+ connectQueue;
12
+ options;
13
+ debugger;
14
+ constructor(options) {
15
+ super();
16
+ options.totalShards ??= options.info.shards;
17
+ this.options = (0, common_1.MergeOptions)(constants_1.ShardManagerDefaults, options);
18
+ this.connectQueue = new timeout_1.ConnectQueue(5.5e3, this.concurrency);
19
+ if (this.options.debug) {
20
+ this.debugger = new common_1.Logger({
21
+ name: '[ShardManager]',
22
+ logLevel: common_1.LogLevels.Debug,
23
+ });
24
+ }
25
+ }
26
+ get remaining() {
27
+ return this.options.info.session_start_limit.remaining;
28
+ }
29
+ get concurrency() {
30
+ return this.options.info.session_start_limit.max_concurrency;
31
+ }
32
+ get latency() {
33
+ let acc = 0;
34
+ this.forEach(s => (acc += s.latency));
35
+ return acc / this.size;
36
+ }
37
+ calculeShardId(guildId) {
38
+ return Number((BigInt(guildId) >> 22n) % BigInt(this.options.info.shards ?? 1));
39
+ }
40
+ spawn(shardId) {
41
+ this.debugger?.info(`Spawn shard ${shardId}`);
42
+ let shard = this.get(shardId);
43
+ shard ??= new shard_js_1.Shard(shardId, {
44
+ token: this.options.token,
45
+ intents: this.options.intents,
46
+ info: { ...this.options.info, shards: (this.options.shardEnd ?? this.options.totalShards) },
47
+ handlePayload: this.options.handlePayload,
48
+ properties: this.options.properties,
49
+ debugger: this.debugger,
50
+ compress: false,
51
+ presence: this.options.presence?.(shardId, -1),
52
+ });
53
+ this.set(shardId, shard);
54
+ return shard;
55
+ }
56
+ async spawnShards() {
57
+ const buckets = this.spawnBuckets();
58
+ this.debugger?.info('Spawn shards');
59
+ for (const bucket of buckets) {
60
+ for (const shard of bucket) {
61
+ if (!shard) {
62
+ break;
63
+ }
64
+ this.debugger?.info(`${shard.id} add to connect queue`);
65
+ this.connectQueue.push(shard.connect.bind(shard));
66
+ }
67
+ }
68
+ }
69
+ /*
70
+ * spawns buckets in order
71
+ * https://discord.com/developers/docs/topics/gateway#sharding-max-concurrency
72
+ */
73
+ spawnBuckets() {
74
+ this.debugger?.info('#0 Preparing buckets');
75
+ const chunks = structures_1.SequentialBucket.chunk(new Array(this.options.shardStart !== undefined && this.options.shardEnd !== undefined
76
+ ? this.options.shardEnd - this.options.shardStart
77
+ : this.options.totalShards), this.concurrency);
78
+ chunks.forEach((arr, index) => {
79
+ for (let i = 0; i < arr.length; i++) {
80
+ const id = i + (index > 0 ? index * this.concurrency : 0) + (this.options.shardStart ?? 0);
81
+ chunks[index][i] = this.spawn(id);
82
+ }
83
+ });
84
+ this.debugger?.info(`${chunks.length} buckets created`);
85
+ return chunks;
86
+ }
87
+ forceIdentify(shardId) {
88
+ this.debugger?.info(`Shard #${shardId} force identify`);
89
+ return this.spawn(shardId).identify();
90
+ }
91
+ disconnect(shardId) {
92
+ this.debugger?.info(`Shard #${shardId} force disconnect`);
93
+ return this.get(shardId)?.disconnect();
94
+ }
95
+ disconnectAll() {
96
+ this.debugger?.info('Disconnect all shards');
97
+ return new Promise(resolve => {
98
+ this.forEach(shard => shard.disconnect());
99
+ resolve(null);
100
+ });
101
+ }
102
+ setShardPresence(shardId, payload) {
103
+ this.debugger?.info(`Shard #${shardId} update presence`);
104
+ return this.send(shardId, {
105
+ op: common_1.GatewayOpcodes.PresenceUpdate,
106
+ d: payload,
107
+ });
108
+ }
109
+ setPresence(payload) {
110
+ return new Promise(resolve => {
111
+ this.forEach(shard => {
112
+ this.setShardPresence(shard.id, payload);
113
+ }, this);
114
+ resolve();
115
+ });
116
+ }
117
+ joinVoice(guild_id, channel_id, options) {
118
+ const shardId = this.calculeShardId(guild_id);
119
+ this.debugger?.info(`Shard #${shardId} join voice ${channel_id} in ${guild_id}`);
120
+ return this.send(shardId, {
121
+ op: common_1.GatewayOpcodes.VoiceStateUpdate,
122
+ d: {
123
+ guild_id,
124
+ channel_id,
125
+ ...(0, common_1.toSnakeCase)(options),
126
+ },
127
+ });
128
+ }
129
+ leaveVoice(guild_id) {
130
+ const shardId = this.calculeShardId(guild_id);
131
+ this.debugger?.info(`Shard #${shardId} leave voice in ${guild_id}`);
132
+ return this.send(shardId, {
133
+ op: common_1.GatewayOpcodes.VoiceStateUpdate,
134
+ d: {
135
+ guild_id,
136
+ channel_id: null,
137
+ self_mute: false,
138
+ self_deaf: false,
139
+ },
140
+ });
141
+ }
142
+ send(shardId, payload) {
143
+ if (node_worker_threads_1.workerData?.__USING_WATCHER__) {
144
+ return node_worker_threads_1.parentPort?.postMessage({
145
+ type: 'SEND_TO_SHARD',
146
+ shardId,
147
+ payload,
148
+ });
149
+ }
150
+ this.get(shardId)?.send(1, payload);
151
+ }
152
+ }
153
+ exports.ShardManager = ShardManager;
@@ -0,0 +1,99 @@
1
+ import type { APIGatewayBotInfo, GatewayDispatchPayload, GatewayIntentBits, GatewayPresenceUpdateData, Logger } from '../../common';
2
+ import type { IdentifyProperties } from '../constants';
3
+ export interface ShardManagerOptions extends ShardDetails {
4
+ /** Important data which is used by the manager to connect shards to the gateway. */
5
+ info: APIGatewayBotInfo;
6
+ /**
7
+ * Delay in milliseconds to wait before spawning next shard. OPTIMAL IS ABOVE 5100. YOU DON'T WANT TO HIT THE RATE LIMIT!!!
8
+ * @default 5300
9
+ */
10
+ spawnShardDelay?: number;
11
+ /**
12
+ * Total amount of shards your bot uses. Useful for zero-downtime updates or resharding.
13
+ * @default 1
14
+ */
15
+ totalShards?: number;
16
+ shardStart?: number;
17
+ shardEnd?: number;
18
+ /**
19
+ * The payload handlers for messages on the shard.
20
+ */
21
+ handlePayload(shardId: number, packet: GatewayDispatchPayload): unknown;
22
+ /**
23
+ * wheter to send debug information to the console
24
+ */
25
+ debug?: boolean;
26
+ /**
27
+ * Set a presence.
28
+ */
29
+ presence?: (shardId: number, workerId: number) => GatewayPresenceUpdateData;
30
+ compress?: boolean;
31
+ }
32
+ export interface WorkerManagerOptions extends Omit<ShardManagerOptions, 'handlePayload'> {
33
+ workers?: number;
34
+ /**
35
+ * @default 32
36
+ */
37
+ shardsPerWorker?: number;
38
+ path: string;
39
+ handlePayload(shardId: number, workerId: number, packet: GatewayDispatchPayload): unknown;
40
+ }
41
+ export interface ShardData {
42
+ /** resume seq to resume connections */
43
+ resumeSeq: number | null;
44
+ /**
45
+ * resume_gateway_url is the url to resume the connection
46
+ * @link https://discord.com/developers/docs/topics/gateway#ready-event
47
+ */
48
+ resume_gateway_url?: string;
49
+ /**
50
+ * session_id is the unique session id of the gateway
51
+ * do not mistake with the seyfert client which is named Client
52
+ */
53
+ session_id?: string;
54
+ }
55
+ export interface ShardDetails {
56
+ /** Bot token which is used to connect to Discord */
57
+ token: string;
58
+ /**
59
+ * The URL of the gateway which should be connected to.
60
+ * @default "wss://gateway.discord.gg"
61
+ */
62
+ url?: string;
63
+ /**
64
+ * The gateway version which should be used.
65
+ * @default 10
66
+ */
67
+ version?: number;
68
+ /**
69
+ * The calculated intent value of the events which the shard should receive.
70
+ */
71
+ intents: GatewayIntentBits | number;
72
+ /**
73
+ * Identify properties to use
74
+ */
75
+ properties?: IdentifyProperties;
76
+ }
77
+ export interface ShardOptions extends ShardDetails {
78
+ info: APIGatewayBotInfo;
79
+ handlePayload(shardId: number, packet: GatewayDispatchPayload): unknown;
80
+ ratelimitOptions?: {
81
+ maxRequestsPerRateLimitTick: number;
82
+ rateLimitResetInterval: number;
83
+ };
84
+ debugger?: Logger;
85
+ compress: boolean;
86
+ presence?: GatewayPresenceUpdateData;
87
+ }
88
+ export declare enum ShardSocketCloseCodes {
89
+ Shutdown = 3000,
90
+ ZombiedConnection = 3010
91
+ }
92
+ export interface WorkerData {
93
+ intents: number;
94
+ token: string;
95
+ path: string;
96
+ shards: number[];
97
+ workerId: number;
98
+ debug: boolean;
99
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ShardSocketCloseCodes = void 0;
4
+ var ShardSocketCloseCodes;
5
+ (function (ShardSocketCloseCodes) {
6
+ ShardSocketCloseCodes[ShardSocketCloseCodes["Shutdown"] = 3000] = "Shutdown";
7
+ ShardSocketCloseCodes[ShardSocketCloseCodes["ZombiedConnection"] = 3010] = "ZombiedConnection";
8
+ })(ShardSocketCloseCodes || (exports.ShardSocketCloseCodes = ShardSocketCloseCodes = {}));