seyfert 2.1.0 → 2.1.1-dev-11316886063.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 (241) 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 +6 -6
  10. package/lib/api/Routes/invites.d.ts +3 -4
  11. package/lib/api/Routes/skus.d.ts +4 -5
  12. package/lib/api/Routes/soundboard.d.ts +23 -0
  13. package/lib/api/Routes/soundboard.js +2 -0
  14. package/lib/api/Routes/stage-instances.d.ts +5 -6
  15. package/lib/api/Routes/stickers.d.ts +3 -4
  16. package/lib/api/Routes/users.d.ts +11 -12
  17. package/lib/api/Routes/voice.d.ts +2 -3
  18. package/lib/api/Routes/webhooks.d.ts +16 -15
  19. package/lib/api/api.d.ts +17 -11
  20. package/lib/api/api.js +12 -10
  21. package/lib/api/shared.d.ts +1 -1
  22. package/lib/api/utils/constants.d.ts +2 -0
  23. package/lib/api/utils/constants.js +2 -1
  24. package/lib/builders/ActionRow.d.ts +1 -1
  25. package/lib/builders/Attachment.d.ts +2 -2
  26. package/lib/builders/Attachment.js +1 -1
  27. package/lib/builders/Button.d.ts +1 -1
  28. package/lib/builders/Button.js +1 -1
  29. package/lib/builders/Embed.d.ts +1 -1
  30. package/lib/builders/Embed.js +2 -2
  31. package/lib/builders/Modal.d.ts +1 -1
  32. package/lib/builders/Poll.d.ts +1 -1
  33. package/lib/builders/Poll.js +1 -1
  34. package/lib/builders/SelectMenu.d.ts +1 -1
  35. package/lib/builders/SelectMenu.js +1 -1
  36. package/lib/builders/types.d.ts +2 -1
  37. package/lib/cache/adapters/default.js +5 -3
  38. package/lib/cache/adapters/limited.d.ts +1 -2
  39. package/lib/cache/adapters/limited.js +34 -30
  40. package/lib/cache/adapters/workeradapter.js +3 -1
  41. package/lib/cache/index.d.ts +8 -11
  42. package/lib/cache/index.js +38 -37
  43. package/lib/cache/resources/bans.d.ts +2 -2
  44. package/lib/cache/resources/bans.js +1 -1
  45. package/lib/cache/resources/channels.d.ts +1 -1
  46. package/lib/cache/resources/default/guild-related.d.ts +1 -2
  47. package/lib/cache/resources/emojis.d.ts +2 -2
  48. package/lib/cache/resources/emojis.js +1 -1
  49. package/lib/cache/resources/guilds.d.ts +2 -2
  50. package/lib/cache/resources/guilds.js +7 -11
  51. package/lib/cache/resources/members.d.ts +2 -2
  52. package/lib/cache/resources/members.js +1 -1
  53. package/lib/cache/resources/messages.d.ts +2 -2
  54. package/lib/cache/resources/messages.js +3 -3
  55. package/lib/cache/resources/overwrites.d.ts +1 -1
  56. package/lib/cache/resources/roles.d.ts +2 -2
  57. package/lib/cache/resources/roles.js +1 -1
  58. package/lib/cache/resources/stickers.d.ts +2 -2
  59. package/lib/cache/resources/stickers.js +1 -1
  60. package/lib/cache/resources/users.d.ts +2 -2
  61. package/lib/cache/resources/users.js +1 -1
  62. package/lib/cache/resources/voice-states.d.ts +2 -2
  63. package/lib/cache/resources/voice-states.js +1 -1
  64. package/lib/client/base.d.ts +9 -14
  65. package/lib/client/base.js +43 -44
  66. package/lib/client/client.d.ts +3 -7
  67. package/lib/client/client.js +24 -41
  68. package/lib/client/collectors.js +1 -1
  69. package/lib/client/httpclient.d.ts +1 -1
  70. package/lib/client/transformers.d.ts +37 -34
  71. package/lib/client/transformers.js +66 -63
  72. package/lib/client/workerclient.d.ts +10 -11
  73. package/lib/client/workerclient.js +180 -75
  74. package/lib/collection.d.ts +3 -3
  75. package/lib/commands/applications/chat.d.ts +12 -32
  76. package/lib/commands/applications/chat.js +5 -6
  77. package/lib/commands/applications/chatcontext.d.ts +6 -6
  78. package/lib/commands/applications/chatcontext.js +16 -8
  79. package/lib/commands/applications/entryPoint.d.ts +1 -1
  80. package/lib/commands/applications/entrycontext.d.ts +6 -6
  81. package/lib/commands/applications/entrycontext.js +4 -4
  82. package/lib/commands/applications/menu.d.ts +1 -1
  83. package/lib/commands/applications/menucontext.d.ts +5 -5
  84. package/lib/commands/applications/menucontext.js +6 -6
  85. package/lib/commands/applications/options.d.ts +104 -28
  86. package/lib/commands/applications/options.js +4 -4
  87. package/lib/commands/applications/shared.d.ts +5 -2
  88. package/lib/commands/basecontext.d.ts +1 -1
  89. package/lib/commands/decorators.d.ts +10 -10
  90. package/lib/commands/decorators.js +5 -4
  91. package/lib/commands/handle.d.ts +9 -9
  92. package/lib/commands/handle.js +94 -68
  93. package/lib/commands/handler.d.ts +5 -5
  94. package/lib/commands/handler.js +21 -17
  95. package/lib/commands/optionresolver.d.ts +4 -4
  96. package/lib/commands/optionresolver.js +3 -3
  97. package/lib/common/it/formatter.d.ts +21 -21
  98. package/lib/common/it/formatter.js +40 -41
  99. package/lib/common/it/logger.js +1 -1
  100. package/lib/common/it/utils.d.ts +4 -3
  101. package/lib/common/it/utils.js +52 -27
  102. package/lib/common/shorters/application.d.ts +2 -3
  103. package/lib/common/shorters/application.js +3 -3
  104. package/lib/common/shorters/bans.js +1 -1
  105. package/lib/common/shorters/channels.d.ts +3 -3
  106. package/lib/common/shorters/channels.js +3 -3
  107. package/lib/common/shorters/emojis.js +4 -4
  108. package/lib/common/shorters/guilds.d.ts +3 -3
  109. package/lib/common/shorters/guilds.js +5 -9
  110. package/lib/common/shorters/interaction.d.ts +3 -3
  111. package/lib/common/shorters/interaction.js +6 -5
  112. package/lib/common/shorters/members.d.ts +4 -5
  113. package/lib/common/shorters/members.js +6 -7
  114. package/lib/common/shorters/messages.d.ts +1 -1
  115. package/lib/common/shorters/messages.js +4 -4
  116. package/lib/common/shorters/reactions.d.ts +1 -1
  117. package/lib/common/shorters/reactions.js +1 -1
  118. package/lib/common/shorters/roles.js +1 -1
  119. package/lib/common/shorters/templates.js +2 -2
  120. package/lib/common/shorters/threads.d.ts +1 -1
  121. package/lib/common/shorters/threads.js +17 -11
  122. package/lib/common/shorters/webhook.d.ts +1 -1
  123. package/lib/common/shorters/webhook.js +4 -4
  124. package/lib/common/types/options.d.ts +2 -2
  125. package/lib/common/types/resolvables.d.ts +1 -1
  126. package/lib/common/types/util.d.ts +4 -1
  127. package/lib/common/types/write.d.ts +1 -1
  128. package/lib/components/BaseComponent.js +1 -1
  129. package/lib/components/ButtonComponent.d.ts +1 -1
  130. package/lib/components/componentcommand.d.ts +1 -1
  131. package/lib/components/componentcontext.d.ts +4 -4
  132. package/lib/components/componentcontext.js +1 -1
  133. package/lib/components/handler.d.ts +10 -8
  134. package/lib/components/handler.js +16 -13
  135. package/lib/components/index.js +2 -1
  136. package/lib/components/modalcontext.d.ts +2 -2
  137. package/lib/components/modalcontext.js +1 -1
  138. package/lib/deps/mixer.d.ts +1 -1
  139. package/lib/events/handler.d.ts +5 -5
  140. package/lib/events/handler.js +66 -16
  141. package/lib/events/hooks/application_command.d.ts +1 -1
  142. package/lib/events/hooks/auto_moderation.d.ts +1 -1
  143. package/lib/events/hooks/auto_moderation.js +1 -1
  144. package/lib/events/hooks/channel.d.ts +1 -1
  145. package/lib/events/hooks/dispatch.d.ts +1 -1
  146. package/lib/events/hooks/entitlement.d.ts +4 -5
  147. package/lib/events/hooks/entitlement.js +4 -4
  148. package/lib/events/hooks/guild.d.ts +3 -3
  149. package/lib/events/hooks/guild.js +1 -1
  150. package/lib/events/hooks/index.d.ts +1 -0
  151. package/lib/events/hooks/index.js +1 -0
  152. package/lib/events/hooks/integration.d.ts +1 -1
  153. package/lib/events/hooks/integration.js +1 -1
  154. package/lib/events/hooks/interactions.d.ts +3 -3
  155. package/lib/events/hooks/invite.d.ts +1 -1
  156. package/lib/events/hooks/message.d.ts +3 -3
  157. package/lib/events/hooks/message.js +1 -1
  158. package/lib/events/hooks/presence.d.ts +2 -2
  159. package/lib/events/hooks/soundboard.d.ts +155 -0
  160. package/lib/events/hooks/soundboard.js +28 -0
  161. package/lib/events/hooks/stage.d.ts +2 -2
  162. package/lib/events/hooks/thread.d.ts +2 -2
  163. package/lib/events/hooks/thread.js +2 -2
  164. package/lib/events/hooks/typing.d.ts +1 -1
  165. package/lib/events/hooks/typing.js +1 -1
  166. package/lib/events/hooks/user.d.ts +2 -2
  167. package/lib/events/hooks/voice.d.ts +2 -2
  168. package/lib/events/hooks/voice.js +1 -1
  169. package/lib/events/hooks/webhook.d.ts +1 -1
  170. package/lib/index.d.ts +2 -2
  171. package/lib/index.js +3 -5
  172. package/lib/langs/handler.d.ts +2 -2
  173. package/lib/structures/Guild.d.ts +7 -4
  174. package/lib/structures/Guild.js +1 -1
  175. package/lib/structures/GuildBan.d.ts +1 -1
  176. package/lib/structures/GuildMember.d.ts +7 -5
  177. package/lib/structures/GuildMember.js +5 -3
  178. package/lib/structures/GuildRole.d.ts +1 -1
  179. package/lib/structures/GuildTemplate.d.ts +1 -1
  180. package/lib/structures/Interaction.d.ts +17 -14
  181. package/lib/structures/Interaction.js +28 -21
  182. package/lib/structures/Message.d.ts +4 -7
  183. package/lib/structures/Message.js +5 -5
  184. package/lib/structures/Poll.d.ts +3 -3
  185. package/lib/structures/Sticker.d.ts +2 -2
  186. package/lib/structures/Sticker.js +1 -1
  187. package/lib/structures/VoiceState.d.ts +2 -1
  188. package/lib/structures/VoiceState.js +1 -1
  189. package/lib/structures/Webhook.d.ts +3 -3
  190. package/lib/structures/Webhook.js +1 -1
  191. package/lib/structures/channels.d.ts +4 -4
  192. package/lib/structures/channels.js +6 -5
  193. package/lib/structures/extra/BitField.d.ts +3 -3
  194. package/lib/structures/extra/BitField.js +34 -33
  195. package/lib/structures/extra/DiscordBase.js +1 -1
  196. package/lib/structures/extra/Permissions.d.ts +2 -0
  197. package/lib/structures/extra/Permissions.js +21 -0
  198. package/lib/types/gateway.d.ts +53 -5
  199. package/lib/types/payloads/_interactions/base.d.ts +1 -1
  200. package/lib/types/payloads/channel.d.ts +2 -2
  201. package/lib/types/payloads/guild.d.ts +9 -1
  202. package/lib/types/payloads/guild.js +8 -0
  203. package/lib/types/payloads/index.d.ts +1 -0
  204. package/lib/types/payloads/index.js +1 -0
  205. package/lib/types/payloads/soundboard.d.ts +23 -0
  206. package/lib/types/payloads/soundboard.js +5 -0
  207. package/lib/types/payloads/user.js +0 -1
  208. package/lib/types/rest/application.d.ts +3 -3
  209. package/lib/types/rest/auditLog.d.ts +1 -1
  210. package/lib/types/rest/channel.d.ts +2 -2
  211. package/lib/types/rest/guild.d.ts +2 -2
  212. package/lib/types/rest/guildScheduledEvent.d.ts +1 -1
  213. package/lib/types/rest/index.d.ts +1 -0
  214. package/lib/types/rest/index.js +1 -0
  215. package/lib/types/rest/oauth2.d.ts +1 -1
  216. package/lib/types/rest/poll.d.ts +1 -1
  217. package/lib/types/rest/soundboard.d.ts +64 -0
  218. package/lib/types/rest/soundboard.js +2 -0
  219. package/lib/types/rest/stageInstance.d.ts +1 -1
  220. package/lib/types/rest/template.d.ts +1 -1
  221. package/lib/types/rest/user.d.ts +1 -1
  222. package/lib/types/rest/webhook.d.ts +1 -1
  223. package/lib/types/utils/index.d.ts +11 -2
  224. package/lib/types/utils/index.js +10 -2
  225. package/lib/websocket/SharedTypes.d.ts +11 -2
  226. package/lib/websocket/constants/index.js +0 -10
  227. package/lib/websocket/discord/basesocket.d.ts +1 -1
  228. package/lib/websocket/discord/shard.d.ts +1 -1
  229. package/lib/websocket/discord/shard.js +25 -16
  230. package/lib/websocket/discord/sharder.d.ts +9 -6
  231. package/lib/websocket/discord/sharder.js +91 -74
  232. package/lib/websocket/discord/shared.d.ts +3 -14
  233. package/lib/websocket/discord/socket/custom.js +19 -6
  234. package/lib/websocket/discord/worker.d.ts +8 -2
  235. package/lib/websocket/discord/workermanager.d.ts +42 -17
  236. package/lib/websocket/discord/workermanager.js +144 -37
  237. package/lib/websocket/structures/timeout.d.ts +4 -5
  238. package/lib/websocket/structures/timeout.js +23 -24
  239. package/package.json +72 -70
  240. package/lib/cache/resources/threads.d.ts +0 -14
  241. package/lib/cache/resources/threads.js +0 -32
@@ -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,6 @@
1
- import { type EmojiResolvable, type TypeArray, type ColorResolvable, type Logger, type ObjectToLower, type ObjectToSnake } from '..';
2
- import { type APIPartialEmoji } from '../../types';
1
+ import { type ColorResolvable, type EmojiResolvable, type Logger, type ObjectToLower, type ObjectToSnake, type TypeArray } from '..';
3
2
  import type { Cache } from '../../cache';
3
+ import { type APIPartialEmoji, GatewayIntentBits } from '../../types';
4
4
  /**
5
5
  * Calculates the shard ID for a guild based on its ID.
6
6
  * @param guildId The ID of the guild.
@@ -59,7 +59,7 @@ export declare class BaseHandler {
59
59
  * @param path The path to filter.
60
60
  * @returns `true` if the path passes the filter, otherwise `false`.
61
61
  */
62
- protected filter: (path: string) => boolean;
62
+ filter: (path: string) => boolean;
63
63
  /**
64
64
  * Recursively retrieves all files in a directory.
65
65
  * @param dir The directory path.
@@ -117,3 +117,4 @@ export declare function resolvePartialEmoji(emoji: EmojiResolvable): APIPartialE
117
117
  export declare function resolveEmoji(emoji: EmojiResolvable, cache: Cache): Promise<APIPartialEmoji | undefined>;
118
118
  export declare function encodeEmoji(rawEmoji: APIPartialEmoji): string;
119
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;
@@ -18,6 +18,7 @@ exports.resolvePartialEmoji = resolvePartialEmoji;
18
18
  exports.resolveEmoji = resolveEmoji;
19
19
  exports.encodeEmoji = encodeEmoji;
20
20
  exports.hasProps = hasProps;
21
+ exports.hasIntent = hasIntent;
21
22
  const node_fs_1 = require("node:fs");
22
23
  const node_path_1 = require("node:path");
23
24
  const __1 = require("..");
@@ -31,31 +32,33 @@ const types_1 = require("../../types");
31
32
  function calculateShardId(guildId, shards) {
32
33
  return Number((BigInt(guildId) >> 22n) % BigInt(shards ?? 1));
33
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
+ };
34
40
  /**
35
41
  * Resolves the color to a numeric representation.
36
42
  * @param color The color to resolve.
37
43
  * @returns The numeric representation of the color.
38
44
  */
39
45
  function resolveColor(color) {
40
- switch (typeof color) {
41
- case 'string':
42
- if (color === 'Random')
43
- return Math.floor(Math.random() * (0xffffff + 1));
44
- if (color.startsWith('#'))
45
- return Number.parseInt(color.slice(1), 16);
46
- if (color in __1.EmbedColors)
47
- return __1.EmbedColors[color];
48
- return __1.EmbedColors.Default;
49
- case 'number':
50
- return color;
51
- case 'object':
52
- if (Array.isArray(color))
53
- return (color[0] << 16) + (color[1] << 8) + color[2];
54
- break;
55
- default:
56
- 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;
51
+ }
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;
57
58
  }
58
- return color;
59
+ return Array.isArray(color) && color.length >= 3
60
+ ? (color[0] << 16) | (color[1] << 8) | color[2]
61
+ : __1.EmbedColors.Default;
59
62
  }
60
63
  /**
61
64
  * Delays the resolution of a Promise by the specified time.
@@ -89,7 +92,7 @@ function MergeOptions(defaults, ...options) {
89
92
  ...option,
90
93
  ...Object.fromEntries(Object.entries(defaults).map(([key, value]) => [
91
94
  key,
92
- isObject(value) ? MergeOptions(value, option?.[key] || {}) : option?.[key] ?? value,
95
+ isObject(value) ? MergeOptions(value, option?.[key] || {}) : (option?.[key] ?? value),
93
96
  ])),
94
97
  }, ...options);
95
98
  }
@@ -188,7 +191,7 @@ function toSnakeCase(target) {
188
191
  case 'undefined':
189
192
  result[exports.ReplaceRegex.snake(key)] = value;
190
193
  break;
191
- case 'object':
194
+ case 'object': {
192
195
  if (Array.isArray(value)) {
193
196
  result[exports.ReplaceRegex.snake(key)] = value.map(prop => typeof prop === 'object' && prop ? toSnakeCase(prop) : prop);
194
197
  break;
@@ -203,6 +206,7 @@ function toSnakeCase(target) {
203
206
  }
204
207
  result[exports.ReplaceRegex.snake(key)] = toSnakeCase(value);
205
208
  break;
209
+ }
206
210
  }
207
211
  }
208
212
  return result;
@@ -225,7 +229,7 @@ function toCamelCase(target) {
225
229
  case 'undefined':
226
230
  result[exports.ReplaceRegex.camel(key)] = value;
227
231
  break;
228
- case 'object':
232
+ case 'object': {
229
233
  if (Array.isArray(value)) {
230
234
  result[exports.ReplaceRegex.camel(key)] = value.map(prop => typeof prop === 'object' && prop ? toCamelCase(prop) : prop);
231
235
  break;
@@ -240,6 +244,7 @@ function toCamelCase(target) {
240
244
  }
241
245
  result[exports.ReplaceRegex.camel(key)] = toCamelCase(value);
242
246
  break;
247
+ }
243
248
  }
244
249
  }
245
250
  return result;
@@ -272,7 +277,9 @@ function lazyLoadPackage(mod) {
272
277
  return require(mod);
273
278
  }
274
279
  catch (e) {
275
- console.log(`Cannot import ${mod}`);
280
+ // biome-ignore lint/suspicious/noConsoleLog:
281
+ // biome-ignore lint/suspicious/noConsole:
282
+ console.log(`Cannot import ${mod}`, e);
276
283
  return;
277
284
  }
278
285
  }
@@ -293,7 +300,11 @@ function resolvePartialEmoji(emoji) {
293
300
  if (typeof emoji === 'string') {
294
301
  const groups = emoji.match(types_1.FormattingPatterns.Emoji)?.groups;
295
302
  if (groups) {
296
- 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
+ };
297
308
  }
298
309
  if (emoji.includes('%')) {
299
310
  emoji = encodeURIComponent(emoji);
@@ -315,11 +326,21 @@ async function resolveEmoji(emoji, cache) {
315
326
  if (!emoji.match(/\d{17,20}/g))
316
327
  return;
317
328
  const fromCache = await cache.emojis?.get(emoji);
318
- 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
+ };
319
343
  }
320
- const fromCache = await cache.emojis?.get(emoji.id);
321
- if (fromCache)
322
- return { animated: fromCache.animated, id: fromCache.id, name: fromCache.name };
323
344
  return;
324
345
  }
325
346
  function encodeEmoji(rawEmoji) {
@@ -337,3 +358,7 @@ function hasProps(target, props) {
337
358
  }
338
359
  return true;
339
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.
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ChannelShorter = void 0;
4
+ const transformers_1 = require("../../client/transformers");
4
5
  const structures_1 = require("../../structures");
5
6
  const Permissions_1 = require("../../structures/extra/Permissions");
6
- const base_1 = require("./base");
7
- const utils_1 = require("../it/utils");
8
- const transformers_1 = require("../../client/transformers");
9
7
  const types_1 = require("../../types");
8
+ const utils_1 = require("../it/utils");
9
+ const base_1 = require("./base");
10
10
  class ChannelShorter extends base_1.BaseShorter {
11
11
  /**
12
12
  * Fetches a channel by its ID.
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.EmojiShorter = void 0;
4
4
  const builders_1 = require("../../builders");
5
- const base_1 = require("./base");
6
5
  const transformers_1 = require("../../client/transformers");
6
+ const base_1 = require("./base");
7
7
  class EmojiShorter extends base_1.BaseShorter {
8
8
  /**
9
9
  * Retrieves a list of emojis in the guild.
@@ -34,7 +34,7 @@ class EmojiShorter extends base_1.BaseShorter {
34
34
  const emoji = await this.client.proxy.guilds(guildId).emojis.post({
35
35
  body: bodyResolved,
36
36
  });
37
- await this.client.cache.emojis?.setIfNI('GuildEmojisAndStickers', emoji.id, guildId, emoji);
37
+ await this.client.cache.emojis?.setIfNI('GuildExpressions', emoji.id, guildId, emoji);
38
38
  return transformers_1.Transformers.GuildEmoji(this.client, emoji, guildId);
39
39
  }
40
40
  /**
@@ -62,7 +62,7 @@ class EmojiShorter extends base_1.BaseShorter {
62
62
  */
63
63
  async delete(guildId, emojiId, reason) {
64
64
  await this.client.proxy.guilds(guildId).emojis(emojiId).delete({ reason });
65
- await this.client.cache.emojis?.removeIfNI('GuildEmojisAndStickers', emojiId, guildId);
65
+ await this.client.cache.emojis?.removeIfNI('GuildExpressions', emojiId, guildId);
66
66
  }
67
67
  /**
68
68
  * Edits an emoji in the guild.
@@ -74,7 +74,7 @@ class EmojiShorter extends base_1.BaseShorter {
74
74
  */
75
75
  async edit(guildId, emojiId, body, reason) {
76
76
  const emoji = await this.client.proxy.guilds(guildId).emojis(emojiId).patch({ body, reason });
77
- await this.client.cache.emojis?.setIfNI('GuildEmojisAndStickers', emoji.id, guildId, emoji);
77
+ await this.client.cache.emojis?.setIfNI('GuildExpressions', emoji.id, guildId, emoji);
78
78
  return transformers_1.Transformers.GuildEmoji(this.client, emoji, guildId);
79
79
  }
80
80
  }
@@ -1,7 +1,7 @@
1
+ import { type GuildStructure } from '../../client/transformers';
2
+ import { BaseChannel, type CreateStickerBodyRequest, Guild, GuildMember } from '../../structures';
1
3
  import type { GuildWidgetStyle, RESTGetAPICurrentUserGuildsQuery, RESTPatchAPIAutoModerationRuleJSONBody, RESTPatchAPIChannelJSONBody, RESTPatchAPIGuildChannelPositionsJSONBody, RESTPatchAPIGuildJSONBody, RESTPatchAPIGuildStickerJSONBody, RESTPostAPIAutoModerationRuleJSONBody, RESTPostAPIGuildChannelJSONBody, RESTPostAPIGuildsJSONBody } from '../../types';
2
- import { Guild, GuildMember, type CreateStickerBodyRequest } from '../../structures';
3
4
  import { BaseShorter } from './base';
4
- import { type GuildStructure } from '../../client/transformers';
5
5
  export declare class GuildShorter extends BaseShorter {
6
6
  /**
7
7
  * Creates a new guild.
@@ -46,7 +46,7 @@ export declare class GuildShorter extends BaseShorter {
46
46
  * @param force Whether to force fetching the channel from the API even if it exists in the cache.
47
47
  * @returns A Promise that resolves to the fetched channel.
48
48
  */
49
- fetch: (guildId: string, channelId: string, force?: boolean) => Promise<import("../../structures").AllChannels>;
49
+ fetch: (guildId: string, channelId: string, force?: boolean) => Promise<import("../../types").APIGuildCategoryChannel | import("../../types").APIGuildStageVoiceChannel | import("../../types").APIGuildVoiceChannel | import("../../types").APINewsChannel | import("../../types").APITextChannel | BaseChannel<import("../../types").ChannelType> | import("../../structures").DMChannel | import("../../structures").CategoryChannel>;
50
50
  /**
51
51
  * Creates a new channel in the guild.
52
52
  * @param guildId The ID of the guild.
@@ -2,9 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.GuildShorter = void 0;
4
4
  const builders_1 = require("../../builders");
5
+ const transformers_1 = require("../../client/transformers");
5
6
  const structures_1 = require("../../structures");
6
7
  const base_1 = require("./base");
7
- const transformers_1 = require("../../client/transformers");
8
8
  class GuildShorter extends base_1.BaseShorter {
9
9
  /**
10
10
  * Creates a new guild.
@@ -42,11 +42,7 @@ class GuildShorter extends base_1.BaseShorter {
42
42
  * @returns The generated widget URL.
43
43
  */
44
44
  widgetURL(id, style) {
45
- const query = new URLSearchParams();
46
- if (style) {
47
- query.append('style', style);
48
- }
49
- return this.client.proxy.guilds(id).widget.get({ query });
45
+ return this.client.proxy.guilds(id).widget.get({ query: { style } });
50
46
  }
51
47
  async edit(guildId, body, reason) {
52
48
  const guild = await this.client.proxy.guilds(guildId).patch({ body, reason });
@@ -257,7 +253,7 @@ class GuildShorter extends base_1.BaseShorter {
257
253
  const sticker = await this.client.proxy
258
254
  .guilds(guildId)
259
255
  .stickers.post({ reason, body: json, files: [{ ...fileResolve[0], key: 'file' }], appendToFormData: true });
260
- await this.client.cache.stickers?.setIfNI('GuildEmojisAndStickers', sticker.id, guildId, sticker);
256
+ await this.client.cache.stickers?.setIfNI('GuildExpressions', sticker.id, guildId, sticker);
261
257
  return transformers_1.Transformers.Sticker(this.client, sticker);
262
258
  },
263
259
  /**
@@ -270,7 +266,7 @@ class GuildShorter extends base_1.BaseShorter {
270
266
  */
271
267
  edit: async (guildId, stickerId, body, reason) => {
272
268
  const sticker = await this.client.proxy.guilds(guildId).stickers(stickerId).patch({ body, reason });
273
- await this.client.cache.stickers?.setIfNI('GuildEmojisAndStickers', stickerId, guildId, sticker);
269
+ await this.client.cache.stickers?.setIfNI('GuildExpressions', stickerId, guildId, sticker);
274
270
  return transformers_1.Transformers.Sticker(this.client, sticker);
275
271
  },
276
272
  /**
@@ -300,7 +296,7 @@ class GuildShorter extends base_1.BaseShorter {
300
296
  */
301
297
  delete: async (guildId, stickerId, reason) => {
302
298
  await this.client.proxy.guilds(guildId).stickers(stickerId).delete({ reason });
303
- await this.client.cache.stickers?.removeIfNI('GuildEmojisAndStickers', stickerId, guildId);
299
+ await this.client.cache.stickers?.removeIfNI('GuildExpressions', stickerId, guildId);
304
300
  },
305
301
  };
306
302
  }
@@ -2,12 +2,12 @@ import { type ReplyInteractionBody } from '../..';
2
2
  import type { InteractionMessageUpdateBodyRequest, MessageWebhookCreateBodyRequest } from '../types/write';
3
3
  import { BaseShorter } from './base';
4
4
  export declare class InteractionShorter extends BaseShorter {
5
- reply(id: string, token: string, body: ReplyInteractionBody): Promise<import("../../types").RESTPostAPIInteractionCallbackResult>;
5
+ reply(id: string, token: string, body: ReplyInteractionBody, withResponse?: boolean): Promise<import("../../types").RESTPostAPIInteractionCallbackResult | undefined>;
6
6
  fetchResponse(token: string, messageId: string): Promise<import("../..").WebhookMessage | undefined>;
7
7
  fetchOriginal(token: string): Promise<import("../..").WebhookMessage | undefined>;
8
8
  editMessage(token: string, messageId: string, body: InteractionMessageUpdateBodyRequest): Promise<import("../..").WebhookMessage>;
9
9
  editOriginal(token: string, body: InteractionMessageUpdateBodyRequest): Promise<import("../..").WebhookMessage>;
10
- deleteResponse(interactionId: string, token: string, messageId: string): Promise<void | undefined>;
11
- deleteOriginal(interactionId: string, token: string): Promise<void | undefined>;
10
+ deleteResponse(token: string, messageId: string): Promise<void | undefined>;
11
+ deleteOriginal(token: string): Promise<void | undefined>;
12
12
  followup(token: string, { files, ...body }: MessageWebhookCreateBodyRequest): Promise<import("../..").WebhookMessage>;
13
13
  }
@@ -5,7 +5,7 @@ const __1 = require("../..");
5
5
  const transformers_1 = require("../../client/transformers");
6
6
  const base_1 = require("./base");
7
7
  class InteractionShorter extends base_1.BaseShorter {
8
- async reply(id, token, body) {
8
+ async reply(id, token, body, withResponse = false) {
9
9
  //@ts-expect-error
10
10
  const { files, ...rest } = body.data ?? {};
11
11
  //@ts-expect-error
@@ -19,6 +19,7 @@ class InteractionShorter extends base_1.BaseShorter {
19
19
  data,
20
20
  }, parsedFiles, this.client),
21
21
  files: parsedFiles,
22
+ query: { with_response: withResponse },
22
23
  });
23
24
  }
24
25
  fetchResponse(token, messageId) {
@@ -42,15 +43,15 @@ class InteractionShorter extends base_1.BaseShorter {
42
43
  editOriginal(token, body) {
43
44
  return this.editMessage(token, '@original', body);
44
45
  }
45
- deleteResponse(interactionId, token, messageId) {
46
+ deleteResponse(token, messageId) {
46
47
  return this.client.proxy
47
48
  .webhooks(this.client.applicationId)(token)
48
49
  .messages(messageId)
49
50
  .delete()
50
- .then(() => this.client.components?.onMessageDelete(messageId === '@original' ? interactionId : messageId));
51
+ .then(() => this.client.components?.deleteValue(messageId, 'messageDelete'));
51
52
  }
52
- deleteOriginal(interactionId, token) {
53
- return this.deleteResponse(interactionId, token, '@original');
53
+ deleteOriginal(token) {
54
+ return this.deleteResponse(token, '@original');
54
55
  }
55
56
  async followup(token, { files, ...body }) {
56
57
  const parsedFiles = files ? await (0, __1.resolveFiles)(files) : undefined;