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.
- package/lib/api/Router.d.ts +2 -2
- package/lib/api/Router.js +2 -1
- package/lib/api/Routes/applications.d.ts +29 -30
- package/lib/api/Routes/cdn.d.ts +6 -1
- package/lib/api/Routes/channels.d.ts +44 -45
- package/lib/api/Routes/gateway.d.ts +3 -4
- package/lib/api/Routes/guilds.d.ts +81 -80
- package/lib/api/Routes/index.d.ts +3 -1
- package/lib/api/Routes/interactions.d.ts +9 -3
- package/lib/api/Routes/invites.d.ts +3 -4
- package/lib/api/Routes/skus.d.ts +10 -0
- package/lib/api/Routes/skus.js +2 -0
- package/lib/api/Routes/soundboard.d.ts +23 -0
- package/lib/api/Routes/soundboard.js +2 -0
- package/lib/api/Routes/stage-instances.d.ts +5 -6
- package/lib/api/Routes/stickers.d.ts +3 -4
- package/lib/api/Routes/users.d.ts +11 -12
- package/lib/api/Routes/voice.d.ts +2 -3
- package/lib/api/Routes/webhooks.d.ts +16 -15
- package/lib/api/api.d.ts +17 -11
- package/lib/api/api.js +26 -22
- package/lib/api/shared.d.ts +2 -2
- package/lib/api/utils/constants.d.ts +3 -1
- package/lib/api/utils/constants.js +3 -2
- package/lib/builders/ActionRow.d.ts +1 -1
- package/lib/builders/Attachment.d.ts +3 -3
- package/lib/builders/Attachment.js +13 -13
- package/lib/builders/Button.d.ts +1 -1
- package/lib/builders/Button.js +1 -1
- package/lib/builders/Embed.d.ts +1 -1
- package/lib/builders/Embed.js +2 -2
- package/lib/builders/Modal.d.ts +1 -1
- package/lib/builders/Poll.d.ts +1 -1
- package/lib/builders/Poll.js +1 -1
- package/lib/builders/SelectMenu.d.ts +1 -1
- package/lib/builders/SelectMenu.js +1 -1
- package/lib/builders/types.d.ts +2 -1
- package/lib/cache/adapters/default.js +5 -3
- package/lib/cache/adapters/limited.d.ts +1 -2
- package/lib/cache/adapters/limited.js +34 -30
- package/lib/cache/adapters/workeradapter.js +3 -1
- package/lib/cache/index.d.ts +12 -12
- package/lib/cache/index.js +48 -39
- package/lib/cache/resources/bans.d.ts +2 -2
- package/lib/cache/resources/bans.js +1 -1
- package/lib/cache/resources/channels.d.ts +1 -1
- package/lib/cache/resources/default/guild-related.d.ts +1 -2
- package/lib/cache/resources/emojis.d.ts +2 -2
- package/lib/cache/resources/emojis.js +1 -1
- package/lib/cache/resources/guilds.d.ts +2 -2
- package/lib/cache/resources/guilds.js +7 -11
- package/lib/cache/resources/members.d.ts +2 -2
- package/lib/cache/resources/members.js +1 -1
- package/lib/cache/resources/messages.d.ts +2 -2
- package/lib/cache/resources/messages.js +3 -3
- package/lib/cache/resources/overwrites.d.ts +1 -1
- package/lib/cache/resources/roles.d.ts +2 -2
- package/lib/cache/resources/roles.js +1 -1
- package/lib/cache/resources/stickers.d.ts +2 -2
- package/lib/cache/resources/stickers.js +1 -1
- package/lib/cache/resources/users.d.ts +2 -2
- package/lib/cache/resources/users.js +1 -1
- package/lib/cache/resources/voice-states.d.ts +2 -2
- package/lib/cache/resources/voice-states.js +1 -1
- package/lib/client/base.d.ts +10 -15
- package/lib/client/base.js +48 -44
- package/lib/client/client.d.ts +4 -4
- package/lib/client/client.js +37 -38
- package/lib/client/collectors.js +1 -1
- package/lib/client/httpclient.d.ts +1 -1
- package/lib/client/httpclient.js +2 -2
- package/lib/client/transformers.d.ts +37 -34
- package/lib/client/transformers.js +66 -63
- package/lib/client/workerclient.d.ts +13 -13
- package/lib/client/workerclient.js +182 -65
- package/lib/collection.d.ts +3 -3
- package/lib/commands/applications/chat.d.ts +3 -3
- package/lib/commands/applications/chat.js +5 -6
- package/lib/commands/applications/chatcontext.d.ts +6 -6
- package/lib/commands/applications/chatcontext.js +16 -8
- package/lib/commands/applications/entryPoint.d.ts +46 -0
- package/lib/commands/applications/entryPoint.js +56 -0
- package/lib/commands/applications/entrycontext.d.ts +40 -0
- package/lib/commands/applications/entrycontext.js +85 -0
- package/lib/commands/applications/menu.d.ts +1 -1
- package/lib/commands/applications/menucontext.d.ts +5 -5
- package/lib/commands/applications/menucontext.js +6 -6
- package/lib/commands/applications/options.d.ts +7 -6
- package/lib/commands/applications/shared.d.ts +5 -2
- package/lib/commands/basecontext.d.ts +1 -1
- package/lib/commands/decorators.d.ts +20 -26
- package/lib/commands/decorators.js +8 -4
- package/lib/commands/handle.d.ts +13 -12
- package/lib/commands/handle.js +133 -65
- package/lib/commands/handler.d.ts +9 -7
- package/lib/commands/handler.js +27 -18
- package/lib/commands/index.d.ts +2 -0
- package/lib/commands/index.js +2 -0
- package/lib/commands/optionresolver.d.ts +4 -4
- package/lib/commands/optionresolver.js +4 -4
- package/lib/common/bot/watcher.d.ts +1 -1
- package/lib/common/it/formatter.d.ts +21 -21
- package/lib/common/it/formatter.js +40 -41
- package/lib/common/it/logger.js +1 -1
- package/lib/common/it/utils.d.ts +14 -6
- package/lib/common/it/utils.js +62 -27
- package/lib/common/shorters/application.d.ts +2 -3
- package/lib/common/shorters/application.js +3 -3
- package/lib/common/shorters/bans.js +1 -1
- package/lib/common/shorters/channels.d.ts +3 -3
- package/lib/common/shorters/channels.js +3 -3
- package/lib/common/shorters/emojis.js +4 -4
- package/lib/common/shorters/guilds.d.ts +3 -3
- package/lib/common/shorters/guilds.js +5 -9
- package/lib/common/shorters/interaction.d.ts +3 -3
- package/lib/common/shorters/interaction.js +6 -5
- package/lib/common/shorters/members.d.ts +4 -5
- package/lib/common/shorters/members.js +6 -7
- package/lib/common/shorters/messages.d.ts +1 -1
- package/lib/common/shorters/messages.js +4 -4
- package/lib/common/shorters/reactions.d.ts +1 -1
- package/lib/common/shorters/reactions.js +1 -1
- package/lib/common/shorters/roles.js +1 -1
- package/lib/common/shorters/templates.js +2 -2
- package/lib/common/shorters/threads.d.ts +1 -1
- package/lib/common/shorters/threads.js +17 -11
- package/lib/common/shorters/webhook.d.ts +1 -1
- package/lib/common/shorters/webhook.js +4 -4
- package/lib/common/types/options.d.ts +2 -2
- package/lib/common/types/resolvables.d.ts +1 -1
- package/lib/common/types/util.d.ts +4 -1
- package/lib/common/types/write.d.ts +3 -3
- package/lib/components/BaseComponent.js +1 -1
- package/lib/components/ButtonComponent.d.ts +1 -1
- package/lib/components/componentcommand.d.ts +1 -1
- package/lib/components/componentcontext.d.ts +4 -4
- package/lib/components/componentcontext.js +1 -1
- package/lib/components/handler.d.ts +10 -8
- package/lib/components/handler.js +16 -13
- package/lib/components/index.js +2 -1
- package/lib/components/modalcontext.d.ts +2 -2
- package/lib/components/modalcontext.js +1 -1
- package/lib/deps/mixer.d.ts +1 -1
- package/lib/deps/mixer.js +6 -1
- package/lib/events/handler.d.ts +5 -5
- package/lib/events/handler.js +69 -19
- package/lib/events/hooks/application_command.d.ts +1 -1
- package/lib/events/hooks/auto_moderation.d.ts +1 -1
- package/lib/events/hooks/auto_moderation.js +1 -1
- package/lib/events/hooks/channel.d.ts +1 -1
- package/lib/events/hooks/custom.d.ts +1 -0
- package/lib/events/hooks/custom.js +5 -1
- package/lib/events/hooks/dispatch.d.ts +1 -1
- package/lib/events/hooks/entitlement.d.ts +4 -5
- package/lib/events/hooks/entitlement.js +4 -4
- package/lib/events/hooks/guild.d.ts +3 -3
- package/lib/events/hooks/guild.js +1 -1
- package/lib/events/hooks/index.d.ts +1 -0
- package/lib/events/hooks/index.js +1 -0
- package/lib/events/hooks/integration.d.ts +1 -1
- package/lib/events/hooks/integration.js +1 -1
- package/lib/events/hooks/interactions.d.ts +3 -3
- package/lib/events/hooks/invite.d.ts +1 -1
- package/lib/events/hooks/message.d.ts +3 -3
- package/lib/events/hooks/message.js +1 -1
- package/lib/events/hooks/presence.d.ts +2 -2
- package/lib/events/hooks/soundboard.d.ts +155 -0
- package/lib/events/hooks/soundboard.js +28 -0
- package/lib/events/hooks/stage.d.ts +2 -2
- package/lib/events/hooks/subscriptions.d.ts +35 -0
- package/lib/events/hooks/subscriptions.js +16 -0
- package/lib/events/hooks/thread.d.ts +2 -2
- package/lib/events/hooks/thread.js +2 -2
- package/lib/events/hooks/typing.d.ts +1 -1
- package/lib/events/hooks/typing.js +1 -1
- package/lib/events/hooks/user.d.ts +2 -2
- package/lib/events/hooks/voice.d.ts +2 -2
- package/lib/events/hooks/voice.js +1 -1
- package/lib/events/hooks/webhook.d.ts +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.js +3 -5
- package/lib/langs/handler.d.ts +2 -2
- package/lib/structures/Guild.d.ts +7 -4
- package/lib/structures/Guild.js +1 -1
- package/lib/structures/GuildBan.d.ts +1 -1
- package/lib/structures/GuildMember.d.ts +7 -5
- package/lib/structures/GuildMember.js +5 -3
- package/lib/structures/GuildRole.d.ts +1 -1
- package/lib/structures/GuildTemplate.d.ts +1 -1
- package/lib/structures/Interaction.d.ts +39 -16
- package/lib/structures/Interaction.js +82 -26
- package/lib/structures/Message.d.ts +4 -10
- package/lib/structures/Message.js +5 -8
- package/lib/structures/Poll.d.ts +3 -3
- package/lib/structures/Sticker.d.ts +2 -2
- package/lib/structures/Sticker.js +1 -1
- package/lib/structures/VoiceState.d.ts +2 -1
- package/lib/structures/VoiceState.js +1 -1
- package/lib/structures/Webhook.d.ts +3 -3
- package/lib/structures/Webhook.js +1 -1
- package/lib/structures/channels.d.ts +4 -4
- package/lib/structures/channels.js +8 -7
- package/lib/structures/extra/BaseGuild.d.ts +11 -1
- package/lib/structures/extra/BaseGuild.js +27 -0
- package/lib/structures/extra/BitField.d.ts +3 -3
- package/lib/structures/extra/BitField.js +34 -33
- package/lib/structures/extra/DiscordBase.js +1 -1
- package/lib/structures/extra/Permissions.d.ts +2 -0
- package/lib/structures/extra/Permissions.js +21 -0
- package/lib/types/gateway.d.ts +71 -6
- package/lib/types/payloads/_interactions/_applicationCommands/chatInput.d.ts +6 -1
- package/lib/types/payloads/_interactions/applicationCommands.d.ts +41 -6
- package/lib/types/payloads/_interactions/applicationCommands.js +28 -1
- package/lib/types/payloads/_interactions/base.d.ts +1 -1
- package/lib/types/payloads/_interactions/responses.d.ts +74 -2
- package/lib/types/payloads/_interactions/responses.js +4 -0
- package/lib/types/payloads/channel.d.ts +46 -6
- package/lib/types/payloads/channel.js +5 -1
- package/lib/types/payloads/guild.d.ts +9 -1
- package/lib/types/payloads/guild.js +8 -0
- package/lib/types/payloads/index.d.ts +1 -0
- package/lib/types/payloads/index.js +1 -0
- package/lib/types/payloads/monetization.d.ts +29 -1
- package/lib/types/payloads/monetization.js +10 -1
- package/lib/types/payloads/soundboard.d.ts +23 -0
- package/lib/types/payloads/soundboard.js +5 -0
- package/lib/types/payloads/user.js +0 -1
- package/lib/types/rest/application.d.ts +3 -3
- package/lib/types/rest/auditLog.d.ts +1 -1
- package/lib/types/rest/channel.d.ts +5 -18
- package/lib/types/rest/guild.d.ts +2 -2
- package/lib/types/rest/guildScheduledEvent.d.ts +1 -1
- package/lib/types/rest/index.d.ts +1 -0
- package/lib/types/rest/index.js +1 -0
- package/lib/types/rest/interactions.d.ts +30 -8
- package/lib/types/rest/monetization.d.ts +22 -1
- package/lib/types/rest/oauth2.d.ts +1 -1
- package/lib/types/rest/poll.d.ts +1 -1
- package/lib/types/rest/soundboard.d.ts +64 -0
- package/lib/types/rest/soundboard.js +2 -0
- package/lib/types/rest/stageInstance.d.ts +1 -1
- package/lib/types/rest/template.d.ts +1 -1
- package/lib/types/rest/user.d.ts +1 -1
- package/lib/types/rest/webhook.d.ts +3 -3
- package/lib/types/utils/index.d.ts +27 -7
- package/lib/types/utils/index.js +25 -6
- package/lib/websocket/SharedTypes.d.ts +18 -3
- package/lib/websocket/constants/index.d.ts +3 -2
- package/lib/websocket/constants/index.js +4 -4
- package/lib/websocket/discord/basesocket.d.ts +1 -1
- package/lib/websocket/discord/shard.d.ts +4 -3
- package/lib/websocket/discord/shard.js +47 -24
- package/lib/websocket/discord/sharder.d.ts +9 -6
- package/lib/websocket/discord/sharder.js +92 -17
- package/lib/websocket/discord/shared.d.ts +12 -3
- package/lib/websocket/discord/socket/custom.d.ts +1 -1
- package/lib/websocket/discord/socket/custom.js +70 -40
- package/lib/websocket/discord/worker.d.ts +9 -2
- package/lib/websocket/discord/workermanager.d.ts +42 -16
- package/lib/websocket/discord/workermanager.js +170 -46
- package/lib/websocket/structures/timeout.d.ts +4 -5
- package/lib/websocket/structures/timeout.js +23 -24
- package/package.json +72 -65
- package/lib/cache/resources/threads.d.ts +0 -14
- package/lib/cache/resources/threads.js +0 -32
package/lib/api/api.js
CHANGED
|
@@ -15,7 +15,6 @@ class ApiHandler {
|
|
|
15
15
|
ratelimits = new Map();
|
|
16
16
|
readyQueue = [];
|
|
17
17
|
cdn = Router_1.CDNRouter.createProxy();
|
|
18
|
-
debugger;
|
|
19
18
|
workerPromises;
|
|
20
19
|
constructor(options) {
|
|
21
20
|
this.options = {
|
|
@@ -41,6 +40,9 @@ class ApiHandler {
|
|
|
41
40
|
parentPort = worker_threads.parentPort;
|
|
42
41
|
}
|
|
43
42
|
}
|
|
43
|
+
get proxy() {
|
|
44
|
+
return (this._proxy_ ??= new Router_1.Router(this).createProxy());
|
|
45
|
+
}
|
|
44
46
|
globalUnblock() {
|
|
45
47
|
this.globalBlock = false;
|
|
46
48
|
let cb;
|
|
@@ -118,7 +120,7 @@ class ApiHandler {
|
|
|
118
120
|
this.clearResetInterval(route);
|
|
119
121
|
next();
|
|
120
122
|
if (result.length > 0) {
|
|
121
|
-
if (response.headers.get('content-type')
|
|
123
|
+
if (response.headers.get('content-type')?.includes('application/json')) {
|
|
122
124
|
try {
|
|
123
125
|
result = JSON.parse(result);
|
|
124
126
|
}
|
|
@@ -135,7 +137,7 @@ class ApiHandler {
|
|
|
135
137
|
return;
|
|
136
138
|
}
|
|
137
139
|
if (result.length > 0) {
|
|
138
|
-
if (response.headers.get('content-type')
|
|
140
|
+
if (response.headers.get('content-type')?.includes('application/json')) {
|
|
139
141
|
try {
|
|
140
142
|
result = JSON.parse(result);
|
|
141
143
|
}
|
|
@@ -148,7 +150,7 @@ class ApiHandler {
|
|
|
148
150
|
}
|
|
149
151
|
}
|
|
150
152
|
next();
|
|
151
|
-
return resolve(
|
|
153
|
+
return resolve(result || undefined);
|
|
152
154
|
};
|
|
153
155
|
return new Promise((resolve, reject) => {
|
|
154
156
|
if (this.globalBlock && auth) {
|
|
@@ -177,10 +179,10 @@ class ApiHandler {
|
|
|
177
179
|
errMessage += `${JSON.stringify(result.errors, null, 2)}\n`;
|
|
178
180
|
}
|
|
179
181
|
}
|
|
180
|
-
if (
|
|
181
|
-
return new Error(errMessage
|
|
182
|
+
if (errMessage.length) {
|
|
183
|
+
return new Error(errMessage);
|
|
182
184
|
}
|
|
183
|
-
return new Error(
|
|
185
|
+
return new Error(response.statusText);
|
|
184
186
|
}
|
|
185
187
|
async handle50X(method, url, request, next) {
|
|
186
188
|
const wait = Math.floor(Math.random() * 1900 + 100);
|
|
@@ -196,17 +198,19 @@ class ApiHandler {
|
|
|
196
198
|
});
|
|
197
199
|
}
|
|
198
200
|
async handle429(route, method, url, request, response, result, next, reject, now) {
|
|
199
|
-
const content =
|
|
200
|
-
let retryAfter;
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
201
|
+
const content = `${JSON.stringify(request)} `;
|
|
202
|
+
let retryAfter = Number(response.headers.get('x-ratelimit-reset-after') || response.headers.get('retry-after')) * 1000;
|
|
203
|
+
if (Number.isNaN(retryAfter)) {
|
|
204
|
+
try {
|
|
205
|
+
retryAfter = JSON.parse(result).retry_after * 1000;
|
|
206
|
+
}
|
|
207
|
+
catch (err) {
|
|
208
|
+
this.debugger?.warn(`Unexpected error: ${err}`);
|
|
209
|
+
reject(err);
|
|
210
|
+
return false;
|
|
211
|
+
}
|
|
208
212
|
}
|
|
209
|
-
this.debugger?.info(`${response.headers.get('x-ratelimit-global') ? 'Global' : 'Unexpected'} 429: ${result}\n${content} ${now} ${route} ${response.status}: ${this.ratelimits.get(route).remaining}/${this.ratelimits.get(route).limit} left | Reset ${retryAfter} (${this.ratelimits.get(route).reset - now}ms left) | Scope ${response.headers.get('x-ratelimit-scope')}`);
|
|
213
|
+
this.debugger?.info(`${response.headers.get('x-ratelimit-global') ? 'Global' : 'Unexpected'} 429: ${result.slice(0, 256)}\n${content} ${now} ${route} ${response.status}: ${this.ratelimits.get(route).remaining}/${this.ratelimits.get(route).limit} left | Reset ${retryAfter} (${this.ratelimits.get(route).reset - now}ms left) | Scope ${response.headers.get('x-ratelimit-scope')}`);
|
|
210
214
|
if (retryAfter) {
|
|
211
215
|
await (0, common_1.delay)(retryAfter);
|
|
212
216
|
next();
|
|
@@ -255,13 +259,13 @@ class ApiHandler {
|
|
|
255
259
|
}
|
|
256
260
|
}
|
|
257
261
|
setRatelimitsBucket(route, resp) {
|
|
258
|
-
if (resp.headers.
|
|
262
|
+
if (resp.headers.has('x-ratelimit-limit')) {
|
|
259
263
|
this.ratelimits.get(route).limit = +resp.headers.get('x-ratelimit-limit');
|
|
260
264
|
}
|
|
261
265
|
this.ratelimits.get(route).remaining =
|
|
262
266
|
resp.headers.get('x-ratelimit-remaining') === undefined ? 1 : +resp.headers.get('x-ratelimit-remaining');
|
|
263
267
|
if (this.options.smartBucket) {
|
|
264
|
-
if (resp.headers.
|
|
268
|
+
if (resp.headers.has('x-ratelimit-reset-after') &&
|
|
265
269
|
!this.ratelimits.get(route).resetAfter &&
|
|
266
270
|
Number(resp.headers.get('x-ratelimit-limit')) === Number(resp.headers.get('x-ratelimit-remaining')) + 1) {
|
|
267
271
|
this.ratelimits.get(route).resetAfter = +resp.headers.get('x-ratelimit-reset-after') * 1000;
|
|
@@ -280,15 +284,15 @@ class ApiHandler {
|
|
|
280
284
|
if (options.request.query) {
|
|
281
285
|
finalUrl += `?${new URLSearchParams(options.request.query)}`;
|
|
282
286
|
}
|
|
283
|
-
if (options.request.files) {
|
|
287
|
+
if (options.request.files?.length) {
|
|
284
288
|
const formData = new FormData();
|
|
285
289
|
for (const [index, file] of options.request.files.entries()) {
|
|
286
290
|
const fileKey = file.key ?? `files[${index}]`;
|
|
287
291
|
if ((0, utils_1.isBufferLike)(file.data)) {
|
|
288
|
-
formData.append(fileKey, new Blob([file.data], { type: file.contentType }), file.
|
|
292
|
+
formData.append(fileKey, new Blob([file.data], { type: file.contentType }), file.filename);
|
|
289
293
|
}
|
|
290
294
|
else {
|
|
291
|
-
formData.append(fileKey, new Blob([`${file.data}`], { type: file.contentType }), file.
|
|
295
|
+
formData.append(fileKey, new Blob([`${file.data}`], { type: file.contentType }), file.filename);
|
|
292
296
|
}
|
|
293
297
|
}
|
|
294
298
|
if (options.request.body) {
|
package/lib/api/shared.d.ts
CHANGED
|
@@ -18,9 +18,9 @@ export interface ApiHandlerInternalOptions extends MakeRequired<ApiHandlerOption
|
|
|
18
18
|
}
|
|
19
19
|
export interface RawFile {
|
|
20
20
|
contentType?: string;
|
|
21
|
-
data: Buffer | Uint8Array | boolean | number | string;
|
|
21
|
+
data: ArrayBuffer | Buffer | Uint8Array | boolean | number | string;
|
|
22
22
|
key?: string;
|
|
23
|
-
|
|
23
|
+
filename: string;
|
|
24
24
|
}
|
|
25
25
|
export interface ApiRequestOptions {
|
|
26
26
|
body?: Record<string, any>;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
export declare const DefaultUserAgent = "DiscordBot (https://seyfert.dev, v2.
|
|
1
|
+
export declare const DefaultUserAgent = "DiscordBot (https://seyfert.dev, v2.1.0)";
|
|
2
2
|
export declare const ALLOWED_EXTENSIONS: readonly ["webp", "png", "jpg", "jpeg", "gif"];
|
|
3
3
|
export declare const ALLOWED_STICKER_EXTENSIONS: readonly ["png", "json", "gif"];
|
|
4
4
|
export declare const ALLOWED_SIZES: readonly [16, 32, 64, 100, 128, 256, 512, 1024, 2048, 4096];
|
|
5
|
+
export declare const ALLOWED_SOUNDS_EXTENSIONS: readonly ["mp3", "ogg"];
|
|
5
6
|
export type ImageExtension = (typeof ALLOWED_EXTENSIONS)[number];
|
|
6
7
|
export type StickerExtension = (typeof ALLOWED_STICKER_EXTENSIONS)[number];
|
|
7
8
|
export type ImageSize = (typeof ALLOWED_SIZES)[number];
|
|
9
|
+
export type SoundExtension = (typeof ALLOWED_SOUNDS_EXTENSIONS)[number];
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ALLOWED_SIZES = exports.ALLOWED_STICKER_EXTENSIONS = exports.ALLOWED_EXTENSIONS = exports.DefaultUserAgent = void 0;
|
|
4
|
-
exports.DefaultUserAgent = 'DiscordBot (https://seyfert.dev, v2.
|
|
3
|
+
exports.ALLOWED_SOUNDS_EXTENSIONS = exports.ALLOWED_SIZES = exports.ALLOWED_STICKER_EXTENSIONS = exports.ALLOWED_EXTENSIONS = exports.DefaultUserAgent = void 0;
|
|
4
|
+
exports.DefaultUserAgent = 'DiscordBot (https://seyfert.dev, v2.1.0)';
|
|
5
5
|
exports.ALLOWED_EXTENSIONS = ['webp', 'png', 'jpg', 'jpeg', 'gif'];
|
|
6
6
|
exports.ALLOWED_STICKER_EXTENSIONS = ['png', 'json', 'gif'];
|
|
7
7
|
exports.ALLOWED_SIZES = [16, 32, 64, 100, 128, 256, 512, 1_024, 2_048, 4_096];
|
|
8
|
+
exports.ALLOWED_SOUNDS_EXTENSIONS = ['mp3', 'ogg'];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type APIActionRowComponent, type APIActionRowComponentTypes, type APIMessageActionRowComponent } from '../types';
|
|
2
1
|
import type { RestOrArray } from '../common/types/util';
|
|
2
|
+
import { type APIActionRowComponent, type APIActionRowComponentTypes, type APIMessageActionRowComponent } from '../types';
|
|
3
3
|
import { BaseComponentBuilder } from './Base';
|
|
4
4
|
import type { BuilderComponents, FixedComponents } from './types';
|
|
5
5
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { UsingClient, RawFile } from '..';
|
|
1
|
+
import type { RawFile, UsingClient } from '..';
|
|
3
2
|
import type { ImageResolvable, ObjectToLower } from '../common';
|
|
4
3
|
import { Base } from '../structures/extra/Base';
|
|
4
|
+
import type { APIAttachment, RESTAPIAttachment } from '../types';
|
|
5
5
|
export interface AttachmentResolvableMap {
|
|
6
6
|
url: string;
|
|
7
7
|
buffer: Buffer | ArrayBuffer;
|
|
@@ -10,7 +10,7 @@ export interface AttachmentResolvableMap {
|
|
|
10
10
|
export type AttachmentResolvable = AttachmentResolvableMap[keyof AttachmentResolvableMap] | AttachmentBuilder | Attachment;
|
|
11
11
|
export type AttachmentDataType = keyof AttachmentResolvableMap;
|
|
12
12
|
export interface AttachmentData {
|
|
13
|
-
|
|
13
|
+
filename: string;
|
|
14
14
|
description: string;
|
|
15
15
|
resolvable: AttachmentResolvable;
|
|
16
16
|
type: AttachmentDataType;
|
|
@@ -10,9 +10,9 @@ exports.resolveAttachmentData = resolveAttachmentData;
|
|
|
10
10
|
exports.resolveBase64 = resolveBase64;
|
|
11
11
|
exports.resolveImage = resolveImage;
|
|
12
12
|
const node_crypto_1 = require("node:crypto");
|
|
13
|
+
const node_fs_1 = require("node:fs");
|
|
13
14
|
const node_path_1 = __importDefault(require("node:path"));
|
|
14
15
|
const Base_1 = require("../structures/extra/Base");
|
|
15
|
-
const node_fs_1 = require("node:fs");
|
|
16
16
|
class Attachment extends Base_1.Base {
|
|
17
17
|
data;
|
|
18
18
|
constructor(client, data) {
|
|
@@ -28,7 +28,7 @@ class AttachmentBuilder {
|
|
|
28
28
|
* Creates a new Attachment instance.
|
|
29
29
|
* @param data - The partial attachment data.
|
|
30
30
|
*/
|
|
31
|
-
constructor(data = {
|
|
31
|
+
constructor(data = { filename: `${((0, node_crypto_1.randomBytes)?.(8))?.toString('base64url') || 'default'}.jpg` }) {
|
|
32
32
|
this.data = data;
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
@@ -39,7 +39,7 @@ class AttachmentBuilder {
|
|
|
39
39
|
* attachment.setName('example.jpg');
|
|
40
40
|
*/
|
|
41
41
|
setName(name) {
|
|
42
|
-
this.data.
|
|
42
|
+
this.data.filename = name;
|
|
43
43
|
return this;
|
|
44
44
|
}
|
|
45
45
|
/**
|
|
@@ -79,17 +79,17 @@ class AttachmentBuilder {
|
|
|
79
79
|
if (spoiler === this.spoiler)
|
|
80
80
|
return this;
|
|
81
81
|
if (!spoiler) {
|
|
82
|
-
this.data.
|
|
82
|
+
this.data.filename = this.data.filename.slice('SPOILER_'.length);
|
|
83
83
|
return this;
|
|
84
84
|
}
|
|
85
|
-
this.data.
|
|
85
|
+
this.data.filename = `SPOILER_${this.data.filename}`;
|
|
86
86
|
return this;
|
|
87
87
|
}
|
|
88
88
|
/**
|
|
89
89
|
* Gets whether the attachment is a spoiler.
|
|
90
90
|
*/
|
|
91
91
|
get spoiler() {
|
|
92
|
-
return this.data.
|
|
92
|
+
return this.data.filename?.startsWith('SPOILER_') ?? false;
|
|
93
93
|
}
|
|
94
94
|
/**
|
|
95
95
|
* Converts the Attachment instance to JSON.
|
|
@@ -109,10 +109,10 @@ function resolveAttachment(resolve) {
|
|
|
109
109
|
if ('id' in resolve)
|
|
110
110
|
return resolve;
|
|
111
111
|
if (resolve instanceof AttachmentBuilder) {
|
|
112
|
-
const
|
|
113
|
-
return { filename
|
|
112
|
+
const { filename, description } = resolve.toJSON();
|
|
113
|
+
return { filename, description };
|
|
114
114
|
}
|
|
115
|
-
return { filename: resolve.
|
|
115
|
+
return { filename: resolve.filename, description: resolve.description };
|
|
116
116
|
}
|
|
117
117
|
/**
|
|
118
118
|
* Resolves a list of attachments to raw files.
|
|
@@ -122,9 +122,9 @@ function resolveAttachment(resolve) {
|
|
|
122
122
|
async function resolveFiles(resources) {
|
|
123
123
|
const data = await Promise.all(resources.map(async (resource, i) => {
|
|
124
124
|
if (resource instanceof AttachmentBuilder) {
|
|
125
|
-
const { type, resolvable,
|
|
125
|
+
const { type, resolvable, filename } = resource.toJSON();
|
|
126
126
|
const resolve = await resolveAttachmentData(resolvable, type);
|
|
127
|
-
return { ...resolve, key: `files[${i}]`,
|
|
127
|
+
return { ...resolve, key: `files[${i}]`, filename };
|
|
128
128
|
}
|
|
129
129
|
if (resource instanceof Attachment) {
|
|
130
130
|
const resolve = await resolveAttachmentData(resource.url, 'url');
|
|
@@ -132,14 +132,14 @@ async function resolveFiles(resources) {
|
|
|
132
132
|
data: resolve.data,
|
|
133
133
|
contentType: resolve.contentType,
|
|
134
134
|
key: `files[${i}]`,
|
|
135
|
-
|
|
135
|
+
filename: resource.filename,
|
|
136
136
|
};
|
|
137
137
|
}
|
|
138
138
|
return {
|
|
139
139
|
data: resource.data,
|
|
140
140
|
contentType: resource.contentType,
|
|
141
141
|
key: `files[${i}]`,
|
|
142
|
-
|
|
142
|
+
filename: resource.filename,
|
|
143
143
|
};
|
|
144
144
|
}));
|
|
145
145
|
return data;
|
package/lib/builders/Button.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type ButtonStyle, type APIButtonComponent } from '../types';
|
|
2
1
|
import { type EmojiResolvable } from '../common';
|
|
2
|
+
import { type APIButtonComponent, type ButtonStyle } from '../types';
|
|
3
3
|
/**
|
|
4
4
|
* Represents a button component.
|
|
5
5
|
* @template Type - The type of the button component.
|
package/lib/builders/Button.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Button = void 0;
|
|
4
|
-
const types_1 = require("../types");
|
|
5
4
|
const common_1 = require("../common");
|
|
5
|
+
const types_1 = require("../types");
|
|
6
6
|
/**
|
|
7
7
|
* Represents a button component.
|
|
8
8
|
* @template Type - The type of the button component.
|
package/lib/builders/Embed.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { APIEmbed, APIEmbedAuthor, APIEmbedField, APIEmbedFooter } from '../types';
|
|
2
1
|
import { type ColorResolvable, type ObjectToLower, type RestOrArray } from '../common';
|
|
2
|
+
import type { APIEmbed, APIEmbedAuthor, APIEmbedField, APIEmbedFooter } from '../types';
|
|
3
3
|
/**
|
|
4
4
|
* Represents a message embed.
|
|
5
5
|
* @example
|
package/lib/builders/Embed.js
CHANGED
|
@@ -20,8 +20,8 @@ class Embed {
|
|
|
20
20
|
* const embed = new Embed({ title: 'Hello', description: 'This is an example embed' });
|
|
21
21
|
*/
|
|
22
22
|
constructor(data = {}) {
|
|
23
|
-
this.data = data;
|
|
24
|
-
if (!data.fields)
|
|
23
|
+
this.data = { ...data };
|
|
24
|
+
if (!this.data.fields)
|
|
25
25
|
this.data.fields = [];
|
|
26
26
|
}
|
|
27
27
|
/**
|
package/lib/builders/Modal.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type APIModalInteractionResponseCallbackData, type APITextInputComponent, type TextInputStyle } from '../types';
|
|
2
1
|
import type { RestOrArray } from '../common';
|
|
2
|
+
import { type APIModalInteractionResponseCallbackData, type APITextInputComponent, type TextInputStyle } from '../types';
|
|
3
3
|
import type { ActionRow } from './ActionRow';
|
|
4
4
|
import { BaseComponentBuilder, type OptionValuesLength } from './Base';
|
|
5
5
|
import type { ModalBuilderComponents, ModalSubmitCallback } from './types';
|
package/lib/builders/Poll.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type APIPollMedia, type RESTAPIPollCreate } from '../types';
|
|
2
1
|
import { type DeepPartial, type EmojiResolvable, type RestOrArray } from '../common';
|
|
2
|
+
import { type APIPollMedia, type RESTAPIPollCreate } from '../types';
|
|
3
3
|
export declare class PollBuilder {
|
|
4
4
|
data: DeepPartial<RESTAPIPollCreate>;
|
|
5
5
|
constructor(data?: DeepPartial<RESTAPIPollCreate>);
|
package/lib/builders/Poll.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PollBuilder = void 0;
|
|
4
|
-
const types_1 = require("../types");
|
|
5
4
|
const common_1 = require("../common");
|
|
5
|
+
const types_1 = require("../types");
|
|
6
6
|
class PollBuilder {
|
|
7
7
|
data;
|
|
8
8
|
constructor(data = {}) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { type APIChannelSelectComponent, type APIMentionableSelectComponent, type APIRoleSelectComponent, type APISelectMenuComponent, type APISelectMenuOption, type APIStringSelectComponent, type APIUserSelectComponent, type ChannelType, SelectMenuDefaultValueType } from '../types';
|
|
2
1
|
import type { EmojiResolvable, RestOrArray, ToClass } from '../common';
|
|
3
2
|
import type { ChannelSelectMenuInteraction, ComponentInteraction, MentionableSelectMenuInteraction, RoleSelectMenuInteraction, StringSelectMenuInteraction, UserSelectMenuInteraction } from '../structures';
|
|
3
|
+
import { type APIChannelSelectComponent, type APIMentionableSelectComponent, type APIRoleSelectComponent, type APISelectMenuComponent, type APISelectMenuOption, type APIStringSelectComponent, type APIUserSelectComponent, type ChannelType, SelectMenuDefaultValueType } from '../types';
|
|
4
4
|
import { BaseComponentBuilder, type OptionValuesLength } from './Base';
|
|
5
5
|
export type BuilderSelectMenus = RoleSelectMenu | UserSelectMenu | MentionableSelectMenu | ChannelSelectMenu | StringSelectMenu;
|
|
6
6
|
/**
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.StringSelectOption = exports.StringSelectMenu = exports.ChannelSelectMenu = exports.MentionableSelectMenu = exports.RoleSelectMenu = exports.UserSelectMenu = exports.SelectMenu = void 0;
|
|
4
|
-
const types_1 = require("../types");
|
|
5
4
|
const utils_1 = require("../common/it/utils");
|
|
5
|
+
const types_1 = require("../types");
|
|
6
6
|
const Base_1 = require("./Base");
|
|
7
7
|
/**
|
|
8
8
|
* Maps default values for Select Menus.
|
package/lib/builders/types.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import type { TextInput } from './Modal';
|
|
|
4
4
|
import type { BuilderSelectMenus } from './SelectMenu';
|
|
5
5
|
export type ComponentCallback<T extends ComponentInteraction | StringSelectMenuInteraction = ComponentInteraction | StringSelectMenuInteraction> = (interaction: T, stop: ComponentStopCallback, refresh: ComponentRefreshCallback) => any;
|
|
6
6
|
export type ComponentFilterCallback<T = ComponentInteraction> = (interaction: T) => any;
|
|
7
|
-
export type ComponentStopCallback = (reason
|
|
7
|
+
export type ComponentStopCallback = (reason: 'messageDelete' | 'channelDelete' | 'guildDelete' | (string & {}) | undefined, refresh: ComponentRefreshCallback) => any;
|
|
8
8
|
export type ComponentRefreshCallback = () => any;
|
|
9
9
|
export type ModalSubmitCallback<T = ModalSubmitInteraction> = (interaction: T) => any;
|
|
10
10
|
export type ButtonLink = Omit<Button, 'setCustomId'>;
|
|
@@ -17,5 +17,6 @@ export interface ListenerOptions {
|
|
|
17
17
|
timeout?: number;
|
|
18
18
|
idle?: number;
|
|
19
19
|
filter?: ComponentFilterCallback;
|
|
20
|
+
onPass?: ComponentFilterCallback;
|
|
20
21
|
onStop?: ComponentStopCallback;
|
|
21
22
|
}
|
|
@@ -8,15 +8,17 @@ class MemoryAdapter {
|
|
|
8
8
|
relationships = new Map();
|
|
9
9
|
constructor(options = {
|
|
10
10
|
encode(data) {
|
|
11
|
-
return
|
|
11
|
+
return data;
|
|
12
12
|
},
|
|
13
13
|
decode(data) {
|
|
14
|
-
return
|
|
14
|
+
return data;
|
|
15
15
|
},
|
|
16
16
|
}) {
|
|
17
17
|
this.options = options;
|
|
18
18
|
}
|
|
19
|
-
start() {
|
|
19
|
+
start() {
|
|
20
|
+
//
|
|
21
|
+
}
|
|
20
22
|
scan(query, keys = false) {
|
|
21
23
|
const values = [];
|
|
22
24
|
const sq = query.split('.');
|
|
@@ -18,7 +18,6 @@ export interface LimitedMemoryAdapterOptions<T> {
|
|
|
18
18
|
role?: ResourceLimitedMemoryAdapter;
|
|
19
19
|
stage_instance?: ResourceLimitedMemoryAdapter;
|
|
20
20
|
sticker?: ResourceLimitedMemoryAdapter;
|
|
21
|
-
thread?: ResourceLimitedMemoryAdapter;
|
|
22
21
|
overwrite?: ResourceLimitedMemoryAdapter;
|
|
23
22
|
message?: ResourceLimitedMemoryAdapter;
|
|
24
23
|
encode?(data: any): T;
|
|
@@ -34,7 +33,7 @@ export declare class LimitedMemoryAdapter<T> implements Adapter {
|
|
|
34
33
|
scan(query: string, keys?: false): any[];
|
|
35
34
|
scan(query: string, keys: true): string[];
|
|
36
35
|
bulkGet(keys: string[]): unknown[];
|
|
37
|
-
get(
|
|
36
|
+
get(key: string): unknown;
|
|
38
37
|
private __set;
|
|
39
38
|
bulkSet(keys: [string, any][]): void;
|
|
40
39
|
set(keys: string, data: any): void;
|
|
@@ -15,37 +15,41 @@ class LimitedMemoryAdapter {
|
|
|
15
15
|
limit: Number.POSITIVE_INFINITY,
|
|
16
16
|
},
|
|
17
17
|
encode(data) {
|
|
18
|
-
return
|
|
18
|
+
return data;
|
|
19
19
|
},
|
|
20
20
|
decode(data) {
|
|
21
|
-
return
|
|
21
|
+
return data;
|
|
22
22
|
},
|
|
23
23
|
}, options);
|
|
24
24
|
}
|
|
25
|
-
start() {
|
|
25
|
+
start() {
|
|
26
|
+
//
|
|
27
|
+
}
|
|
26
28
|
scan(query, keys = false) {
|
|
27
|
-
const values = [];
|
|
28
29
|
const sq = query.split('.');
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
return values;
|
|
30
|
+
const isWildcard = sq.map(segment => segment === '*');
|
|
31
|
+
return [...this.storage.values()].flatMap(storageEntry => Array.from(storageEntry.entries())
|
|
32
|
+
.filter(([key]) => key.split('.').every((value, i) => isWildcard[i] || sq[i] === value))
|
|
33
|
+
.map(([key, value]) => (keys ? key : this.options.decode(value.value))));
|
|
36
34
|
}
|
|
37
35
|
bulkGet(keys) {
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
36
|
+
const storageArray = Array.from(this.storage.values());
|
|
37
|
+
const keySet = new Set(keys);
|
|
38
|
+
return storageArray
|
|
39
|
+
.flatMap(storageEntry => {
|
|
40
|
+
const entries = Array.from(storageEntry.entries());
|
|
41
|
+
return entries.filter(([key]) => keySet.has(key)).map(([, value]) => this.options.decode(value.value));
|
|
43
42
|
})
|
|
44
|
-
.filter(
|
|
43
|
+
.filter(Boolean);
|
|
45
44
|
}
|
|
46
|
-
get(
|
|
47
|
-
const
|
|
48
|
-
|
|
45
|
+
get(key) {
|
|
46
|
+
for (const storageEntry of this.storage.values()) {
|
|
47
|
+
if (storageEntry.has(key)) {
|
|
48
|
+
const data = storageEntry.get(key);
|
|
49
|
+
return data ? this.options.decode(data) : null;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return null;
|
|
49
53
|
}
|
|
50
54
|
__set(key, data) {
|
|
51
55
|
const __guildId = Array.isArray(data) ? data[0].guild_id : data.guild_id;
|
|
@@ -63,10 +67,6 @@ class LimitedMemoryAdapter {
|
|
|
63
67
|
const existsRelation = self.relationships.has(relationshipNamespace);
|
|
64
68
|
if (existsRelation) {
|
|
65
69
|
switch (relationshipNamespace) {
|
|
66
|
-
case 'guild':
|
|
67
|
-
case 'user':
|
|
68
|
-
self.removeToRelationship(namespace, k.split('.')[1]);
|
|
69
|
-
break;
|
|
70
70
|
case 'ban':
|
|
71
71
|
case 'member':
|
|
72
72
|
case 'voice_state':
|
|
@@ -81,11 +81,15 @@ class LimitedMemoryAdapter {
|
|
|
81
81
|
case 'role':
|
|
82
82
|
case 'stage_instance':
|
|
83
83
|
case 'sticker':
|
|
84
|
-
case 'thread':
|
|
85
84
|
case 'overwrite':
|
|
86
85
|
case 'message':
|
|
87
86
|
self.removeToRelationship(namespace, k.split('.')[1]);
|
|
88
87
|
break;
|
|
88
|
+
// case 'guild':
|
|
89
|
+
// case 'user':
|
|
90
|
+
default:
|
|
91
|
+
self.removeToRelationship(namespace, k.split('.')[1]);
|
|
92
|
+
break;
|
|
89
93
|
}
|
|
90
94
|
}
|
|
91
95
|
},
|
|
@@ -152,17 +156,12 @@ class LimitedMemoryAdapter {
|
|
|
152
156
|
?.delete(`${parentNamespace}.${keySplit.at(1)}.${keySplit.at(2)}`);
|
|
153
157
|
}
|
|
154
158
|
break;
|
|
155
|
-
case 'user':
|
|
156
|
-
case 'guild':
|
|
157
|
-
this.storage.get(parentNamespace)?.delete(`${parentNamespace}.${keySplit.at(1)}`);
|
|
158
|
-
break;
|
|
159
159
|
case 'channel':
|
|
160
160
|
case 'emoji':
|
|
161
161
|
case 'presence':
|
|
162
162
|
case 'role':
|
|
163
163
|
case 'stage_instance':
|
|
164
164
|
case 'sticker':
|
|
165
|
-
case 'thread':
|
|
166
165
|
case 'overwrite':
|
|
167
166
|
case 'message':
|
|
168
167
|
for (const keyStorage of this.storage.keys()) {
|
|
@@ -175,6 +174,11 @@ class LimitedMemoryAdapter {
|
|
|
175
174
|
}
|
|
176
175
|
}
|
|
177
176
|
break;
|
|
177
|
+
// case 'user':
|
|
178
|
+
// case 'guild':
|
|
179
|
+
default:
|
|
180
|
+
this.storage.get(parentNamespace)?.delete(`${parentNamespace}.${keySplit.at(1)}`);
|
|
181
|
+
break;
|
|
178
182
|
}
|
|
179
183
|
}
|
|
180
184
|
flush() {
|
package/lib/cache/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type If, Logger } from '../common';
|
|
2
2
|
import type { Adapter } from './adapters';
|
|
3
3
|
import { Guilds } from './resources/guilds';
|
|
4
4
|
import { Users } from './resources/users';
|
|
5
|
+
import { Bans } from './resources/bans';
|
|
5
6
|
import { Channels } from './resources/channels';
|
|
6
7
|
import { Emojis } from './resources/emojis';
|
|
7
8
|
import { Members } from './resources/members';
|
|
@@ -9,19 +10,20 @@ import { Presences } from './resources/presence';
|
|
|
9
10
|
import { Roles } from './resources/roles';
|
|
10
11
|
import { StageInstances } from './resources/stage-instances';
|
|
11
12
|
import { Stickers } from './resources/stickers';
|
|
12
|
-
import { Threads } from './resources/threads';
|
|
13
13
|
import { VoiceStates } from './resources/voice-states';
|
|
14
|
-
import { Bans } from './resources/bans';
|
|
15
|
-
import { GatewayIntentBits, type GatewayDispatchPayload } from '../types';
|
|
16
14
|
import type { InternalOptions, UsingClient } from '../commands';
|
|
17
|
-
import {
|
|
15
|
+
import { type GatewayDispatchPayload, GatewayIntentBits } from '../types';
|
|
18
16
|
import { Messages } from './resources/messages';
|
|
17
|
+
import { Overwrites } from './resources/overwrites';
|
|
18
|
+
export { BaseResource } from './resources/default/base';
|
|
19
|
+
export { GuildRelatedResource } from './resources/default/guild-related';
|
|
20
|
+
export { GuildBasedResource } from './resources/default/guild-based';
|
|
19
21
|
export type InferAsyncCache = InternalOptions extends {
|
|
20
22
|
asyncCache: infer P;
|
|
21
23
|
} ? P : false;
|
|
22
24
|
export type ReturnCache<T> = If<InferAsyncCache, Promise<T>, T>;
|
|
23
25
|
export type GuildBased = 'members' | 'voiceStates';
|
|
24
|
-
export type GuildRelated = 'emojis' | 'roles' | '
|
|
26
|
+
export type GuildRelated = 'emojis' | 'roles' | 'channels' | 'stickers' | 'presences' | 'stageInstances' | 'overwrites' | 'messages' | 'bans';
|
|
25
27
|
export type NonGuildBased = 'users' | 'guilds';
|
|
26
28
|
export type SeyfertBased = 'onPacket';
|
|
27
29
|
export * from './adapters/index';
|
|
@@ -40,7 +42,6 @@ export declare class Cache {
|
|
|
40
42
|
overwrites?: Overwrites;
|
|
41
43
|
roles?: Roles;
|
|
42
44
|
emojis?: Emojis;
|
|
43
|
-
threads?: Threads;
|
|
44
45
|
channels?: Channels;
|
|
45
46
|
stickers?: Stickers;
|
|
46
47
|
presences?: Presences;
|
|
@@ -55,7 +56,7 @@ export declare class Cache {
|
|
|
55
56
|
get hasRolesIntent(): boolean;
|
|
56
57
|
get hasChannelsIntent(): boolean;
|
|
57
58
|
get hasGuildMembersIntent(): boolean;
|
|
58
|
-
get
|
|
59
|
+
get hasGuildExpressionsIntent(): boolean;
|
|
59
60
|
get hasVoiceStatesIntent(): boolean;
|
|
60
61
|
get hasPrenseceUpdates(): boolean;
|
|
61
62
|
get hasDirectMessages(): boolean;
|
|
@@ -75,16 +76,14 @@ export declare class Cache {
|
|
|
75
76
|
members: import("..").GuildMember[];
|
|
76
77
|
users: import("..").User[];
|
|
77
78
|
channels: NonNullable<ReturnCache<import("..").AllChannels | undefined>>[];
|
|
78
|
-
threads: import("..").ThreadChannel[];
|
|
79
79
|
messages: import("..").Message[];
|
|
80
|
+
voiceStates: import("..").VoiceState[];
|
|
80
81
|
presences: (Omit<import("../types").GatewayPresenceUpdate, "user"> & {
|
|
81
82
|
id: string;
|
|
82
83
|
user_id: string;
|
|
83
84
|
} & {
|
|
84
85
|
guild_id: string;
|
|
85
86
|
})[];
|
|
86
|
-
bans: import("../structures/GuildBan").GuildBan[];
|
|
87
|
-
voiceStates: import("..").VoiceState[];
|
|
88
87
|
stageInstances: (import("../types").APIStageInstance & {
|
|
89
88
|
guild_id: string;
|
|
90
89
|
})[];
|
|
@@ -95,6 +94,7 @@ export declare class Cache {
|
|
|
95
94
|
allow: import("../structures/extra/Permissions").PermissionsBitField;
|
|
96
95
|
guildId: string;
|
|
97
96
|
}[][];
|
|
97
|
+
bans: import("../structures/GuildBan").GuildBan[];
|
|
98
98
|
}>>;
|
|
99
99
|
bulkPatch(keys: (readonly [
|
|
100
100
|
NonGuildBased,
|
|
@@ -116,7 +116,7 @@ export declare class Cache {
|
|
|
116
116
|
string,
|
|
117
117
|
string
|
|
118
118
|
])[]): Promise<void>;
|
|
119
|
-
onPacket
|
|
119
|
+
onPacket(event: GatewayDispatchPayload): Promise<void>;
|
|
120
120
|
testAdapter(): Promise<void>;
|
|
121
121
|
private testUsersAndMembers;
|
|
122
122
|
private testChannelsAndOverwrites;
|