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,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TYPING_START = void 0;
4
+ const common_1 = require("../../common");
5
+ const structures_1 = require("../../structures");
6
+ const TYPING_START = (self, data) => {
7
+ return data.member
8
+ ? {
9
+ ...(0, common_1.toCamelCase)(data),
10
+ member: new structures_1.GuildMember(self, data.member, data.member.user, data.guild_id),
11
+ }
12
+ : (0, common_1.toCamelCase)(data);
13
+ };
14
+ exports.TYPING_START = TYPING_START;
@@ -0,0 +1,4 @@
1
+ import type { BaseClient } from '../../client/base';
2
+ import type { GatewayUserUpdateDispatchData } from '../../common';
3
+ import { User } from '../../structures';
4
+ export declare const USER_UPDATE: (self: BaseClient, data: GatewayUserUpdateDispatchData) => User;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.USER_UPDATE = void 0;
4
+ const structures_1 = require("../../structures");
5
+ const USER_UPDATE = (self, data) => {
6
+ return new structures_1.User(self, data);
7
+ };
8
+ exports.USER_UPDATE = USER_UPDATE;
@@ -0,0 +1,37 @@
1
+ import type { BaseClient } from '../../client/base';
2
+ import type { GatewayVoiceServerUpdateDispatchData, GatewayVoiceStateUpdateDispatchData } from '../../common';
3
+ import { GuildMember } from '../../structures';
4
+ export declare const VOICE_SERVER_UPDATE: (_self: BaseClient, data: GatewayVoiceServerUpdateDispatchData) => {
5
+ token: string;
6
+ guildId: string;
7
+ endpoint: string | null;
8
+ };
9
+ export declare const VOICE_STATE_UPDATE: (self: BaseClient, data: GatewayVoiceStateUpdateDispatchData) => {
10
+ guildId?: string | undefined;
11
+ channelId: string | null;
12
+ userId: string;
13
+ member?: import("discord-api-types/payloads/v10/guild").APIGuildMember | undefined;
14
+ sessionId: string;
15
+ deaf: boolean;
16
+ mute: boolean;
17
+ selfDeaf: boolean;
18
+ selfMute: boolean;
19
+ selfStream?: boolean | undefined;
20
+ selfVideo: boolean;
21
+ suppress: boolean;
22
+ requestToSpeakTimestamp: string | null;
23
+ } | {
24
+ member: GuildMember;
25
+ guildId?: string | undefined;
26
+ channelId: string | null;
27
+ userId: string;
28
+ sessionId: string;
29
+ deaf: boolean;
30
+ mute: boolean;
31
+ selfDeaf: boolean;
32
+ selfMute: boolean;
33
+ selfStream?: boolean | undefined;
34
+ selfVideo: boolean;
35
+ suppress: boolean;
36
+ requestToSpeakTimestamp: string | null;
37
+ };
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VOICE_STATE_UPDATE = exports.VOICE_SERVER_UPDATE = void 0;
4
+ const common_1 = require("../../common");
5
+ const structures_1 = require("../../structures");
6
+ const VOICE_SERVER_UPDATE = (_self, data) => {
7
+ return (0, common_1.toCamelCase)(data);
8
+ };
9
+ exports.VOICE_SERVER_UPDATE = VOICE_SERVER_UPDATE;
10
+ const VOICE_STATE_UPDATE = (self, data) => {
11
+ return data.member?.user
12
+ ? {
13
+ ...(0, common_1.toCamelCase)(data),
14
+ member: new structures_1.GuildMember(self, data.member, data.member?.user, data.guild_id),
15
+ }
16
+ : (0, common_1.toCamelCase)(data);
17
+ };
18
+ exports.VOICE_STATE_UPDATE = VOICE_STATE_UPDATE;
@@ -0,0 +1,6 @@
1
+ import type { BaseClient } from '../../client/base';
2
+ import type { GatewayWebhooksUpdateDispatchData } from '../../common';
3
+ export declare const WEBHOOKS_UPDATE: (_self: BaseClient, data: GatewayWebhooksUpdateDispatchData) => {
4
+ guildId: string;
5
+ channelId: string;
6
+ };
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WEBHOOKS_UPDATE = void 0;
4
+ const common_1 = require("../../common");
5
+ const WEBHOOKS_UPDATE = (_self, data) => {
6
+ return (0, common_1.toCamelCase)(data);
7
+ };
8
+ exports.WEBHOOKS_UPDATE = WEBHOOKS_UPDATE;
@@ -0,0 +1,2 @@
1
+ export * from './event';
2
+ export * from './handler';
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./event"), exports);
18
+ __exportStar(require("./handler"), exports);
package/lib/index.d.ts ADDED
@@ -0,0 +1,79 @@
1
+ import type { InternalRuntimeConfig, InternalRuntimeConfigHTTP, RuntimeConfig, RuntimeConfigHTTP } from './client/base';
2
+ import type { ClientNameEvents, EventContext } from './events';
3
+ import type { ChatInputCommandInteraction, MessageCommandInteraction, UserCommandInteraction } from './structures';
4
+ export * from './api';
5
+ export * from './builders';
6
+ export * from './client';
7
+ export * from './commands';
8
+ export { Logger, Watcher } from './common';
9
+ export { ComponentCommand, ComponentsListener, ModalCommand } from './components';
10
+ export type { ParseLocales } from './langs';
11
+ export * from './structures';
12
+ export { ShardManager, WorkerManager } from './websocket/discord';
13
+ export declare function throwError(msg: string): never;
14
+ /**
15
+ * Creates an event with the specified data and run function.
16
+ *
17
+ * @param data - The event data.
18
+ * @returns The created event.
19
+ *
20
+ * @example
21
+ * const myEvent = createEvent({
22
+ * data: { name: 'ready', once: true },
23
+ * run: (user, client, shard) => {
24
+ * client.logger.info(`Start ${user.username} on shard #${shard}`);
25
+ * }
26
+ * });
27
+ */
28
+ export declare function createEvent<E extends ClientNameEvents>(data: {
29
+ data: {
30
+ name: E;
31
+ once?: boolean;
32
+ };
33
+ run: (...args: EventContext<{
34
+ data: {
35
+ name: E;
36
+ };
37
+ }>) => any;
38
+ }): {
39
+ data: {
40
+ name: E;
41
+ once?: boolean;
42
+ };
43
+ run: (...args: EventContext<{
44
+ data: {
45
+ name: E;
46
+ };
47
+ }>) => any;
48
+ };
49
+ export declare const config: {
50
+ /**
51
+ * Configurations for the bot.
52
+ *
53
+ * @param data - The runtime configuration data for gateway connections.
54
+ * @returns The internal runtime configuration.
55
+ */
56
+ bot(data: RuntimeConfig): InternalRuntimeConfig;
57
+ /**
58
+ * Configurations for the HTTP server.
59
+ *
60
+ * @param data - The runtime configuration data for http server.
61
+ * @returns The internal runtime configuration for HTTP.
62
+ */
63
+ http(data: RuntimeConfigHTTP): InternalRuntimeConfigHTTP;
64
+ };
65
+ /**
66
+ * Extends the context of a command interaction.
67
+ *
68
+ * @param cb - The callback function to extend the context.
69
+ * @returns The extended context.
70
+ *
71
+ * @example
72
+ * const customContext = extendContext((interaction) => {
73
+ * return {
74
+ * owner: '123456789012345678',
75
+ * // Add your custom properties here
76
+ * };
77
+ * });
78
+ */
79
+ export declare function extendContext<T extends {}>(cb: (interaction: ChatInputCommandInteraction | UserCommandInteraction | MessageCommandInteraction) => T): (interaction: ChatInputCommandInteraction | UserCommandInteraction | MessageCommandInteraction) => T;
package/lib/index.js ADDED
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.extendContext = exports.config = exports.createEvent = exports.throwError = exports.WorkerManager = exports.ShardManager = exports.ModalCommand = exports.ComponentsListener = exports.ComponentCommand = exports.Watcher = exports.Logger = void 0;
18
+ const common_1 = require("./common");
19
+ __exportStar(require("./api"), exports);
20
+ __exportStar(require("./builders"), exports);
21
+ __exportStar(require("./client"), exports);
22
+ __exportStar(require("./commands"), exports);
23
+ var common_2 = require("./common");
24
+ Object.defineProperty(exports, "Logger", { enumerable: true, get: function () { return common_2.Logger; } });
25
+ Object.defineProperty(exports, "Watcher", { enumerable: true, get: function () { return common_2.Watcher; } });
26
+ var components_1 = require("./components");
27
+ Object.defineProperty(exports, "ComponentCommand", { enumerable: true, get: function () { return components_1.ComponentCommand; } });
28
+ Object.defineProperty(exports, "ComponentsListener", { enumerable: true, get: function () { return components_1.ComponentsListener; } });
29
+ Object.defineProperty(exports, "ModalCommand", { enumerable: true, get: function () { return components_1.ModalCommand; } });
30
+ __exportStar(require("./structures"), exports);
31
+ var discord_1 = require("./websocket/discord");
32
+ Object.defineProperty(exports, "ShardManager", { enumerable: true, get: function () { return discord_1.ShardManager; } });
33
+ Object.defineProperty(exports, "WorkerManager", { enumerable: true, get: function () { return discord_1.WorkerManager; } });
34
+ function throwError(msg) {
35
+ throw new Error(msg);
36
+ }
37
+ exports.throwError = throwError;
38
+ /**
39
+ * Creates an event with the specified data and run function.
40
+ *
41
+ * @param data - The event data.
42
+ * @returns The created event.
43
+ *
44
+ * @example
45
+ * const myEvent = createEvent({
46
+ * data: { name: 'ready', once: true },
47
+ * run: (user, client, shard) => {
48
+ * client.logger.info(`Start ${user.username} on shard #${shard}`);
49
+ * }
50
+ * });
51
+ */
52
+ function createEvent(data) {
53
+ data.data.once ??= false;
54
+ return data;
55
+ }
56
+ exports.createEvent = createEvent;
57
+ exports.config = {
58
+ /**
59
+ * Configurations for the bot.
60
+ *
61
+ * @param data - The runtime configuration data for gateway connections.
62
+ * @returns The internal runtime configuration.
63
+ */
64
+ bot(data) {
65
+ return {
66
+ ...data,
67
+ intents: 'intents' in data
68
+ ? typeof data.intents === 'number'
69
+ ? data.intents
70
+ : data.intents?.reduce((pr, acc) => pr | common_1.GatewayIntentBits[acc], 0) ?? 0
71
+ : 0,
72
+ };
73
+ },
74
+ /**
75
+ * Configurations for the HTTP server.
76
+ *
77
+ * @param data - The runtime configuration data for http server.
78
+ * @returns The internal runtime configuration for HTTP.
79
+ */
80
+ http(data) {
81
+ return {
82
+ port: 8080,
83
+ ...data,
84
+ };
85
+ },
86
+ };
87
+ /**
88
+ * Extends the context of a command interaction.
89
+ *
90
+ * @param cb - The callback function to extend the context.
91
+ * @returns The extended context.
92
+ *
93
+ * @example
94
+ * const customContext = extendContext((interaction) => {
95
+ * return {
96
+ * owner: '123456789012345678',
97
+ * // Add your custom properties here
98
+ * };
99
+ * });
100
+ */
101
+ function extendContext(cb) {
102
+ return cb;
103
+ }
104
+ exports.extendContext = extendContext;
@@ -0,0 +1,11 @@
1
+ import type { DefaultLocale } from '../commands';
2
+ import { BaseHandler } from '../common';
3
+ export declare class LangsHandler extends BaseHandler {
4
+ values: Partial<Record<string, any>>;
5
+ protected filter: (path: string) => boolean;
6
+ defaultLang?: string;
7
+ getKey(lang: string, message: string): string | undefined;
8
+ parse(str: string, metadata: Record<string, any>): string;
9
+ get(userLocale: string): DefaultLocale;
10
+ load(dir: string): Promise<void>;
11
+ }
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LangsHandler = void 0;
4
+ const common_1 = require("../common");
5
+ const router_1 = require("./router");
6
+ class LangsHandler extends common_1.BaseHandler {
7
+ values = {};
8
+ filter = (path) => path.endsWith('.js') || path.endsWith('.ts');
9
+ defaultLang;
10
+ getKey(lang, message) {
11
+ let value = this.values[lang];
12
+ for (const i of message.split('.')) {
13
+ value = value[i];
14
+ }
15
+ if (typeof value !== 'string') {
16
+ return undefined;
17
+ }
18
+ return value;
19
+ }
20
+ parse(str, metadata) {
21
+ const regex = /{{(.*?)}}/g;
22
+ return str.replace(regex, match => metadata[match.slice(2, -2)] ?? match);
23
+ }
24
+ get(userLocale) {
25
+ return (0, router_1.LangRouter)(userLocale, this.defaultLang ?? userLocale, this.values)();
26
+ }
27
+ async load(dir) {
28
+ const files = await this.loadFilesK(await this.getFiles(dir));
29
+ for (const i of files) {
30
+ this.values[i.name.slice(0, -3)] = i.file;
31
+ }
32
+ }
33
+ }
34
+ exports.LangsHandler = LangsHandler;
@@ -0,0 +1,2 @@
1
+ export * from './handler';
2
+ export * from './router';
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./handler"), exports);
18
+ __exportStar(require("./router"), exports);
@@ -0,0 +1,18 @@
1
+ import type { DefaultLocale } from '../commands';
2
+ export declare const LangRouter: (userLocale: string, defaultLang: string, langs: Partial<Record<string, any>>) => (route?: string[], args?: any[]) => DefaultLocale;
3
+ type ParseLocale<T extends Record<string, any>> = {
4
+ [K in keyof T]: T[K] extends (...args: any[]) => any ? (...args: Parameters<T[K]>) => {
5
+ get(locale?: string): any;
6
+ } : T[K] extends string ? {
7
+ get(locale?: string): T[K];
8
+ } : T[K] extends unknown[] ? {
9
+ get(locale?: string): T[K];
10
+ } : T[K] extends Record<string, any> ? ParseLocales<T[K]> & {
11
+ get(locale?: string): T[K];
12
+ } : never;
13
+ };
14
+ export type ParseLocales<T extends Record<string, any>> = ParseLocale<T> & {
15
+ get(locale?: string): T;
16
+ };
17
+ export {};
18
+ /**Code inspiration from: FreeAoi */
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LangRouter = void 0;
4
+ const LangRouter = (userLocale, defaultLang, langs) => {
5
+ function createProxy(route = [], args = []) {
6
+ const noop = () => {
7
+ return;
8
+ };
9
+ return new Proxy(noop, {
10
+ get: (_, key) => {
11
+ if (key === 'get') {
12
+ function getValue(locale) {
13
+ if (typeof locale === 'undefined')
14
+ throw new Error('Undefined locale');
15
+ let value = langs[locale];
16
+ for (const i of route)
17
+ value = value[i];
18
+ return value;
19
+ }
20
+ return (locale) => {
21
+ let object;
22
+ try {
23
+ object = getValue(locale ?? userLocale);
24
+ }
25
+ catch {
26
+ object = getValue(defaultLang);
27
+ }
28
+ const value = typeof object === 'function' ? object(...args) : object;
29
+ return value;
30
+ };
31
+ }
32
+ return createProxy([...route, key], args);
33
+ },
34
+ apply: (...[, , args]) => {
35
+ return createProxy(route, args);
36
+ },
37
+ });
38
+ }
39
+ return createProxy;
40
+ };
41
+ exports.LangRouter = LangRouter;
42
+ /**Code inspiration from: FreeAoi */
@@ -0,0 +1,7 @@
1
+ import { BaseGuild } from './extra/BaseGuild';
2
+ /**
3
+ * Class for anonymous guilds.
4
+ * @link https://discord.com/developers/docs/resources/guild#guild-resource
5
+ */
6
+ export declare class AnonymousGuild extends BaseGuild {
7
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AnonymousGuild = void 0;
4
+ const BaseGuild_1 = require("./extra/BaseGuild");
5
+ /**
6
+ * Class for anonymous guilds.
7
+ * @link https://discord.com/developers/docs/resources/guild#guild-resource
8
+ */
9
+ class AnonymousGuild extends BaseGuild_1.BaseGuild {
10
+ }
11
+ exports.AnonymousGuild = AnonymousGuild;
@@ -0,0 +1,22 @@
1
+ import type { BaseClient } from '../client/base';
2
+ import type { APIAutoModerationRule, MethodContext, ObjectToLower, RESTPatchAPIAutoModerationRuleJSONBody, RESTPostAPIAutoModerationRuleJSONBody } from '../common';
3
+ import { DiscordBase } from './extra/DiscordBase';
4
+ export interface AutoModerationRule extends ObjectToLower<APIAutoModerationRule> {
5
+ }
6
+ export declare class AutoModerationRule extends DiscordBase<APIAutoModerationRule> {
7
+ constructor(client: BaseClient, data: APIAutoModerationRule);
8
+ fetchCreator(force?: boolean): Promise<import("./GuildMember").GuildMember>;
9
+ guild(force?: boolean): Promise<import("./Guild").Guild<"cached"> | import("./Guild").Guild<"api">>;
10
+ fetch(): Promise<APIAutoModerationRule>;
11
+ edit(body: ObjectToLower<RESTPatchAPIAutoModerationRuleJSONBody>, reason?: string): Promise<APIAutoModerationRule>;
12
+ delete(reason?: string): Promise<never>;
13
+ static methods({ client, guildId }: MethodContext<{
14
+ guildId: string;
15
+ }>): {
16
+ list: () => Promise<import("discord-api-types/rest/v10/autoModeration").RESTGetAPIAutoModerationRulesResult>;
17
+ create: (body: RESTPostAPIAutoModerationRuleJSONBody) => Promise<APIAutoModerationRule>;
18
+ delete: (ruleId: string, reason?: string) => Promise<never>;
19
+ fetch: (ruleId: string) => Promise<APIAutoModerationRule>;
20
+ edit: (ruleId: string, body: RESTPatchAPIAutoModerationRuleJSONBody, reason?: string) => Promise<APIAutoModerationRule>;
21
+ };
22
+ }
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AutoModerationRule = void 0;
4
+ const DiscordBase_1 = require("./extra/DiscordBase");
5
+ class AutoModerationRule extends DiscordBase_1.DiscordBase {
6
+ constructor(client, data) {
7
+ super(client, data);
8
+ }
9
+ fetchCreator(force = false) {
10
+ return this.client.members.fetch(this.guildId, this.creatorId, force);
11
+ }
12
+ guild(force = false) {
13
+ return this.client.guilds.fetch(this.guildId, force);
14
+ }
15
+ fetch() {
16
+ return this.client.guilds.moderation.fetch(this.guildId, this.id);
17
+ }
18
+ edit(body, reason) {
19
+ return this.client.guilds.moderation.edit(this.guildId, this.id, body, reason);
20
+ }
21
+ delete(reason) {
22
+ return this.client.guilds.moderation.delete(this.guildId, this.id, reason);
23
+ }
24
+ static methods({ client, guildId }) {
25
+ return {
26
+ list: () => client.guilds.moderation.list(guildId),
27
+ create: (body) => client.guilds.moderation.create(guildId, body),
28
+ delete: (ruleId, reason) => client.guilds.moderation.delete(guildId, ruleId, reason),
29
+ fetch: (ruleId) => client.guilds.moderation.fetch(guildId, ruleId),
30
+ edit: (ruleId, body, reason) => client.guilds.moderation.edit(guildId, ruleId, body, reason),
31
+ };
32
+ }
33
+ }
34
+ exports.AutoModerationRule = AutoModerationRule;
@@ -0,0 +1,25 @@
1
+ import type { BaseClient } from '../client/base';
2
+ import type { GatewayReadyDispatchData, MethodContext, RESTGetAPICurrentUserGuildsQuery, RESTPatchAPICurrentUserJSONBody } from '../common';
3
+ import { AnonymousGuild } from './AnonymousGuild';
4
+ import { Guild } from './Guild';
5
+ import { GuildMember } from './GuildMember';
6
+ import { User } from './User';
7
+ export declare class ClientUser extends User {
8
+ application: GatewayReadyDispatchData['application'];
9
+ bot: boolean;
10
+ constructor(client: BaseClient, data: GatewayReadyDispatchData['user'], application: GatewayReadyDispatchData['application']);
11
+ fetch(): Promise<ClientUser>;
12
+ edit(body: RESTPatchAPICurrentUserJSONBody): Promise<ClientUser>;
13
+ guilds: {
14
+ list: (query?: RESTGetAPICurrentUserGuildsQuery) => Promise<AnonymousGuild[]>;
15
+ fetch: (id: string) => Promise<Guild<"api">>;
16
+ fetchSelf: (id: string) => Promise<GuildMember>;
17
+ leave: (id: string) => Promise<void | undefined>;
18
+ };
19
+ static guilds(ctx: MethodContext): {
20
+ list: (query?: RESTGetAPICurrentUserGuildsQuery) => Promise<AnonymousGuild[]>;
21
+ fetch: (id: string) => Promise<Guild<"api">>;
22
+ fetchSelf: (id: string) => Promise<GuildMember>;
23
+ leave: (id: string) => Promise<void | undefined>;
24
+ };
25
+ }
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ClientUser = void 0;
4
+ const AnonymousGuild_1 = require("./AnonymousGuild");
5
+ const Guild_1 = require("./Guild");
6
+ const GuildMember_1 = require("./GuildMember");
7
+ const User_1 = require("./User");
8
+ class ClientUser extends User_1.User {
9
+ application;
10
+ bot = true;
11
+ constructor(client, data, application) {
12
+ super(client, data);
13
+ this.application = application;
14
+ }
15
+ async fetch() {
16
+ const data = await this.api.users('@me').get();
17
+ return new ClientUser(this.client, data, this.application);
18
+ }
19
+ async edit(body) {
20
+ const data = await this.api.users('@me').patch({ body });
21
+ return new ClientUser(this.client, data, this.application);
22
+ }
23
+ guilds = ClientUser.guilds(this);
24
+ static guilds(ctx) {
25
+ return {
26
+ list: (query) => {
27
+ return ctx.client.proxy
28
+ .users('@me')
29
+ .guilds.get({ query })
30
+ .then(guilds => guilds.map(guild => new AnonymousGuild_1.AnonymousGuild(ctx.client, { ...guild, splash: null })));
31
+ },
32
+ fetch: async (id) => {
33
+ const guild = await ctx.client.proxy.guilds(id).get();
34
+ await ctx.client.cache.guilds?.patch(id, guild);
35
+ return new Guild_1.Guild(ctx.client, guild);
36
+ },
37
+ fetchSelf: async (id) => {
38
+ const self = await ctx.client.proxy.users('@me').guilds(id).member.get();
39
+ await ctx.client.cache.members?.patch(self.user.id, id, self);
40
+ return new GuildMember_1.GuildMember(ctx.client, self, self.user, id);
41
+ },
42
+ leave: (id) => {
43
+ return ctx.client.proxy
44
+ .users('@me')
45
+ .guilds(id)
46
+ .delete()
47
+ .then(() => ctx.client.cache.guilds?.removeIfNI('Guilds', id));
48
+ },
49
+ };
50
+ }
51
+ }
52
+ exports.ClientUser = ClientUser;