seyfert 2.0.0 → 2.1.1-dev-11310514874.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 (265) hide show
  1. package/lib/api/Router.d.ts +2 -2
  2. package/lib/api/Router.js +2 -1
  3. package/lib/api/Routes/applications.d.ts +29 -30
  4. package/lib/api/Routes/cdn.d.ts +6 -1
  5. package/lib/api/Routes/channels.d.ts +44 -45
  6. package/lib/api/Routes/gateway.d.ts +3 -4
  7. package/lib/api/Routes/guilds.d.ts +81 -80
  8. package/lib/api/Routes/index.d.ts +3 -1
  9. package/lib/api/Routes/interactions.d.ts +9 -3
  10. package/lib/api/Routes/invites.d.ts +3 -4
  11. package/lib/api/Routes/skus.d.ts +10 -0
  12. package/lib/api/Routes/skus.js +2 -0
  13. package/lib/api/Routes/soundboard.d.ts +23 -0
  14. package/lib/api/Routes/soundboard.js +2 -0
  15. package/lib/api/Routes/stage-instances.d.ts +5 -6
  16. package/lib/api/Routes/stickers.d.ts +3 -4
  17. package/lib/api/Routes/users.d.ts +11 -12
  18. package/lib/api/Routes/voice.d.ts +2 -3
  19. package/lib/api/Routes/webhooks.d.ts +16 -15
  20. package/lib/api/api.d.ts +17 -11
  21. package/lib/api/api.js +26 -22
  22. package/lib/api/shared.d.ts +2 -2
  23. package/lib/api/utils/constants.d.ts +3 -1
  24. package/lib/api/utils/constants.js +3 -2
  25. package/lib/builders/ActionRow.d.ts +1 -1
  26. package/lib/builders/Attachment.d.ts +3 -3
  27. package/lib/builders/Attachment.js +13 -13
  28. package/lib/builders/Button.d.ts +1 -1
  29. package/lib/builders/Button.js +1 -1
  30. package/lib/builders/Embed.d.ts +1 -1
  31. package/lib/builders/Embed.js +2 -2
  32. package/lib/builders/Modal.d.ts +1 -1
  33. package/lib/builders/Poll.d.ts +1 -1
  34. package/lib/builders/Poll.js +1 -1
  35. package/lib/builders/SelectMenu.d.ts +1 -1
  36. package/lib/builders/SelectMenu.js +1 -1
  37. package/lib/builders/types.d.ts +2 -1
  38. package/lib/cache/adapters/default.js +5 -3
  39. package/lib/cache/adapters/limited.d.ts +1 -2
  40. package/lib/cache/adapters/limited.js +34 -30
  41. package/lib/cache/adapters/workeradapter.js +3 -1
  42. package/lib/cache/index.d.ts +12 -12
  43. package/lib/cache/index.js +48 -39
  44. package/lib/cache/resources/bans.d.ts +2 -2
  45. package/lib/cache/resources/bans.js +1 -1
  46. package/lib/cache/resources/channels.d.ts +1 -1
  47. package/lib/cache/resources/default/guild-related.d.ts +1 -2
  48. package/lib/cache/resources/emojis.d.ts +2 -2
  49. package/lib/cache/resources/emojis.js +1 -1
  50. package/lib/cache/resources/guilds.d.ts +2 -2
  51. package/lib/cache/resources/guilds.js +7 -11
  52. package/lib/cache/resources/members.d.ts +2 -2
  53. package/lib/cache/resources/members.js +1 -1
  54. package/lib/cache/resources/messages.d.ts +2 -2
  55. package/lib/cache/resources/messages.js +3 -3
  56. package/lib/cache/resources/overwrites.d.ts +1 -1
  57. package/lib/cache/resources/roles.d.ts +2 -2
  58. package/lib/cache/resources/roles.js +1 -1
  59. package/lib/cache/resources/stickers.d.ts +2 -2
  60. package/lib/cache/resources/stickers.js +1 -1
  61. package/lib/cache/resources/users.d.ts +2 -2
  62. package/lib/cache/resources/users.js +1 -1
  63. package/lib/cache/resources/voice-states.d.ts +2 -2
  64. package/lib/cache/resources/voice-states.js +1 -1
  65. package/lib/client/base.d.ts +10 -15
  66. package/lib/client/base.js +48 -44
  67. package/lib/client/client.d.ts +4 -4
  68. package/lib/client/client.js +37 -38
  69. package/lib/client/collectors.js +1 -1
  70. package/lib/client/httpclient.d.ts +1 -1
  71. package/lib/client/httpclient.js +2 -2
  72. package/lib/client/transformers.d.ts +37 -34
  73. package/lib/client/transformers.js +66 -63
  74. package/lib/client/workerclient.d.ts +13 -13
  75. package/lib/client/workerclient.js +182 -65
  76. package/lib/collection.d.ts +3 -3
  77. package/lib/commands/applications/chat.d.ts +3 -3
  78. package/lib/commands/applications/chat.js +5 -6
  79. package/lib/commands/applications/chatcontext.d.ts +6 -6
  80. package/lib/commands/applications/chatcontext.js +16 -8
  81. package/lib/commands/applications/entryPoint.d.ts +46 -0
  82. package/lib/commands/applications/entryPoint.js +56 -0
  83. package/lib/commands/applications/entrycontext.d.ts +40 -0
  84. package/lib/commands/applications/entrycontext.js +85 -0
  85. package/lib/commands/applications/menu.d.ts +1 -1
  86. package/lib/commands/applications/menucontext.d.ts +5 -5
  87. package/lib/commands/applications/menucontext.js +6 -6
  88. package/lib/commands/applications/options.d.ts +7 -6
  89. package/lib/commands/applications/shared.d.ts +5 -2
  90. package/lib/commands/basecontext.d.ts +1 -1
  91. package/lib/commands/decorators.d.ts +20 -26
  92. package/lib/commands/decorators.js +8 -4
  93. package/lib/commands/handle.d.ts +13 -12
  94. package/lib/commands/handle.js +133 -65
  95. package/lib/commands/handler.d.ts +9 -7
  96. package/lib/commands/handler.js +27 -18
  97. package/lib/commands/index.d.ts +2 -0
  98. package/lib/commands/index.js +2 -0
  99. package/lib/commands/optionresolver.d.ts +4 -4
  100. package/lib/commands/optionresolver.js +4 -4
  101. package/lib/common/bot/watcher.d.ts +1 -1
  102. package/lib/common/it/formatter.d.ts +21 -21
  103. package/lib/common/it/formatter.js +40 -41
  104. package/lib/common/it/logger.js +1 -1
  105. package/lib/common/it/utils.d.ts +14 -6
  106. package/lib/common/it/utils.js +62 -27
  107. package/lib/common/shorters/application.d.ts +2 -3
  108. package/lib/common/shorters/application.js +3 -3
  109. package/lib/common/shorters/bans.js +1 -1
  110. package/lib/common/shorters/channels.d.ts +3 -3
  111. package/lib/common/shorters/channels.js +3 -3
  112. package/lib/common/shorters/emojis.js +4 -4
  113. package/lib/common/shorters/guilds.d.ts +3 -3
  114. package/lib/common/shorters/guilds.js +5 -9
  115. package/lib/common/shorters/interaction.d.ts +3 -3
  116. package/lib/common/shorters/interaction.js +6 -5
  117. package/lib/common/shorters/members.d.ts +4 -5
  118. package/lib/common/shorters/members.js +6 -7
  119. package/lib/common/shorters/messages.d.ts +1 -1
  120. package/lib/common/shorters/messages.js +4 -4
  121. package/lib/common/shorters/reactions.d.ts +1 -1
  122. package/lib/common/shorters/reactions.js +1 -1
  123. package/lib/common/shorters/roles.js +1 -1
  124. package/lib/common/shorters/templates.js +2 -2
  125. package/lib/common/shorters/threads.d.ts +1 -1
  126. package/lib/common/shorters/threads.js +17 -11
  127. package/lib/common/shorters/webhook.d.ts +1 -1
  128. package/lib/common/shorters/webhook.js +4 -4
  129. package/lib/common/types/options.d.ts +2 -2
  130. package/lib/common/types/resolvables.d.ts +1 -1
  131. package/lib/common/types/util.d.ts +4 -1
  132. package/lib/common/types/write.d.ts +3 -3
  133. package/lib/components/BaseComponent.js +1 -1
  134. package/lib/components/ButtonComponent.d.ts +1 -1
  135. package/lib/components/componentcommand.d.ts +1 -1
  136. package/lib/components/componentcontext.d.ts +4 -4
  137. package/lib/components/componentcontext.js +1 -1
  138. package/lib/components/handler.d.ts +10 -8
  139. package/lib/components/handler.js +16 -13
  140. package/lib/components/index.js +2 -1
  141. package/lib/components/modalcontext.d.ts +2 -2
  142. package/lib/components/modalcontext.js +1 -1
  143. package/lib/deps/mixer.d.ts +1 -1
  144. package/lib/deps/mixer.js +6 -1
  145. package/lib/events/handler.d.ts +5 -5
  146. package/lib/events/handler.js +69 -19
  147. package/lib/events/hooks/application_command.d.ts +1 -1
  148. package/lib/events/hooks/auto_moderation.d.ts +1 -1
  149. package/lib/events/hooks/auto_moderation.js +1 -1
  150. package/lib/events/hooks/channel.d.ts +1 -1
  151. package/lib/events/hooks/custom.d.ts +1 -0
  152. package/lib/events/hooks/custom.js +5 -1
  153. package/lib/events/hooks/dispatch.d.ts +1 -1
  154. package/lib/events/hooks/entitlement.d.ts +4 -5
  155. package/lib/events/hooks/entitlement.js +4 -4
  156. package/lib/events/hooks/guild.d.ts +3 -3
  157. package/lib/events/hooks/guild.js +1 -1
  158. package/lib/events/hooks/index.d.ts +1 -0
  159. package/lib/events/hooks/index.js +1 -0
  160. package/lib/events/hooks/integration.d.ts +1 -1
  161. package/lib/events/hooks/integration.js +1 -1
  162. package/lib/events/hooks/interactions.d.ts +3 -3
  163. package/lib/events/hooks/invite.d.ts +1 -1
  164. package/lib/events/hooks/message.d.ts +3 -3
  165. package/lib/events/hooks/message.js +1 -1
  166. package/lib/events/hooks/presence.d.ts +2 -2
  167. package/lib/events/hooks/soundboard.d.ts +155 -0
  168. package/lib/events/hooks/soundboard.js +28 -0
  169. package/lib/events/hooks/stage.d.ts +2 -2
  170. package/lib/events/hooks/subscriptions.d.ts +35 -0
  171. package/lib/events/hooks/subscriptions.js +16 -0
  172. package/lib/events/hooks/thread.d.ts +2 -2
  173. package/lib/events/hooks/thread.js +2 -2
  174. package/lib/events/hooks/typing.d.ts +1 -1
  175. package/lib/events/hooks/typing.js +1 -1
  176. package/lib/events/hooks/user.d.ts +2 -2
  177. package/lib/events/hooks/voice.d.ts +2 -2
  178. package/lib/events/hooks/voice.js +1 -1
  179. package/lib/events/hooks/webhook.d.ts +1 -1
  180. package/lib/index.d.ts +2 -2
  181. package/lib/index.js +3 -5
  182. package/lib/langs/handler.d.ts +2 -2
  183. package/lib/structures/Guild.d.ts +7 -4
  184. package/lib/structures/Guild.js +1 -1
  185. package/lib/structures/GuildBan.d.ts +1 -1
  186. package/lib/structures/GuildMember.d.ts +7 -5
  187. package/lib/structures/GuildMember.js +5 -3
  188. package/lib/structures/GuildRole.d.ts +1 -1
  189. package/lib/structures/GuildTemplate.d.ts +1 -1
  190. package/lib/structures/Interaction.d.ts +39 -16
  191. package/lib/structures/Interaction.js +82 -26
  192. package/lib/structures/Message.d.ts +4 -10
  193. package/lib/structures/Message.js +5 -8
  194. package/lib/structures/Poll.d.ts +3 -3
  195. package/lib/structures/Sticker.d.ts +2 -2
  196. package/lib/structures/Sticker.js +1 -1
  197. package/lib/structures/VoiceState.d.ts +2 -1
  198. package/lib/structures/VoiceState.js +1 -1
  199. package/lib/structures/Webhook.d.ts +3 -3
  200. package/lib/structures/Webhook.js +1 -1
  201. package/lib/structures/channels.d.ts +4 -4
  202. package/lib/structures/channels.js +8 -7
  203. package/lib/structures/extra/BaseGuild.d.ts +11 -1
  204. package/lib/structures/extra/BaseGuild.js +27 -0
  205. package/lib/structures/extra/BitField.d.ts +3 -3
  206. package/lib/structures/extra/BitField.js +34 -33
  207. package/lib/structures/extra/DiscordBase.js +1 -1
  208. package/lib/structures/extra/Permissions.d.ts +2 -0
  209. package/lib/structures/extra/Permissions.js +21 -0
  210. package/lib/types/gateway.d.ts +71 -6
  211. package/lib/types/payloads/_interactions/_applicationCommands/chatInput.d.ts +6 -1
  212. package/lib/types/payloads/_interactions/applicationCommands.d.ts +41 -6
  213. package/lib/types/payloads/_interactions/applicationCommands.js +28 -1
  214. package/lib/types/payloads/_interactions/base.d.ts +1 -1
  215. package/lib/types/payloads/_interactions/responses.d.ts +74 -2
  216. package/lib/types/payloads/_interactions/responses.js +4 -0
  217. package/lib/types/payloads/channel.d.ts +46 -6
  218. package/lib/types/payloads/channel.js +5 -1
  219. package/lib/types/payloads/guild.d.ts +9 -1
  220. package/lib/types/payloads/guild.js +8 -0
  221. package/lib/types/payloads/index.d.ts +1 -0
  222. package/lib/types/payloads/index.js +1 -0
  223. package/lib/types/payloads/monetization.d.ts +29 -1
  224. package/lib/types/payloads/monetization.js +10 -1
  225. package/lib/types/payloads/soundboard.d.ts +23 -0
  226. package/lib/types/payloads/soundboard.js +5 -0
  227. package/lib/types/payloads/user.js +0 -1
  228. package/lib/types/rest/application.d.ts +3 -3
  229. package/lib/types/rest/auditLog.d.ts +1 -1
  230. package/lib/types/rest/channel.d.ts +5 -18
  231. package/lib/types/rest/guild.d.ts +2 -2
  232. package/lib/types/rest/guildScheduledEvent.d.ts +1 -1
  233. package/lib/types/rest/index.d.ts +1 -0
  234. package/lib/types/rest/index.js +1 -0
  235. package/lib/types/rest/interactions.d.ts +30 -8
  236. package/lib/types/rest/monetization.d.ts +22 -1
  237. package/lib/types/rest/oauth2.d.ts +1 -1
  238. package/lib/types/rest/poll.d.ts +1 -1
  239. package/lib/types/rest/soundboard.d.ts +64 -0
  240. package/lib/types/rest/soundboard.js +2 -0
  241. package/lib/types/rest/stageInstance.d.ts +1 -1
  242. package/lib/types/rest/template.d.ts +1 -1
  243. package/lib/types/rest/user.d.ts +1 -1
  244. package/lib/types/rest/webhook.d.ts +3 -3
  245. package/lib/types/utils/index.d.ts +27 -7
  246. package/lib/types/utils/index.js +25 -6
  247. package/lib/websocket/SharedTypes.d.ts +18 -3
  248. package/lib/websocket/constants/index.d.ts +3 -2
  249. package/lib/websocket/constants/index.js +4 -4
  250. package/lib/websocket/discord/basesocket.d.ts +1 -1
  251. package/lib/websocket/discord/shard.d.ts +4 -3
  252. package/lib/websocket/discord/shard.js +47 -24
  253. package/lib/websocket/discord/sharder.d.ts +9 -6
  254. package/lib/websocket/discord/sharder.js +92 -17
  255. package/lib/websocket/discord/shared.d.ts +12 -3
  256. package/lib/websocket/discord/socket/custom.d.ts +1 -1
  257. package/lib/websocket/discord/socket/custom.js +70 -40
  258. package/lib/websocket/discord/worker.d.ts +9 -2
  259. package/lib/websocket/discord/workermanager.d.ts +42 -16
  260. package/lib/websocket/discord/workermanager.js +170 -46
  261. package/lib/websocket/structures/timeout.d.ts +4 -5
  262. package/lib/websocket/structures/timeout.js +23 -24
  263. package/package.json +72 -65
  264. package/lib/cache/resources/threads.d.ts +0 -14
  265. package/lib/cache/resources/threads.js +0 -32
@@ -59,69 +59,69 @@ type Timestamp = `<t:${number}:${TimestampStyle}>`;
59
59
  /**
60
60
  * Represents a formatter utility for formatting content.
61
61
  */
62
- export declare class Formatter {
62
+ export declare const Formatter: {
63
63
  /**
64
64
  * Formats a code block.
65
65
  * @param content The content of the code block.
66
66
  * @param language The language of the code block. Defaults to 'txt'.
67
67
  * @returns The formatted code block.
68
68
  */
69
- static codeBlock(content: string, language?: string): string;
69
+ codeBlock(content: string, language?: string): string;
70
70
  /**
71
71
  * Formats content into inline code.
72
72
  * @param content The content to format.
73
73
  * @returns The formatted content.
74
74
  */
75
- static inlineCode(content: string): `\`${string}\``;
75
+ inlineCode(content: string): `\`${string}\``;
76
76
  /**
77
77
  * Formats content into bold text.
78
78
  * @param content The content to format.
79
79
  * @returns The formatted content.
80
80
  */
81
- static bold(content: string): `**${string}**`;
81
+ bold(content: string): `**${string}**`;
82
82
  /**
83
83
  * Formats content into italic text.
84
84
  * @param content The content to format.
85
85
  * @returns The formatted content.
86
86
  */
87
- static italic(content: string): `*${string}*`;
87
+ italic(content: string): `*${string}*`;
88
88
  /**
89
89
  * Formats content into underlined text.
90
90
  * @param content The content to format.
91
91
  * @returns The formatted content.
92
92
  */
93
- static underline(content: string): `__${string}__`;
93
+ underline(content: string): `__${string}__`;
94
94
  /**
95
95
  * Formats content into strikethrough text.
96
96
  * @param content The content to format.
97
97
  * @returns The formatted content.
98
98
  */
99
- static strikeThrough(content: string): `~~${string}~~`;
99
+ strikeThrough(content: string): `~~${string}~~`;
100
100
  /**
101
101
  * Formats content into a hyperlink.
102
102
  * @param content The content to format.
103
103
  * @param url The URL to hyperlink to.
104
104
  * @returns The formatted content.
105
105
  */
106
- static hyperlink(content: string, url: string): `[${string}](${string})`;
106
+ hyperlink(content: string, url: string): `[${string}](${string})`;
107
107
  /**
108
108
  * Formats content into a spoiler.
109
109
  * @param content The content to format.
110
110
  * @returns The formatted content.
111
111
  */
112
- static spoiler(content: string): `||${string}||`;
112
+ spoiler(content: string): `||${string}||`;
113
113
  /**
114
114
  * Formats content into a quote.
115
115
  * @param content The content to format.
116
116
  * @returns The formatted content.
117
117
  */
118
- static blockQuote(content: string): string;
118
+ blockQuote(content: string): string;
119
119
  /**
120
120
  * Formats content into a quote.
121
121
  * @param content The content to format.
122
122
  * @returns The formatted content.
123
123
  */
124
- static quote(content: string): string;
124
+ quote(content: string): string;
125
125
  /**
126
126
  * Formats a message link.
127
127
  * @param guildId The ID of the guild.
@@ -129,59 +129,59 @@ export declare class Formatter {
129
129
  * @param messageId The ID of the message.
130
130
  * @returns The formatted message link.
131
131
  */
132
- static messageLink(guildId: string, channelId: string, messageId: string): MessageLink;
132
+ messageLink(guildId: string, channelId: string, messageId: string): MessageLink;
133
133
  /**
134
134
  * Formats a header.
135
135
  * @param content The content of the header.
136
136
  * @param level The level of the header. Defaults to 1.
137
137
  * @returns The formatted header.
138
138
  */
139
- static header(content: string, level?: HeadingLevel): string;
139
+ header(content: string, level?: HeadingLevel): string;
140
140
  /**
141
141
  * Formats a list.
142
142
  * @param items The items of the list.
143
143
  * @param ordered Whether the list is ordered. Defaults to false.
144
144
  * @returns The formatted list.
145
145
  */
146
- static list(items: string[], ordered?: boolean): string;
146
+ list(items: string[], ordered?: boolean): string;
147
147
  /**
148
148
  * Formats the given timestamp into discord unix timestamp format.
149
149
  * @param timestamp The timestamp to format.
150
150
  * @param style The style of the timestamp. Defaults to 't'.
151
151
  * @returns The formatted timestamp.
152
152
  */
153
- static timestamp(timestamp: Date, style?: TimestampStyle): Timestamp;
153
+ timestamp(timestamp: Date, style?: TimestampStyle): Timestamp;
154
154
  /**
155
155
  * Formats a user mention.
156
156
  * @param userId The ID of the user to mention.
157
157
  * @returns The formatted user mention.
158
158
  */
159
- static userMention(userId: string): `<@${string}>`;
159
+ userMention(userId: string): `<@${string}>`;
160
160
  /**
161
161
  * Formats a role mention.
162
162
  * @param roleId The ID of the role to mention.
163
163
  * @returns The formatted role mention.
164
164
  */
165
- static roleMention(roleId: string): `<@&${string}>`;
165
+ roleMention(roleId: string): `<@&${string}>`;
166
166
  /**
167
167
  * Formats a channel mention.
168
168
  * @param channelId The ID of the channel to mention.
169
169
  * @returns The formatted channel mention.
170
170
  */
171
- static channelMention(channelId: string): `<#${string}>`;
171
+ channelMention(channelId: string): `<#${string}>`;
172
172
  /**
173
173
  * Formats an emoji.
174
174
  * @param emojiId The ID of the emoji.
175
175
  * @param animated Whether the emoji is animated. Defaults to false.
176
176
  * @returns The formatted emoji.
177
177
  */
178
- static emojiMention(emojiId: string, name: string | null, animated?: boolean): string;
178
+ emojiMention(emojiId: string, name: string | null, animated?: boolean): string;
179
179
  /**
180
180
  * Formats a channel link.
181
181
  * @param channelId The ID of the channel.
182
182
  * @param guildId The ID of the guild. Defaults to '@me'.
183
183
  * @returns The formatted channel link.
184
184
  */
185
- static channelLink(channelId: string, guildId?: string): string;
186
- }
185
+ channelLink(channelId: string, guildId?: string): string;
186
+ };
187
187
  export {};
@@ -56,89 +56,89 @@ var TimestampStyle;
56
56
  /**
57
57
  * Represents a formatter utility for formatting content.
58
58
  */
59
- class Formatter {
59
+ exports.Formatter = {
60
60
  /**
61
61
  * Formats a code block.
62
62
  * @param content The content of the code block.
63
63
  * @param language The language of the code block. Defaults to 'txt'.
64
64
  * @returns The formatted code block.
65
65
  */
66
- static codeBlock(content, language = 'txt') {
66
+ codeBlock(content, language = 'txt') {
67
67
  return `\`\`\`${language}\n${content}\n\`\`\``;
68
- }
68
+ },
69
69
  /**
70
70
  * Formats content into inline code.
71
71
  * @param content The content to format.
72
72
  * @returns The formatted content.
73
73
  */
74
- static inlineCode(content) {
74
+ inlineCode(content) {
75
75
  return `\`${content}\``;
76
- }
76
+ },
77
77
  /**
78
78
  * Formats content into bold text.
79
79
  * @param content The content to format.
80
80
  * @returns The formatted content.
81
81
  */
82
- static bold(content) {
82
+ bold(content) {
83
83
  return `**${content}**`;
84
- }
84
+ },
85
85
  /**
86
86
  * Formats content into italic text.
87
87
  * @param content The content to format.
88
88
  * @returns The formatted content.
89
89
  */
90
- static italic(content) {
90
+ italic(content) {
91
91
  return `*${content}*`;
92
- }
92
+ },
93
93
  /**
94
94
  * Formats content into underlined text.
95
95
  * @param content The content to format.
96
96
  * @returns The formatted content.
97
97
  */
98
- static underline(content) {
98
+ underline(content) {
99
99
  return `__${content}__`;
100
- }
100
+ },
101
101
  /**
102
102
  * Formats content into strikethrough text.
103
103
  * @param content The content to format.
104
104
  * @returns The formatted content.
105
105
  */
106
- static strikeThrough(content) {
106
+ strikeThrough(content) {
107
107
  return `~~${content}~~`;
108
- }
108
+ },
109
109
  /**
110
110
  * Formats content into a hyperlink.
111
111
  * @param content The content to format.
112
112
  * @param url The URL to hyperlink to.
113
113
  * @returns The formatted content.
114
114
  */
115
- static hyperlink(content, url) {
115
+ hyperlink(content, url) {
116
116
  return `[${content}](${url})`;
117
- }
117
+ },
118
118
  /**
119
119
  * Formats content into a spoiler.
120
120
  * @param content The content to format.
121
121
  * @returns The formatted content.
122
122
  */
123
- static spoiler(content) {
123
+ spoiler(content) {
124
124
  return `||${content}||`;
125
- }
125
+ },
126
126
  /**
127
127
  * Formats content into a quote.
128
128
  * @param content The content to format.
129
129
  * @returns The formatted content.
130
130
  */
131
- static blockQuote(content) {
131
+ blockQuote(content) {
132
132
  return `>>> ${content}`;
133
- }
133
+ },
134
134
  /**
135
135
  * Formats content into a quote.
136
136
  * @param content The content to format.
137
137
  * @returns The formatted content.
138
138
  */
139
- static quote(content) {
139
+ quote(content) {
140
140
  return `> ${content}`;
141
- }
141
+ },
142
142
  /**
143
143
  * Formats a message link.
144
144
  * @param guildId The ID of the guild.
@@ -146,81 +146,80 @@ class Formatter {
146
146
  * @param messageId The ID of the message.
147
147
  * @returns The formatted message link.
148
148
  */
149
- static messageLink(guildId, channelId, messageId) {
149
+ messageLink(guildId, channelId, messageId) {
150
150
  return `https://discord.com/channels/${guildId}/${channelId}/${messageId}`;
151
- }
151
+ },
152
152
  /**
153
153
  * Formats a header.
154
154
  * @param content The content of the header.
155
155
  * @param level The level of the header. Defaults to 1.
156
156
  * @returns The formatted header.
157
157
  */
158
- static header(content, level = HeadingLevel.H1) {
158
+ header(content, level = HeadingLevel.H1) {
159
159
  return `${'#'.repeat(level)} ${content}`;
160
- }
160
+ },
161
161
  /**
162
162
  * Formats a list.
163
163
  * @param items The items of the list.
164
164
  * @param ordered Whether the list is ordered. Defaults to false.
165
165
  * @returns The formatted list.
166
166
  */
167
- static list(items, ordered = false) {
167
+ list(items, ordered = false) {
168
168
  return items
169
169
  .map((item, index) => {
170
170
  return (ordered ? `${index + 1}. ` : '- ') + item;
171
171
  })
172
172
  .join('\n');
173
- }
173
+ },
174
174
  /**
175
175
  * Formats the given timestamp into discord unix timestamp format.
176
176
  * @param timestamp The timestamp to format.
177
177
  * @param style The style of the timestamp. Defaults to 't'.
178
178
  * @returns The formatted timestamp.
179
179
  */
180
- static timestamp(timestamp, style = TimestampStyle.RelativeTime) {
180
+ timestamp(timestamp, style = TimestampStyle.RelativeTime) {
181
181
  return `<t:${Math.floor(timestamp.getTime() / 1000)}:${style}>`;
182
- }
182
+ },
183
183
  /**
184
184
  * Formats a user mention.
185
185
  * @param userId The ID of the user to mention.
186
186
  * @returns The formatted user mention.
187
187
  */
188
- static userMention(userId) {
188
+ userMention(userId) {
189
189
  return `<@${userId}>`;
190
- }
190
+ },
191
191
  /**
192
192
  * Formats a role mention.
193
193
  * @param roleId The ID of the role to mention.
194
194
  * @returns The formatted role mention.
195
195
  */
196
- static roleMention(roleId) {
196
+ roleMention(roleId) {
197
197
  return `<@&${roleId}>`;
198
- }
198
+ },
199
199
  /**
200
200
  * Formats a channel mention.
201
201
  * @param channelId The ID of the channel to mention.
202
202
  * @returns The formatted channel mention.
203
203
  */
204
- static channelMention(channelId) {
204
+ channelMention(channelId) {
205
205
  return `<#${channelId}>`;
206
- }
206
+ },
207
207
  /**
208
208
  * Formats an emoji.
209
209
  * @param emojiId The ID of the emoji.
210
210
  * @param animated Whether the emoji is animated. Defaults to false.
211
211
  * @returns The formatted emoji.
212
212
  */
213
- static emojiMention(emojiId, name, animated = false) {
213
+ emojiMention(emojiId, name, animated = false) {
214
214
  return `<${animated ? 'a' : ''}:${name ?? '_'}:${emojiId}>`;
215
- }
215
+ },
216
216
  /**
217
217
  * Formats a channel link.
218
218
  * @param channelId The ID of the channel.
219
219
  * @param guildId The ID of the guild. Defaults to '@me'.
220
220
  * @returns The formatted channel link.
221
221
  */
222
- static channelLink(channelId, guildId) {
222
+ channelLink(channelId, guildId) {
223
223
  return `https://discord.com/channels/${guildId ?? '@me'}/${channelId}`;
224
- }
225
- }
226
- exports.Formatter = Formatter;
224
+ },
225
+ };
@@ -44,7 +44,7 @@ class Logger {
44
44
  for (const i of await node_fs_1.promises.readdir((0, node_path_1.join)(process.cwd(), Logger.dirname), { withFileTypes: true })) {
45
45
  if (Logger.streams[i.name])
46
46
  await new Promise(res => Logger.streams[i.name].close(res));
47
- await node_fs_1.promises.unlink((0, node_path_1.join)(process.cwd(), Logger.dirname, i.name)).catch(() => { });
47
+ await node_fs_1.promises.unlink((0, node_path_1.join)(process.cwd(), Logger.dirname, i.name)).catch(() => undefined);
48
48
  delete Logger.streams[i.name];
49
49
  }
50
50
  }
@@ -1,6 +1,13 @@
1
- import { type EmojiResolvable, type TypeArray, type ColorResolvable, type Logger, type ObjectToLower, type ObjectToSnake } from '..';
2
- import { type APIPartialEmoji } from '../../types';
3
- import type { Cache } from '../..';
1
+ import { type ColorResolvable, type EmojiResolvable, type Logger, type ObjectToLower, type ObjectToSnake, type TypeArray } from '..';
2
+ import type { Cache } from '../../cache';
3
+ import { type APIPartialEmoji, GatewayIntentBits } from '../../types';
4
+ /**
5
+ * Calculates the shard ID for a guild based on its ID.
6
+ * @param guildId The ID of the guild.
7
+ * @param shards The number of shards to calculate the ID for.
8
+ * @returns The shard ID.
9
+ */
10
+ export declare function calculateShardId(guildId: string, shards?: number): number;
4
11
  /**
5
12
  * Resolves the color to a numeric representation.
6
13
  * @param color The color to resolve.
@@ -33,9 +40,9 @@ export declare function MergeOptions<T>(defaults: any, ...options: any[]): T;
33
40
  * @param func The predicate function used to test elements of the array.
34
41
  * @returns An object containing two arrays: one with elements that passed the test and one with elements that did not.
35
42
  */
36
- export declare function filterSplit<Element, Predicate extends (value: Element) => boolean>(arr: Element[], func: Predicate): {
43
+ export declare function filterSplit<Element, Never = Element>(arr: (Element | Never)[], func: (value: Element | Never) => boolean): {
37
44
  expect: Element[];
38
- never: Element[];
45
+ never: Never[];
39
46
  };
40
47
  /**
41
48
  * Represents a base handler class.
@@ -52,7 +59,7 @@ export declare class BaseHandler {
52
59
  * @param path The path to filter.
53
60
  * @returns `true` if the path passes the filter, otherwise `false`.
54
61
  */
55
- protected filter: (path: string) => boolean;
62
+ filter: (path: string) => boolean;
56
63
  /**
57
64
  * Recursively retrieves all files in a directory.
58
65
  * @param dir The directory path.
@@ -110,3 +117,4 @@ export declare function resolvePartialEmoji(emoji: EmojiResolvable): APIPartialE
110
117
  export declare function resolveEmoji(emoji: EmojiResolvable, cache: Cache): Promise<APIPartialEmoji | undefined>;
111
118
  export declare function encodeEmoji(rawEmoji: APIPartialEmoji): string;
112
119
  export declare function hasProps<T extends Record<any, any>>(target: T, props: TypeArray<keyof T>): boolean;
120
+ export declare function hasIntent(intents: number, target: keyof typeof GatewayIntentBits | GatewayIntentBits): boolean;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ReplaceRegex = exports.BaseHandler = void 0;
4
+ exports.calculateShardId = calculateShardId;
4
5
  exports.resolveColor = resolveColor;
5
6
  exports.delay = delay;
6
7
  exports.isObject = isObject;
@@ -17,35 +18,47 @@ exports.resolvePartialEmoji = resolvePartialEmoji;
17
18
  exports.resolveEmoji = resolveEmoji;
18
19
  exports.encodeEmoji = encodeEmoji;
19
20
  exports.hasProps = hasProps;
21
+ exports.hasIntent = hasIntent;
20
22
  const node_fs_1 = require("node:fs");
21
23
  const node_path_1 = require("node:path");
22
24
  const __1 = require("..");
23
25
  const types_1 = require("../../types");
26
+ /**
27
+ * Calculates the shard ID for a guild based on its ID.
28
+ * @param guildId The ID of the guild.
29
+ * @param shards The number of shards to calculate the ID for.
30
+ * @returns The shard ID.
31
+ */
32
+ function calculateShardId(guildId, shards) {
33
+ return Number((BigInt(guildId) >> 22n) % BigInt(shards ?? 1));
34
+ }
35
+ // It is used for resolve color for better performance
36
+ const ColorLookup = {
37
+ Random: -1, // Special value for random color
38
+ ...__1.EmbedColors,
39
+ };
24
40
  /**
25
41
  * Resolves the color to a numeric representation.
26
42
  * @param color The color to resolve.
27
43
  * @returns The numeric representation of the color.
28
44
  */
29
45
  function resolveColor(color) {
30
- switch (typeof color) {
31
- case 'string':
32
- if (color === 'Random')
33
- return Math.floor(Math.random() * (0xffffff + 1));
34
- if (color.startsWith('#'))
35
- return Number.parseInt(color.slice(1), 16);
36
- if (color in __1.EmbedColors)
37
- return __1.EmbedColors[color];
38
- return __1.EmbedColors.Default;
39
- case 'number':
40
- return color;
41
- case 'object':
42
- if (Array.isArray(color))
43
- return (color[0] << 16) + (color[1] << 8) + color[2];
44
- break;
45
- default:
46
- return color;
46
+ const type = typeof color;
47
+ if (type === 'number') {
48
+ if (!Number.isInteger(color) || color < 0)
49
+ throw new Error(`Invalid color: ${color}`);
50
+ return color;
47
51
  }
48
- return color;
52
+ if (type === 'string') {
53
+ const lookupColor = ColorLookup[color];
54
+ if (lookupColor) {
55
+ return lookupColor === -1 ? Math.floor(Math.random() * 0xffffff) : lookupColor;
56
+ }
57
+ return color.startsWith('#') ? Number.parseInt(color.slice(1), 16) : __1.EmbedColors.Default;
58
+ }
59
+ return Array.isArray(color) && color.length >= 3
60
+ ? (color[0] << 16) | (color[1] << 8) | color[2]
61
+ : __1.EmbedColors.Default;
49
62
  }
50
63
  /**
51
64
  * Delays the resolution of a Promise by the specified time.
@@ -79,7 +92,7 @@ function MergeOptions(defaults, ...options) {
79
92
  ...option,
80
93
  ...Object.fromEntries(Object.entries(defaults).map(([key, value]) => [
81
94
  key,
82
- isObject(value) ? MergeOptions(value, option?.[key] || {}) : option?.[key] ?? value,
95
+ isObject(value) ? MergeOptions(value, option?.[key] || {}) : (option?.[key] ?? value),
83
96
  ])),
84
97
  }, ...options);
85
98
  }
@@ -178,7 +191,7 @@ function toSnakeCase(target) {
178
191
  case 'undefined':
179
192
  result[exports.ReplaceRegex.snake(key)] = value;
180
193
  break;
181
- case 'object':
194
+ case 'object': {
182
195
  if (Array.isArray(value)) {
183
196
  result[exports.ReplaceRegex.snake(key)] = value.map(prop => typeof prop === 'object' && prop ? toSnakeCase(prop) : prop);
184
197
  break;
@@ -193,6 +206,7 @@ function toSnakeCase(target) {
193
206
  }
194
207
  result[exports.ReplaceRegex.snake(key)] = toSnakeCase(value);
195
208
  break;
209
+ }
196
210
  }
197
211
  }
198
212
  return result;
@@ -215,7 +229,7 @@ function toCamelCase(target) {
215
229
  case 'undefined':
216
230
  result[exports.ReplaceRegex.camel(key)] = value;
217
231
  break;
218
- case 'object':
232
+ case 'object': {
219
233
  if (Array.isArray(value)) {
220
234
  result[exports.ReplaceRegex.camel(key)] = value.map(prop => typeof prop === 'object' && prop ? toCamelCase(prop) : prop);
221
235
  break;
@@ -230,6 +244,7 @@ function toCamelCase(target) {
230
244
  }
231
245
  result[exports.ReplaceRegex.camel(key)] = toCamelCase(value);
232
246
  break;
247
+ }
233
248
  }
234
249
  }
235
250
  return result;
@@ -262,7 +277,9 @@ function lazyLoadPackage(mod) {
262
277
  return require(mod);
263
278
  }
264
279
  catch (e) {
265
- console.log(`Cannot import ${mod}`);
280
+ // biome-ignore lint/suspicious/noConsoleLog:
281
+ // biome-ignore lint/suspicious/noConsole:
282
+ console.log(`Cannot import ${mod}`, e);
266
283
  return;
267
284
  }
268
285
  }
@@ -283,7 +300,11 @@ function resolvePartialEmoji(emoji) {
283
300
  if (typeof emoji === 'string') {
284
301
  const groups = emoji.match(types_1.FormattingPatterns.Emoji)?.groups;
285
302
  if (groups) {
286
- return { animated: !!groups.animated, name: groups.name, id: groups.id };
303
+ return {
304
+ animated: !!groups.animated,
305
+ name: groups.name,
306
+ id: groups.id,
307
+ };
287
308
  }
288
309
  if (emoji.includes('%')) {
289
310
  emoji = encodeURIComponent(emoji);
@@ -305,11 +326,21 @@ async function resolveEmoji(emoji, cache) {
305
326
  if (!emoji.match(/\d{17,20}/g))
306
327
  return;
307
328
  const fromCache = await cache.emojis?.get(emoji);
308
- return fromCache && { animated: fromCache.animated, id: fromCache.id, name: fromCache.name };
329
+ return (fromCache && {
330
+ animated: fromCache.animated,
331
+ id: fromCache.id,
332
+ name: fromCache.name,
333
+ });
334
+ }
335
+ if (emoji.id) {
336
+ const fromCache = await cache.emojis?.get(emoji.id);
337
+ if (fromCache)
338
+ return {
339
+ animated: fromCache.animated,
340
+ id: fromCache.id,
341
+ name: fromCache.name,
342
+ };
309
343
  }
310
- const fromCache = await cache.emojis?.get(emoji.id);
311
- if (fromCache)
312
- return { animated: fromCache.animated, id: fromCache.id, name: fromCache.name };
313
344
  return;
314
345
  }
315
346
  function encodeEmoji(rawEmoji) {
@@ -327,3 +358,7 @@ function hasProps(target, props) {
327
358
  }
328
359
  return true;
329
360
  }
361
+ function hasIntent(intents, target) {
362
+ const intent = typeof target === 'string' ? types_1.GatewayIntentBits[target] : target;
363
+ return (intents & intent) === intent;
364
+ }
@@ -1,4 +1,3 @@
1
- import { Entitlement } from '../../structures/Entitlement';
2
1
  import type { RESTGetAPIEntitlementsQuery, RESTPostAPIApplicationEmojiJSONBody, RESTPostAPIEntitlementBody } from '../../types';
3
2
  import { BaseShorter } from './base';
4
3
  export declare class ApplicationShorter extends BaseShorter {
@@ -28,7 +27,7 @@ export declare class ApplicationShorter extends BaseShorter {
28
27
  * @param applicationId The ID of the application.
29
28
  * @param [query] The query parameters.
30
29
  */
31
- listEntitlements(applicationId: string, query?: RESTGetAPIEntitlementsQuery): Promise<Entitlement[]>;
30
+ listEntitlements(applicationId: string, query?: RESTGetAPIEntitlementsQuery): Promise<import("../../structures/Entitlement").Entitlement[]>;
32
31
  /**
33
32
  * Consumes an entitlement for the application.
34
33
  * @param applicationId The ID of the application.
@@ -40,7 +39,7 @@ export declare class ApplicationShorter extends BaseShorter {
40
39
  * @param applicationId The ID of the application.
41
40
  * @param body The body of the request.
42
41
  */
43
- createTestEntitlement(applicationId: string, body: RESTPostAPIEntitlementBody): Promise<Entitlement>;
42
+ createTestEntitlement(applicationId: string, body: RESTPostAPIEntitlementBody): Promise<import("../../structures/Entitlement").Entitlement>;
44
43
  /**
45
44
  * Deletes a test entitlement for the application.
46
45
  * @param applicationId The ID of the application.
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ApplicationShorter = void 0;
4
- const Entitlement_1 = require("../../structures/Entitlement");
4
+ const client_1 = require("../../client");
5
5
  const base_1 = require("./base");
6
6
  class ApplicationShorter extends base_1.BaseShorter {
7
7
  /**
@@ -40,7 +40,7 @@ class ApplicationShorter extends base_1.BaseShorter {
40
40
  return this.client.proxy
41
41
  .applications(applicationId)
42
42
  .entitlements.get({ query })
43
- .then(et => et.map(e => new Entitlement_1.Entitlement(this.client, e)));
43
+ .then(et => et.map(e => client_1.Transformers.Entitlement(this.client, e)));
44
44
  }
45
45
  /**
46
46
  * Consumes an entitlement for the application.
@@ -59,7 +59,7 @@ class ApplicationShorter extends base_1.BaseShorter {
59
59
  return this.client.proxy
60
60
  .applications(applicationId)
61
61
  .entitlements.post({ body })
62
- .then(et => new Entitlement_1.Entitlement(this.client, et));
62
+ .then(et => client_1.Transformers.Entitlement(this.client, et));
63
63
  }
64
64
  /**
65
65
  * Deletes a test entitlement for the application.
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BanShorter = void 0;
4
- const base_1 = require("./base");
5
4
  const transformers_1 = require("../../client/transformers");
5
+ const base_1 = require("./base");
6
6
  class BanShorter extends base_1.BaseShorter {
7
7
  /**
8
8
  * Bulk creates bans in the guild.
@@ -1,8 +1,8 @@
1
- import type { APIChannel, RESTGetAPIChannelMessagesQuery, RESTPatchAPIChannelJSONBody, RESTPostAPIChannelThreadsJSONBody, RESTPostAPIGuildForumThreadsJSONBody } from '../../types';
2
- import { type GuildRole, type GuildMember, type AllChannels } from '../../structures';
1
+ import { type MessageStructure } from '../../client/transformers';
2
+ import { type AllChannels, type GuildMember, type GuildRole } from '../../structures';
3
3
  import { PermissionsBitField } from '../../structures/extra/Permissions';
4
+ import type { APIChannel, RESTGetAPIChannelMessagesQuery, RESTPatchAPIChannelJSONBody, RESTPostAPIChannelThreadsJSONBody, RESTPostAPIGuildForumThreadsJSONBody } from '../../types';
4
5
  import { BaseShorter } from './base';
5
- import { type MessageStructure } from '../../client/transformers';
6
6
  export declare class ChannelShorter extends BaseShorter {
7
7
  /**
8
8
  * Fetches a channel by its ID.