seyfert 2.1.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 +6 -6
- package/lib/api/Routes/invites.d.ts +3 -4
- package/lib/api/Routes/skus.d.ts +4 -5
- 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 +12 -10
- package/lib/api/shared.d.ts +1 -1
- package/lib/api/utils/constants.d.ts +2 -0
- package/lib/api/utils/constants.js +2 -1
- package/lib/builders/ActionRow.d.ts +1 -1
- package/lib/builders/Attachment.d.ts +2 -2
- package/lib/builders/Attachment.js +1 -1
- 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 +8 -11
- package/lib/cache/index.js +38 -37
- 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 +9 -14
- package/lib/client/base.js +43 -44
- package/lib/client/client.d.ts +3 -7
- package/lib/client/client.js +24 -41
- package/lib/client/collectors.js +1 -1
- package/lib/client/httpclient.d.ts +1 -1
- package/lib/client/transformers.d.ts +37 -34
- package/lib/client/transformers.js +66 -63
- package/lib/client/workerclient.d.ts +10 -11
- package/lib/client/workerclient.js +180 -75
- 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 +1 -1
- package/lib/commands/applications/entrycontext.d.ts +6 -6
- package/lib/commands/applications/entrycontext.js +4 -4
- 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 +4 -4
- package/lib/commands/applications/shared.d.ts +5 -2
- package/lib/commands/basecontext.d.ts +1 -1
- package/lib/commands/decorators.d.ts +10 -10
- package/lib/commands/decorators.js +5 -4
- package/lib/commands/handle.d.ts +9 -9
- package/lib/commands/handle.js +94 -68
- package/lib/commands/handler.d.ts +5 -5
- package/lib/commands/handler.js +21 -17
- package/lib/commands/optionresolver.d.ts +4 -4
- package/lib/commands/optionresolver.js +3 -3
- 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 +4 -3
- package/lib/common/it/utils.js +52 -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 +1 -1
- 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/events/handler.d.ts +5 -5
- package/lib/events/handler.js +66 -16
- 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/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/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 +17 -14
- package/lib/structures/Interaction.js +28 -21
- package/lib/structures/Message.d.ts +4 -7
- package/lib/structures/Message.js +5 -5
- 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 +6 -5
- 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 +53 -5
- package/lib/types/payloads/_interactions/base.d.ts +1 -1
- package/lib/types/payloads/channel.d.ts +2 -2
- 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/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 +2 -2
- 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/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 +1 -1
- package/lib/types/utils/index.d.ts +11 -2
- package/lib/types/utils/index.js +10 -2
- package/lib/websocket/SharedTypes.d.ts +11 -2
- package/lib/websocket/constants/index.js +0 -10
- package/lib/websocket/discord/basesocket.d.ts +1 -1
- package/lib/websocket/discord/shard.d.ts +1 -1
- package/lib/websocket/discord/shard.js +25 -16
- package/lib/websocket/discord/sharder.d.ts +9 -6
- package/lib/websocket/discord/sharder.js +91 -74
- package/lib/websocket/discord/shared.d.ts +3 -14
- package/lib/websocket/discord/socket/custom.js +19 -6
- package/lib/websocket/discord/worker.d.ts +8 -2
- package/lib/websocket/discord/workermanager.d.ts +42 -17
- package/lib/websocket/discord/workermanager.js +144 -37
- package/lib/websocket/structures/timeout.d.ts +4 -5
- package/lib/websocket/structures/timeout.js +23 -24
- package/package.json +72 -70
- 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);
|
|
@@ -257,13 +259,13 @@ class ApiHandler {
|
|
|
257
259
|
}
|
|
258
260
|
}
|
|
259
261
|
setRatelimitsBucket(route, resp) {
|
|
260
|
-
if (resp.headers.
|
|
262
|
+
if (resp.headers.has('x-ratelimit-limit')) {
|
|
261
263
|
this.ratelimits.get(route).limit = +resp.headers.get('x-ratelimit-limit');
|
|
262
264
|
}
|
|
263
265
|
this.ratelimits.get(route).remaining =
|
|
264
266
|
resp.headers.get('x-ratelimit-remaining') === undefined ? 1 : +resp.headers.get('x-ratelimit-remaining');
|
|
265
267
|
if (this.options.smartBucket) {
|
|
266
|
-
if (resp.headers.
|
|
268
|
+
if (resp.headers.has('x-ratelimit-reset-after') &&
|
|
267
269
|
!this.ratelimits.get(route).resetAfter &&
|
|
268
270
|
Number(resp.headers.get('x-ratelimit-limit')) === Number(resp.headers.get('x-ratelimit-remaining')) + 1) {
|
|
269
271
|
this.ratelimits.get(route).resetAfter = +resp.headers.get('x-ratelimit-reset-after') * 1000;
|
|
@@ -282,7 +284,7 @@ class ApiHandler {
|
|
|
282
284
|
if (options.request.query) {
|
|
283
285
|
finalUrl += `?${new URLSearchParams(options.request.query)}`;
|
|
284
286
|
}
|
|
285
|
-
if (options.request.files) {
|
|
287
|
+
if (options.request.files?.length) {
|
|
286
288
|
const formData = new FormData();
|
|
287
289
|
for (const [index, file] of options.request.files.entries()) {
|
|
288
290
|
const fileKey = file.key ?? `files[${index}]`;
|
package/lib/api/shared.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ 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
|
}
|
|
@@ -2,6 +2,8 @@ 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;
|
|
3
|
+
exports.ALLOWED_SOUNDS_EXTENSIONS = exports.ALLOWED_SIZES = exports.ALLOWED_STICKER_EXTENSIONS = exports.ALLOWED_EXTENSIONS = exports.DefaultUserAgent = void 0;
|
|
4
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,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) {
|
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,13 +10,11 @@ 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';
|
|
19
18
|
export { BaseResource } from './resources/default/base';
|
|
20
19
|
export { GuildRelatedResource } from './resources/default/guild-related';
|
|
21
20
|
export { GuildBasedResource } from './resources/default/guild-based';
|
|
@@ -24,7 +23,7 @@ export type InferAsyncCache = InternalOptions extends {
|
|
|
24
23
|
} ? P : false;
|
|
25
24
|
export type ReturnCache<T> = If<InferAsyncCache, Promise<T>, T>;
|
|
26
25
|
export type GuildBased = 'members' | 'voiceStates';
|
|
27
|
-
export type GuildRelated = 'emojis' | 'roles' | '
|
|
26
|
+
export type GuildRelated = 'emojis' | 'roles' | 'channels' | 'stickers' | 'presences' | 'stageInstances' | 'overwrites' | 'messages' | 'bans';
|
|
28
27
|
export type NonGuildBased = 'users' | 'guilds';
|
|
29
28
|
export type SeyfertBased = 'onPacket';
|
|
30
29
|
export * from './adapters/index';
|
|
@@ -43,7 +42,6 @@ export declare class Cache {
|
|
|
43
42
|
overwrites?: Overwrites;
|
|
44
43
|
roles?: Roles;
|
|
45
44
|
emojis?: Emojis;
|
|
46
|
-
threads?: Threads;
|
|
47
45
|
channels?: Channels;
|
|
48
46
|
stickers?: Stickers;
|
|
49
47
|
presences?: Presences;
|
|
@@ -58,7 +56,7 @@ export declare class Cache {
|
|
|
58
56
|
get hasRolesIntent(): boolean;
|
|
59
57
|
get hasChannelsIntent(): boolean;
|
|
60
58
|
get hasGuildMembersIntent(): boolean;
|
|
61
|
-
get
|
|
59
|
+
get hasGuildExpressionsIntent(): boolean;
|
|
62
60
|
get hasVoiceStatesIntent(): boolean;
|
|
63
61
|
get hasPrenseceUpdates(): boolean;
|
|
64
62
|
get hasDirectMessages(): boolean;
|
|
@@ -78,16 +76,14 @@ export declare class Cache {
|
|
|
78
76
|
members: import("..").GuildMember[];
|
|
79
77
|
users: import("..").User[];
|
|
80
78
|
channels: NonNullable<ReturnCache<import("..").AllChannels | undefined>>[];
|
|
81
|
-
threads: import("..").ThreadChannel[];
|
|
82
79
|
messages: import("..").Message[];
|
|
80
|
+
voiceStates: import("..").VoiceState[];
|
|
83
81
|
presences: (Omit<import("../types").GatewayPresenceUpdate, "user"> & {
|
|
84
82
|
id: string;
|
|
85
83
|
user_id: string;
|
|
86
84
|
} & {
|
|
87
85
|
guild_id: string;
|
|
88
86
|
})[];
|
|
89
|
-
bans: import("../structures/GuildBan").GuildBan[];
|
|
90
|
-
voiceStates: import("..").VoiceState[];
|
|
91
87
|
stageInstances: (import("../types").APIStageInstance & {
|
|
92
88
|
guild_id: string;
|
|
93
89
|
})[];
|
|
@@ -98,6 +94,7 @@ export declare class Cache {
|
|
|
98
94
|
allow: import("../structures/extra/Permissions").PermissionsBitField;
|
|
99
95
|
guildId: string;
|
|
100
96
|
}[][];
|
|
97
|
+
bans: import("../structures/GuildBan").GuildBan[];
|
|
101
98
|
}>>;
|
|
102
99
|
bulkPatch(keys: (readonly [
|
|
103
100
|
NonGuildBased,
|