seyfert 1.2.2 → 1.3.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/LICENSE +190 -190
- package/README.md +46 -46
- package/lib/api/Router.d.ts +9 -0
- package/lib/api/Router.js +16 -8
- package/lib/api/Routes/cdn.d.ts +26 -15
- package/lib/api/Routes/channels.d.ts +15 -1
- package/lib/api/api.d.ts +2 -3
- package/lib/api/api.js +4 -9
- package/lib/api/index.d.ts +0 -1
- package/lib/api/index.js +0 -1
- package/lib/api/utils/utils.d.ts +1 -1
- package/lib/api/utils/utils.js +2 -2
- package/lib/builders/Modal.d.ts +4 -1
- package/lib/builders/Modal.js +4 -1
- package/lib/builders/Poll.d.ts +16 -0
- package/lib/builders/Poll.js +48 -0
- package/lib/builders/index.d.ts +1 -0
- package/lib/builders/index.js +1 -0
- package/lib/cache/adapters/default.d.ts +1 -0
- package/lib/cache/adapters/default.js +4 -0
- package/lib/cache/adapters/index.d.ts +1 -0
- package/lib/cache/adapters/index.js +1 -0
- package/lib/cache/adapters/limited.d.ts +50 -0
- package/lib/cache/adapters/limited.js +188 -0
- package/lib/cache/adapters/redis.d.ts +2 -0
- package/lib/cache/adapters/redis.js +17 -0
- package/lib/cache/adapters/types.d.ts +1 -0
- package/lib/cache/adapters/workeradapter.d.ts +1 -0
- package/lib/cache/adapters/workeradapter.js +6 -9
- package/lib/cache/index.d.ts +8 -3
- package/lib/cache/index.js +41 -7
- package/lib/cache/resources/channels.d.ts +2 -1
- package/lib/cache/resources/default/base.d.ts +3 -3
- package/lib/cache/resources/default/base.js +8 -3
- package/lib/cache/resources/default/guild-based.d.ts +2 -1
- package/lib/cache/resources/default/guild-based.js +7 -3
- package/lib/cache/resources/default/guild-related.d.ts +2 -1
- package/lib/cache/resources/default/guild-related.js +7 -3
- package/lib/cache/resources/emojis.d.ts +2 -0
- package/lib/cache/resources/emojis.js +4 -0
- package/lib/cache/resources/guilds.d.ts +2 -0
- package/lib/cache/resources/guilds.js +4 -0
- package/lib/cache/resources/members.d.ts +2 -0
- package/lib/cache/resources/members.js +5 -1
- package/lib/cache/resources/messages.d.ts +15 -0
- package/lib/cache/resources/messages.js +53 -0
- package/lib/cache/resources/overwrites.d.ts +4 -0
- package/lib/cache/resources/overwrites.js +4 -0
- package/lib/cache/resources/presence.d.ts +1 -0
- package/lib/cache/resources/presence.js +4 -0
- package/lib/cache/resources/roles.d.ts +2 -0
- package/lib/cache/resources/roles.js +4 -0
- package/lib/cache/resources/stage-instances.d.ts +1 -0
- package/lib/cache/resources/stage-instances.js +5 -1
- package/lib/cache/resources/stickers.d.ts +2 -0
- package/lib/cache/resources/stickers.js +4 -0
- package/lib/cache/resources/threads.d.ts +2 -0
- package/lib/cache/resources/threads.js +4 -0
- package/lib/cache/resources/users.d.ts +2 -0
- package/lib/cache/resources/users.js +4 -0
- package/lib/cache/resources/voice-states.d.ts +2 -1
- package/lib/cache/resources/voice-states.js +8 -4
- package/lib/client/base.d.ts +26 -14
- package/lib/client/base.js +41 -13
- package/lib/client/client.d.ts +6 -5
- package/lib/client/client.js +13 -1
- package/lib/client/oninteractioncreate.js +2 -2
- package/lib/client/onmessagecreate.js +17 -14
- package/lib/client/workerclient.d.ts +3 -3
- package/lib/client/workerclient.js +23 -14
- package/lib/collection.d.ts +8 -3
- package/lib/collection.js +22 -4
- package/lib/commands/applications/chat.d.ts +17 -20
- package/lib/commands/applications/chat.js +6 -21
- package/lib/commands/applications/chatcontext.d.ts +1 -1
- package/lib/commands/applications/menucontext.d.ts +1 -1
- package/lib/commands/applications/shared.d.ts +4 -0
- package/lib/commands/applications/shared.js +6 -0
- package/lib/commands/decorators.d.ts +11 -1
- package/lib/commands/decorators.js +24 -0
- package/lib/commands/handler.d.ts +11 -7
- package/lib/commands/handler.js +43 -14
- package/lib/common/index.d.ts +2 -0
- package/lib/common/index.js +2 -0
- package/lib/common/it/utils.d.ts +0 -1
- package/lib/common/it/utils.js +0 -1
- package/lib/common/shorters/channels.d.ts +8 -3
- package/lib/common/shorters/channels.js +27 -12
- package/lib/common/shorters/guilds.d.ts +6 -5
- package/lib/common/shorters/guilds.js +22 -4
- package/lib/common/shorters/interaction.d.ts +13 -0
- package/lib/common/shorters/interaction.js +61 -0
- package/lib/common/shorters/messages.d.ts +6 -3
- package/lib/common/shorters/messages.js +33 -15
- package/lib/common/shorters/roles.d.ts +3 -3
- package/lib/common/shorters/roles.js +12 -17
- package/lib/common/shorters/templates.d.ts +7 -6
- package/lib/common/shorters/templates.js +28 -6
- package/lib/common/shorters/threads.d.ts +39 -0
- package/lib/common/shorters/threads.js +76 -0
- package/lib/common/shorters/webhook.d.ts +1 -1
- package/lib/common/shorters/webhook.js +8 -2
- package/lib/common/types/options.d.ts +2 -2
- package/lib/common/types/write.d.ts +8 -5
- package/lib/components/ButtonComponent.js +1 -1
- package/lib/components/componentcontext.d.ts +1 -1
- package/lib/components/handler.d.ts +6 -17
- package/lib/components/handler.js +7 -2
- package/lib/events/handler.d.ts +8 -14
- package/lib/events/handler.js +9 -4
- package/lib/events/hooks/guild.d.ts +1 -1
- package/lib/events/hooks/guild.js +2 -2
- package/lib/events/hooks/message.d.ts +26 -8
- package/lib/events/hooks/message.js +18 -7
- package/lib/langs/handler.d.ts +4 -8
- package/lib/langs/handler.js +7 -2
- package/lib/structures/AutoModerationRule.d.ts +6 -6
- package/lib/structures/Guild.d.ts +15 -13
- package/lib/structures/GuildEmoji.d.ts +2 -2
- package/lib/structures/GuildEmoji.js +1 -1
- package/lib/structures/GuildMember.js +1 -1
- package/lib/structures/GuildRole.d.ts +5 -5
- package/lib/structures/GuildTemplate.d.ts +10 -10
- package/lib/structures/Interaction.d.ts +3 -3
- package/lib/structures/Interaction.js +27 -48
- package/lib/structures/Message.d.ts +5 -3
- package/lib/structures/Message.js +5 -0
- package/lib/structures/Poll.d.ts +15 -0
- package/lib/structures/Poll.js +26 -0
- package/lib/structures/User.d.ts +2 -3
- package/lib/structures/User.js +9 -4
- package/lib/structures/Webhook.d.ts +2 -2
- package/lib/structures/Webhook.js +1 -1
- package/lib/structures/channels.d.ts +11 -3
- package/lib/structures/channels.js +16 -8
- package/lib/structures/extra/BaseGuild.js +3 -3
- package/lib/structures/extra/Permissions.d.ts +1 -0
- package/lib/structures/index.d.ts +1 -0
- package/lib/structures/index.js +1 -0
- package/lib/websocket/SharedTypes.d.ts +7 -2
- package/lib/websocket/discord/worker.d.ts +1 -1
- package/lib/websocket/discord/workermanager.js +3 -9
- package/lib/websocket/structures/timeout.js +9 -12
- package/package.json +8 -8
- package/lib/api/CDN.d.ts +0 -212
- package/lib/api/CDN.js +0 -228
- package/lib/client/http/adapters/bun.d.ts +0 -14
- package/lib/client/http/adapters/bun.js +0 -117
- package/lib/client/http/adapters/index.d.ts +0 -15
- package/lib/client/http/adapters/index.js +0 -27
- package/lib/client/http/adapters/uws.d.ts +0 -17
- package/lib/client/http/adapters/uws.js +0 -142
- package/lib/client/http/httpclient.d.ts +0 -13
- package/lib/client/http/httpclient.js +0 -48
- package/lib/common/shorters/overwrites.d.ts +0 -29
- package/lib/common/shorters/overwrites.js +0 -63
- package/lib/components/listener.d.ts +0 -11
- package/lib/components/listener.js +0 -17
- package/lib/structures/extra/BaseComponent.d.ts +0 -9
- package/lib/structures/extra/BaseComponent.js +0 -12
- package/lib/structures/extra/BaseSelectMenuComponent.d.ts +0 -9
- package/lib/structures/extra/BaseSelectMenuComponent.js +0 -13
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RESTDeleteAPIChannelAllMessageReactionsResult, RESTDeleteAPIChannelMessageReactionResult, RESTDeleteAPIChannelMessageResult, RESTDeleteAPIChannelPermissionResult, RESTDeleteAPIChannelPinResult, RESTDeleteAPIChannelRecipientResult, RESTDeleteAPIChannelResult, RESTDeleteAPIChannelThreadMembersResult, RESTGetAPIChannelInvitesResult, RESTGetAPIChannelMessageReactionUsersQuery, RESTGetAPIChannelMessageReactionUsersResult, RESTGetAPIChannelMessageResult, RESTGetAPIChannelMessagesQuery, RESTGetAPIChannelMessagesResult, RESTGetAPIChannelPinsResult, RESTGetAPIChannelResult, RESTGetAPIChannelThreadMemberQuery, RESTGetAPIChannelThreadMemberResult, RESTGetAPIChannelThreadMembersQuery, RESTGetAPIChannelThreadMembersResult, RESTGetAPIChannelThreadsArchivedPrivateResult, RESTGetAPIChannelThreadsArchivedPublicResult, RESTGetAPIChannelThreadsArchivedQuery, RESTGetAPIChannelUsersThreadsArchivedResult, RESTGetAPIGuildWebhooksResult, RESTPatchAPIChannelJSONBody, RESTPatchAPIChannelMessageJSONBody, RESTPatchAPIChannelMessageResult, RESTPatchAPIChannelResult, RESTPostAPIChannelFollowersJSONBody, RESTPostAPIChannelFollowersResult, RESTPostAPIChannelInviteJSONBody, RESTPostAPIChannelInviteResult, RESTPostAPIChannelMessageCrosspostResult, RESTPostAPIChannelMessageJSONBody, RESTPostAPIChannelMessageResult, RESTPostAPIChannelMessagesBulkDeleteJSONBody, RESTPostAPIChannelMessagesBulkDeleteResult, RESTPostAPIChannelMessagesThreadsJSONBody, RESTPostAPIChannelMessagesThreadsResult, RESTPostAPIChannelThreadsJSONBody, RESTPostAPIChannelThreadsResult, RESTPostAPIChannelTypingResult, RESTPostAPIChannelWebhookJSONBody, RESTPostAPIChannelWebhookResult, RESTPostAPIGuildForumThreadsJSONBody, RESTPutAPIChannelMessageReactionResult, RESTPutAPIChannelPermissionJSONBody, RESTPutAPIChannelPermissionResult, RESTPutAPIChannelPinResult, RESTPutAPIChannelRecipientJSONBody, RESTPutAPIChannelRecipientResult, RESTPutAPIChannelThreadMembersResult } from 'discord-api-types/v10';
|
|
1
|
+
import type { RESTDeleteAPIChannelAllMessageReactionsResult, RESTDeleteAPIChannelMessageReactionResult, RESTDeleteAPIChannelMessageResult, RESTDeleteAPIChannelPermissionResult, RESTDeleteAPIChannelPinResult, RESTDeleteAPIChannelRecipientResult, RESTDeleteAPIChannelResult, RESTDeleteAPIChannelThreadMembersResult, RESTGetAPIChannelInvitesResult, RESTGetAPIChannelMessageReactionUsersQuery, RESTGetAPIChannelMessageReactionUsersResult, RESTGetAPIChannelMessageResult, RESTGetAPIChannelMessagesQuery, RESTGetAPIChannelMessagesResult, RESTGetAPIChannelPinsResult, RESTGetAPIChannelResult, RESTGetAPIChannelThreadMemberQuery, RESTGetAPIChannelThreadMemberResult, RESTGetAPIChannelThreadMembersQuery, RESTGetAPIChannelThreadMembersResult, RESTGetAPIChannelThreadsArchivedPrivateResult, RESTGetAPIChannelThreadsArchivedPublicResult, RESTGetAPIChannelThreadsArchivedQuery, RESTGetAPIChannelUsersThreadsArchivedResult, RESTGetAPIGuildWebhooksResult, RESTGetAPIPollAnswerVotersQuery, RESTGetAPIPollAnswerVotersResult, RESTPatchAPIChannelJSONBody, RESTPatchAPIChannelMessageJSONBody, RESTPatchAPIChannelMessageResult, RESTPatchAPIChannelResult, RESTPostAPIChannelFollowersJSONBody, RESTPostAPIChannelFollowersResult, RESTPostAPIChannelInviteJSONBody, RESTPostAPIChannelInviteResult, RESTPostAPIChannelMessageCrosspostResult, RESTPostAPIChannelMessageJSONBody, RESTPostAPIChannelMessageResult, RESTPostAPIChannelMessagesBulkDeleteJSONBody, RESTPostAPIChannelMessagesBulkDeleteResult, RESTPostAPIChannelMessagesThreadsJSONBody, RESTPostAPIChannelMessagesThreadsResult, RESTPostAPIChannelThreadsJSONBody, RESTPostAPIChannelThreadsResult, RESTPostAPIChannelTypingResult, RESTPostAPIChannelWebhookJSONBody, RESTPostAPIChannelWebhookResult, RESTPostAPIGuildForumThreadsJSONBody, RESTPostAPIPollExpireResult, RESTPutAPIChannelMessageReactionResult, RESTPutAPIChannelPermissionJSONBody, RESTPutAPIChannelPermissionResult, RESTPutAPIChannelPinResult, RESTPutAPIChannelRecipientJSONBody, RESTPutAPIChannelRecipientResult, RESTPutAPIChannelThreadMembersResult } from 'discord-api-types/v10';
|
|
2
2
|
import type { ProxyRequestMethod } from '../Router';
|
|
3
3
|
import type { RestArguments } from '../api';
|
|
4
4
|
export interface ChannelRoutes {
|
|
@@ -99,5 +99,19 @@ export interface ChannelRoutes {
|
|
|
99
99
|
get(args?: RestArguments<ProxyRequestMethod.Get>): Promise<RESTGetAPIGuildWebhooksResult>;
|
|
100
100
|
post(args: RestArguments<ProxyRequestMethod.Post, RESTPostAPIChannelWebhookJSONBody>): Promise<RESTPostAPIChannelWebhookResult>;
|
|
101
101
|
};
|
|
102
|
+
'voice-status': {
|
|
103
|
+
put(args: RestArguments<ProxyRequestMethod.Put, {
|
|
104
|
+
status: string | null;
|
|
105
|
+
}>): Promise<never>;
|
|
106
|
+
};
|
|
107
|
+
polls(messageId: string): {
|
|
108
|
+
answers(id: ValidAnswerId): {
|
|
109
|
+
get(args?: RestArguments<ProxyRequestMethod.Get, never, RESTGetAPIPollAnswerVotersQuery>): Promise<RESTGetAPIPollAnswerVotersResult>;
|
|
110
|
+
};
|
|
111
|
+
expire: {
|
|
112
|
+
post(args?: RestArguments<ProxyRequestMethod.Post>): Promise<RESTPostAPIPollExpireResult>;
|
|
113
|
+
};
|
|
114
|
+
};
|
|
102
115
|
};
|
|
103
116
|
}
|
|
117
|
+
export type ValidAnswerId = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10;
|
package/lib/api/api.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Logger } from '../common';
|
|
2
|
-
import {
|
|
3
|
-
import type { ProxyRequestMethod } from './Router';
|
|
2
|
+
import { type ProxyRequestMethod } from './Router';
|
|
4
3
|
import { Bucket } from './bucket';
|
|
5
4
|
import { type ApiHandlerInternalOptions, type ApiHandlerOptions, type ApiRequestOptions, type HttpMethods, type RawFile, type RequestHeaders } from './shared';
|
|
6
5
|
export declare class ApiHandler {
|
|
@@ -9,7 +8,7 @@ export declare class ApiHandler {
|
|
|
9
8
|
globalBlock: boolean;
|
|
10
9
|
ratelimits: Map<string, Bucket>;
|
|
11
10
|
readyQueue: (() => void)[];
|
|
12
|
-
cdn:
|
|
11
|
+
cdn: import("..").CDNRoute;
|
|
13
12
|
debugger?: Logger;
|
|
14
13
|
workerPromises?: Map<string, {
|
|
15
14
|
resolve: (value: any) => any;
|
package/lib/api/api.js
CHANGED
|
@@ -7,7 +7,7 @@ const promises_1 = require("node:timers/promises");
|
|
|
7
7
|
const node_worker_threads_1 = require("node:worker_threads");
|
|
8
8
|
const common_1 = require("../common");
|
|
9
9
|
const functions_1 = require("../structures/extra/functions");
|
|
10
|
-
const
|
|
10
|
+
const Router_1 = require("./Router");
|
|
11
11
|
const bucket_1 = require("./bucket");
|
|
12
12
|
const shared_1 = require("./shared");
|
|
13
13
|
const utils_1 = require("./utils/utils");
|
|
@@ -16,7 +16,7 @@ class ApiHandler {
|
|
|
16
16
|
globalBlock = false;
|
|
17
17
|
ratelimits = new Map();
|
|
18
18
|
readyQueue = [];
|
|
19
|
-
cdn =
|
|
19
|
+
cdn = Router_1.CDNRouter.createProxy();
|
|
20
20
|
debugger;
|
|
21
21
|
workerPromises;
|
|
22
22
|
constructor(options) {
|
|
@@ -62,14 +62,9 @@ class ApiHandler {
|
|
|
62
62
|
}, request.files
|
|
63
63
|
?.filter(x => !['string', 'boolean', 'number'].includes(typeof x.data))
|
|
64
64
|
.map(x => x.data));
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
const promise = new Promise((res, rej) => {
|
|
68
|
-
resolve = res;
|
|
69
|
-
reject = rej;
|
|
65
|
+
return new Promise((res, rej) => {
|
|
66
|
+
this.workerPromises.set(nonce, { reject: rej, resolve: res });
|
|
70
67
|
});
|
|
71
|
-
this.workerPromises.set(nonce, { reject, resolve });
|
|
72
|
-
return promise;
|
|
73
68
|
}
|
|
74
69
|
const route = request.route || this.routefy(url, method);
|
|
75
70
|
let attempts = 0;
|
package/lib/api/index.d.ts
CHANGED
package/lib/api/index.js
CHANGED
|
@@ -14,7 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./CDN"), exports);
|
|
18
17
|
__exportStar(require("./Router"), exports);
|
|
19
18
|
__exportStar(require("./Routes"), exports);
|
|
20
19
|
__exportStar(require("./api"), exports);
|
package/lib/api/utils/utils.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import type { Snowflake } from 'discord-api-types/v10';
|
|
|
5
5
|
*
|
|
6
6
|
* @param userId - The user id to calculate the default avatar index for
|
|
7
7
|
*/
|
|
8
|
-
export declare function calculateUserDefaultAvatarIndex(userId: Snowflake): number;
|
|
8
|
+
export declare function calculateUserDefaultAvatarIndex(userId: Snowflake, discriminator: string): number;
|
|
9
9
|
/**
|
|
10
10
|
* Verifies that a value is a buffer-like object.
|
|
11
11
|
*
|
package/lib/api/utils/utils.js
CHANGED
|
@@ -6,8 +6,8 @@ exports.isBufferLike = exports.calculateUserDefaultAvatarIndex = void 0;
|
|
|
6
6
|
*
|
|
7
7
|
* @param userId - The user id to calculate the default avatar index for
|
|
8
8
|
*/
|
|
9
|
-
function calculateUserDefaultAvatarIndex(userId) {
|
|
10
|
-
return Number(BigInt(userId) >> 22n) % 6;
|
|
9
|
+
function calculateUserDefaultAvatarIndex(userId, discriminator) {
|
|
10
|
+
return discriminator === '0' ? Number(BigInt(userId) >> 22n) % 6 : Number.parseInt(discriminator) % 5;
|
|
11
11
|
}
|
|
12
12
|
exports.calculateUserDefaultAvatarIndex = calculateUserDefaultAvatarIndex;
|
|
13
13
|
/**
|
package/lib/builders/Modal.d.ts
CHANGED
|
@@ -9,7 +9,10 @@ import type { ModalBuilderComponents, ModalSubmitCallback } from './types';
|
|
|
9
9
|
* @example
|
|
10
10
|
* const modal = new Modal();
|
|
11
11
|
* modal.setTitle("Sample Modal");
|
|
12
|
-
* modal.addComponents(
|
|
12
|
+
* modal.addComponents(
|
|
13
|
+
* new ActionRow<TextInput>()
|
|
14
|
+
* .addComponents(new TextInput().setLabel("Enter text"))
|
|
15
|
+
* ));
|
|
13
16
|
* modal.run((interaction) => {
|
|
14
17
|
* // Handle modal submission
|
|
15
18
|
* });
|
package/lib/builders/Modal.js
CHANGED
|
@@ -10,7 +10,10 @@ const index_1 = require("./index");
|
|
|
10
10
|
* @example
|
|
11
11
|
* const modal = new Modal();
|
|
12
12
|
* modal.setTitle("Sample Modal");
|
|
13
|
-
* modal.addComponents(
|
|
13
|
+
* modal.addComponents(
|
|
14
|
+
* new ActionRow<TextInput>()
|
|
15
|
+
* .addComponents(new TextInput().setLabel("Enter text"))
|
|
16
|
+
* ));
|
|
14
17
|
* modal.run((interaction) => {
|
|
15
18
|
* // Handle modal submission
|
|
16
19
|
* });
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type APIPollMedia, type RESTAPIPollCreate } from 'discord-api-types/v10';
|
|
2
|
+
import type { DeepPartial, EmojiResolvable, RestOrArray } from '../common';
|
|
3
|
+
export declare class PollBuilder {
|
|
4
|
+
data: DeepPartial<RESTAPIPollCreate>;
|
|
5
|
+
constructor(data?: DeepPartial<RESTAPIPollCreate>);
|
|
6
|
+
addAnswers(...answers: RestOrArray<PollMedia>): this;
|
|
7
|
+
setAnswers(...answers: RestOrArray<PollMedia>): this;
|
|
8
|
+
setQuestion(data: PollMedia): this;
|
|
9
|
+
setDuration(hours: number): this;
|
|
10
|
+
allowMultiselect(value?: boolean): this;
|
|
11
|
+
toJSON(): RESTAPIPollCreate;
|
|
12
|
+
private resolvedPollMedia;
|
|
13
|
+
}
|
|
14
|
+
export type PollMedia = Omit<APIPollMedia, 'emoji'> & {
|
|
15
|
+
emoji?: EmojiResolvable;
|
|
16
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PollBuilder = void 0;
|
|
4
|
+
const v10_1 = require("discord-api-types/v10");
|
|
5
|
+
const __1 = require("..");
|
|
6
|
+
const functions_1 = require("../structures/extra/functions");
|
|
7
|
+
class PollBuilder {
|
|
8
|
+
data;
|
|
9
|
+
constructor(data = {}) {
|
|
10
|
+
this.data = data;
|
|
11
|
+
this.data.layout_type = v10_1.PollLayoutType.Default;
|
|
12
|
+
}
|
|
13
|
+
addAnswers(...answers) {
|
|
14
|
+
this.data.answers = (this.data.answers ?? []).concat(answers.flat().map(x => ({ poll_media: this.resolvedPollMedia(x) })));
|
|
15
|
+
return this;
|
|
16
|
+
}
|
|
17
|
+
setAnswers(...answers) {
|
|
18
|
+
this.data.answers = answers.flat().map(x => ({ poll_media: this.resolvedPollMedia(x) }));
|
|
19
|
+
return this;
|
|
20
|
+
}
|
|
21
|
+
setQuestion(data) {
|
|
22
|
+
this.data.question ??= {};
|
|
23
|
+
const { emoji, text } = this.resolvedPollMedia(data);
|
|
24
|
+
this.data.question.text = text;
|
|
25
|
+
this.data.question.emoji = emoji;
|
|
26
|
+
return this;
|
|
27
|
+
}
|
|
28
|
+
setDuration(hours) {
|
|
29
|
+
this.data.duration = hours;
|
|
30
|
+
return this;
|
|
31
|
+
}
|
|
32
|
+
allowMultiselect(value = true) {
|
|
33
|
+
this.data.allow_multiselect = value;
|
|
34
|
+
return this;
|
|
35
|
+
}
|
|
36
|
+
toJSON() {
|
|
37
|
+
return { ...this.data };
|
|
38
|
+
}
|
|
39
|
+
resolvedPollMedia(data) {
|
|
40
|
+
if (!data.emoji)
|
|
41
|
+
return { text: data.text };
|
|
42
|
+
const resolve = (0, functions_1.resolvePartialEmoji)(data.emoji);
|
|
43
|
+
if (!resolve)
|
|
44
|
+
return (0, __1.throwError)('Invalid Emoji');
|
|
45
|
+
return { text: data.text, emoji: resolve };
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.PollBuilder = PollBuilder;
|
package/lib/builders/index.d.ts
CHANGED
|
@@ -8,5 +8,6 @@ export * from './Button';
|
|
|
8
8
|
export * from './Embed';
|
|
9
9
|
export * from './Modal';
|
|
10
10
|
export * from './SelectMenu';
|
|
11
|
+
export * from './Poll';
|
|
11
12
|
export * from './types';
|
|
12
13
|
export declare function fromComponent(data: BuilderComponents | APIActionRowComponentTypes | APIActionRowComponent<APIActionRowComponentTypes> | ActionRow<BuilderComponents>): BuilderComponents | ActionRow<BuilderComponents>;
|
package/lib/builders/index.js
CHANGED
|
@@ -27,6 +27,7 @@ __exportStar(require("./Button"), exports);
|
|
|
27
27
|
__exportStar(require("./Embed"), exports);
|
|
28
28
|
__exportStar(require("./Modal"), exports);
|
|
29
29
|
__exportStar(require("./SelectMenu"), exports);
|
|
30
|
+
__exportStar(require("./Poll"), exports);
|
|
30
31
|
__exportStar(require("./types"), exports);
|
|
31
32
|
function fromComponent(data) {
|
|
32
33
|
if ('toJSON' in data) {
|
|
@@ -16,6 +16,7 @@ export declare class MemoryAdapter implements Adapter {
|
|
|
16
16
|
count(to: string): number;
|
|
17
17
|
remove(keys: string): void;
|
|
18
18
|
remove(keys: string[]): void;
|
|
19
|
+
flush(): void;
|
|
19
20
|
contains(to: string, keys: string): boolean;
|
|
20
21
|
getToRelationship(to: string): string[];
|
|
21
22
|
bulkAddToRelationShip(data: Record<string, string[]>): void;
|
|
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./default"), exports);
|
|
18
|
+
__exportStar(require("./limited"), exports);
|
|
18
19
|
__exportStar(require("./redis"), exports);
|
|
19
20
|
__exportStar(require("./types"), exports);
|
|
20
21
|
__exportStar(require("./workeradapter"), exports);
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { LimitedCollection } from '../..';
|
|
2
|
+
import { type MakeRequired } from '../../common';
|
|
3
|
+
import type { Adapter } from './types';
|
|
4
|
+
export interface ResourceLimitedMemoryAdapter {
|
|
5
|
+
expire?: number;
|
|
6
|
+
limit?: number;
|
|
7
|
+
}
|
|
8
|
+
export interface LimitedMemoryAdapterOptions {
|
|
9
|
+
default?: ResourceLimitedMemoryAdapter;
|
|
10
|
+
guild?: ResourceLimitedMemoryAdapter;
|
|
11
|
+
user?: ResourceLimitedMemoryAdapter;
|
|
12
|
+
member?: ResourceLimitedMemoryAdapter;
|
|
13
|
+
voice_state?: ResourceLimitedMemoryAdapter;
|
|
14
|
+
channel?: ResourceLimitedMemoryAdapter;
|
|
15
|
+
emoji?: ResourceLimitedMemoryAdapter;
|
|
16
|
+
overwrite?: ResourceLimitedMemoryAdapter;
|
|
17
|
+
presence?: ResourceLimitedMemoryAdapter;
|
|
18
|
+
role?: ResourceLimitedMemoryAdapter;
|
|
19
|
+
stage_instance?: ResourceLimitedMemoryAdapter;
|
|
20
|
+
sticker?: ResourceLimitedMemoryAdapter;
|
|
21
|
+
thread?: ResourceLimitedMemoryAdapter;
|
|
22
|
+
}
|
|
23
|
+
export declare class LimitedMemoryAdapter implements Adapter {
|
|
24
|
+
isAsync: boolean;
|
|
25
|
+
readonly storage: Map<string, LimitedCollection<string, string>>;
|
|
26
|
+
readonly relationships: Map<string, Map<string, string[]>>;
|
|
27
|
+
options: MakeRequired<LimitedMemoryAdapterOptions, 'default'>;
|
|
28
|
+
constructor(options: LimitedMemoryAdapterOptions);
|
|
29
|
+
scan(query: string, keys?: false): any[];
|
|
30
|
+
scan(query: string, keys: true): string[];
|
|
31
|
+
get(keys: string): any;
|
|
32
|
+
get(keys: string[]): any[];
|
|
33
|
+
private __set;
|
|
34
|
+
set(keys: string, data: any): void;
|
|
35
|
+
set(keys: [string, any][]): void;
|
|
36
|
+
patch(updateOnly: boolean, keys: string, data: any): void;
|
|
37
|
+
patch(updateOnly: boolean, keys: [string, any][]): void;
|
|
38
|
+
values(to: string): any[];
|
|
39
|
+
keys(to: string): string[];
|
|
40
|
+
count(to: string): number;
|
|
41
|
+
remove(keys: string): void;
|
|
42
|
+
remove(keys: string[]): void;
|
|
43
|
+
flush(): void;
|
|
44
|
+
contains(to: string, keys: string): boolean;
|
|
45
|
+
getToRelationship(to: string): string[];
|
|
46
|
+
bulkAddToRelationShip(data: Record<string, string[]>): void;
|
|
47
|
+
addToRelationship(to: string, keys: string | string[]): void;
|
|
48
|
+
removeToRelationship(to: string, keys: string | string[]): void;
|
|
49
|
+
removeRelationship(to: string | string[]): void;
|
|
50
|
+
}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LimitedMemoryAdapter = void 0;
|
|
4
|
+
const __1 = require("../..");
|
|
5
|
+
const common_1 = require("../../common");
|
|
6
|
+
class LimitedMemoryAdapter {
|
|
7
|
+
isAsync = false;
|
|
8
|
+
storage = new Map();
|
|
9
|
+
relationships = new Map();
|
|
10
|
+
options;
|
|
11
|
+
constructor(options) {
|
|
12
|
+
this.options = (0, common_1.MergeOptions)({
|
|
13
|
+
default: {
|
|
14
|
+
expire: undefined,
|
|
15
|
+
limit: Number.POSITIVE_INFINITY,
|
|
16
|
+
},
|
|
17
|
+
}, options);
|
|
18
|
+
}
|
|
19
|
+
scan(query, keys = false) {
|
|
20
|
+
const values = [];
|
|
21
|
+
const sq = query.split('.');
|
|
22
|
+
for (const iterator of [...this.storage.values()].flatMap(x => x.entries()))
|
|
23
|
+
for (const [key, value] of iterator) {
|
|
24
|
+
if (key.split('.').every((value, i) => (sq[i] === '*' ? !!value : sq[i] === value))) {
|
|
25
|
+
values.push(keys ? key : JSON.parse(value.value));
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return values;
|
|
29
|
+
}
|
|
30
|
+
get(keys) {
|
|
31
|
+
if (!Array.isArray(keys)) {
|
|
32
|
+
const data = [...this.storage.values()].find(x => x.has(keys))?.get(keys);
|
|
33
|
+
return data ? JSON.parse(data) : null;
|
|
34
|
+
}
|
|
35
|
+
const iterator = [...this.storage.values()];
|
|
36
|
+
return keys
|
|
37
|
+
.map(key => {
|
|
38
|
+
const data = iterator.find(x => x.has(key))?.get(key);
|
|
39
|
+
return data ? JSON.parse(data) : null;
|
|
40
|
+
})
|
|
41
|
+
.filter(x => x);
|
|
42
|
+
}
|
|
43
|
+
__set(key, data) {
|
|
44
|
+
const __guildId = Array.isArray(data) ? data[0].guild_id : data.guild_id;
|
|
45
|
+
const namespace = `${key.split('.')[0]}${__guildId ? `.${__guildId}` : ''}`;
|
|
46
|
+
const self = this;
|
|
47
|
+
if (!this.storage.has(namespace)) {
|
|
48
|
+
this.storage.set(namespace, new __1.LimitedCollection({
|
|
49
|
+
expire: this.options[key.split('.')[0]]?.expire ?? this.options.default.expire,
|
|
50
|
+
limit: this.options[key.split('.')[0]]?.limit ?? this.options.default.limit,
|
|
51
|
+
resetOnDemand: true,
|
|
52
|
+
onDelete(k) {
|
|
53
|
+
const relationshipNamespace = key.split('.')[0];
|
|
54
|
+
const relation = self.relationships.get(relationshipNamespace);
|
|
55
|
+
if (relation) {
|
|
56
|
+
switch (relationshipNamespace) {
|
|
57
|
+
case 'guild':
|
|
58
|
+
case 'user':
|
|
59
|
+
self.removeToRelationship(namespace, k.split('.')[1]);
|
|
60
|
+
break;
|
|
61
|
+
case 'member':
|
|
62
|
+
case 'voice_state':
|
|
63
|
+
{
|
|
64
|
+
const split = k.split('.');
|
|
65
|
+
self.removeToRelationship(`${namespace}.${split[1]}`, split[2]);
|
|
66
|
+
}
|
|
67
|
+
break;
|
|
68
|
+
case 'channel':
|
|
69
|
+
case 'emoji':
|
|
70
|
+
case 'presence':
|
|
71
|
+
case 'role':
|
|
72
|
+
case 'stage_instance':
|
|
73
|
+
case 'sticker':
|
|
74
|
+
case 'thread':
|
|
75
|
+
case 'overwrite':
|
|
76
|
+
case 'message':
|
|
77
|
+
self.removeToRelationship(namespace, k.split('.')[1]);
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
}));
|
|
83
|
+
}
|
|
84
|
+
this.storage.get(namespace).set(key, JSON.stringify(data));
|
|
85
|
+
}
|
|
86
|
+
set(keys, data) {
|
|
87
|
+
if (Array.isArray(keys)) {
|
|
88
|
+
for (const [key, value] of keys) {
|
|
89
|
+
this.__set(key, value);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
this.__set(keys, data);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
patch(updateOnly, keys, data) {
|
|
97
|
+
if (Array.isArray(keys)) {
|
|
98
|
+
for (const [key, value] of keys) {
|
|
99
|
+
const oldData = this.get(key);
|
|
100
|
+
if (updateOnly && !oldData) {
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
103
|
+
this.__set(key, Array.isArray(value) ? value : { ...(oldData ?? {}), ...value });
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
const oldData = this.get(keys);
|
|
108
|
+
if (updateOnly && !oldData) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
this.__set(keys, Array.isArray(data) ? data : { ...(oldData ?? {}), ...data });
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
values(to) {
|
|
115
|
+
const array = [];
|
|
116
|
+
const data = this.keys(to);
|
|
117
|
+
for (const key of data) {
|
|
118
|
+
const content = this.get(key);
|
|
119
|
+
if (content) {
|
|
120
|
+
array.push(content);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return array;
|
|
124
|
+
}
|
|
125
|
+
keys(to) {
|
|
126
|
+
return this.getToRelationship(to).map(id => `${to}.${id}`);
|
|
127
|
+
}
|
|
128
|
+
count(to) {
|
|
129
|
+
return this.getToRelationship(to).length;
|
|
130
|
+
}
|
|
131
|
+
remove(keys) {
|
|
132
|
+
for (const i of Array.isArray(keys) ? keys : [keys]) {
|
|
133
|
+
this.storage.get(i.split('.')[0])?.delete(i);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
flush() {
|
|
137
|
+
this.storage.clear();
|
|
138
|
+
this.relationships.clear();
|
|
139
|
+
}
|
|
140
|
+
contains(to, keys) {
|
|
141
|
+
return this.getToRelationship(to).includes(keys);
|
|
142
|
+
}
|
|
143
|
+
getToRelationship(to) {
|
|
144
|
+
const key = to.split('.')[0];
|
|
145
|
+
if (!this.relationships.has(key))
|
|
146
|
+
this.relationships.set(key, new Map());
|
|
147
|
+
const relation = this.relationships.get(key);
|
|
148
|
+
const subrelationKey = to.split('.')[1] ?? '*';
|
|
149
|
+
if (!relation.has(subrelationKey)) {
|
|
150
|
+
relation.set(subrelationKey, []);
|
|
151
|
+
}
|
|
152
|
+
return relation.get(subrelationKey);
|
|
153
|
+
}
|
|
154
|
+
bulkAddToRelationShip(data) {
|
|
155
|
+
for (const i in data) {
|
|
156
|
+
this.addToRelationship(i, data[i]);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
addToRelationship(to, keys) {
|
|
160
|
+
const key = to.split('.')[0];
|
|
161
|
+
if (!this.relationships.has(key)) {
|
|
162
|
+
this.relationships.set(key, new Map());
|
|
163
|
+
}
|
|
164
|
+
const data = this.getToRelationship(to);
|
|
165
|
+
for (const key of Array.isArray(keys) ? keys : [keys]) {
|
|
166
|
+
if (!data.includes(key)) {
|
|
167
|
+
data.push(key);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
removeToRelationship(to, keys) {
|
|
172
|
+
const data = this.getToRelationship(to);
|
|
173
|
+
if (data) {
|
|
174
|
+
for (const key of Array.isArray(keys) ? keys : [keys]) {
|
|
175
|
+
const idx = data.indexOf(key);
|
|
176
|
+
if (idx !== -1) {
|
|
177
|
+
data.splice(idx, 1);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
removeRelationship(to) {
|
|
183
|
+
for (const i of Array.isArray(to) ? to : [to]) {
|
|
184
|
+
this.relationships.delete(i);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
exports.LimitedMemoryAdapter = LimitedMemoryAdapter;
|
|
@@ -12,6 +12,7 @@ export declare class RedisAdapter implements Adapter {
|
|
|
12
12
|
} | {
|
|
13
13
|
redisOptions: RedisOptions;
|
|
14
14
|
}) & RedisAdapterOptions);
|
|
15
|
+
private __scanSets;
|
|
15
16
|
scan(query: string, returnKeys?: false): Promise<any[]>;
|
|
16
17
|
scan(query: string, returnKeys: true): Promise<string[]>;
|
|
17
18
|
get(keys: string[]): Promise<any[]>;
|
|
@@ -24,6 +25,7 @@ export declare class RedisAdapter implements Adapter {
|
|
|
24
25
|
keys(to: string): Promise<string[]>;
|
|
25
26
|
count(to: string): Promise<number>;
|
|
26
27
|
remove(keys: string | string[]): Promise<void>;
|
|
28
|
+
flush(): Promise<void>;
|
|
27
29
|
contains(to: string, keys: string): Promise<boolean>;
|
|
28
30
|
getToRelationship(to: string): Promise<string[]>;
|
|
29
31
|
bulkAddToRelationShip(data: Record<string, string[]>): Promise<void>;
|
|
@@ -19,6 +19,20 @@ class RedisAdapter {
|
|
|
19
19
|
this.client = 'client' in data ? data.client : new Redis(data.redisOptions);
|
|
20
20
|
this.namespace = data.namespace ?? 'seyfert';
|
|
21
21
|
}
|
|
22
|
+
__scanSets(query, returnKeys = false) {
|
|
23
|
+
const match = this.buildKey(query);
|
|
24
|
+
return new Promise((r, j) => {
|
|
25
|
+
const stream = this.client.scanStream({
|
|
26
|
+
match,
|
|
27
|
+
type: 'set',
|
|
28
|
+
});
|
|
29
|
+
const keys = [];
|
|
30
|
+
stream
|
|
31
|
+
.on('data', resultKeys => keys.push(...resultKeys))
|
|
32
|
+
.on('end', () => (returnKeys ? r(keys.map(x => this.buildKey(x))) : r(this.get(keys))))
|
|
33
|
+
.on('error', err => j(err));
|
|
34
|
+
});
|
|
35
|
+
}
|
|
22
36
|
scan(query, returnKeys = false) {
|
|
23
37
|
const match = this.buildKey(query);
|
|
24
38
|
return new Promise((r, j) => {
|
|
@@ -107,6 +121,9 @@ class RedisAdapter {
|
|
|
107
121
|
}
|
|
108
122
|
await this.client.del(...keys.map(x => this.buildKey(x)));
|
|
109
123
|
}
|
|
124
|
+
async flush() {
|
|
125
|
+
await this.remove(await Promise.all([this.scan(this.buildKey('*'), true), this.__scanSets(this.buildKey('*'), true)]).then(x => x.flat()));
|
|
126
|
+
}
|
|
110
127
|
async contains(to, keys) {
|
|
111
128
|
return (await this.client.sismember(`${this.buildKey(to)}:set`, keys)) === 1;
|
|
112
129
|
}
|
|
@@ -17,6 +17,7 @@ export interface Adapter {
|
|
|
17
17
|
keys(to: string): Awaitable<string[]>;
|
|
18
18
|
count(to: string): Awaitable<number>;
|
|
19
19
|
remove(keys: string | string[]): Awaitable<void>;
|
|
20
|
+
flush(): Awaitable<void>;
|
|
20
21
|
contains(to: string, keys: string): Awaitable<boolean>;
|
|
21
22
|
getToRelationship(to: string): Awaitable<string[]>;
|
|
22
23
|
bulkAddToRelationShip(data: Record<string, string[]>): Awaitable<void>;
|
|
@@ -24,6 +24,7 @@ export declare class WorkerAdapter implements Adapter {
|
|
|
24
24
|
keys(...rest: any[]): Promise<any>;
|
|
25
25
|
count(...rest: any[]): Promise<any>;
|
|
26
26
|
remove(...rest: any[]): Promise<any>;
|
|
27
|
+
flush(): Promise<any>;
|
|
27
28
|
contains(...rest: any[]): Promise<any>;
|
|
28
29
|
getToRelationship(...rest: any[]): Promise<any>;
|
|
29
30
|
bulkAddToRelationShip(...rest: any[]): Promise<any>;
|
|
@@ -26,19 +26,13 @@ class WorkerAdapter {
|
|
|
26
26
|
method,
|
|
27
27
|
workerId: this.workerData.workerId,
|
|
28
28
|
});
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
};
|
|
32
|
-
let timeout = -1;
|
|
33
|
-
const promise = new Promise((res, rej) => {
|
|
34
|
-
resolve = res;
|
|
35
|
-
timeout = setTimeout(() => {
|
|
29
|
+
return new Promise((res, rej) => {
|
|
30
|
+
const timeout = setTimeout(() => {
|
|
36
31
|
this.promises.delete(nonce);
|
|
37
32
|
rej(new Error('Timeout cache request'));
|
|
38
33
|
}, 60e3);
|
|
34
|
+
this.promises.set(nonce, { resolve: res, timeout });
|
|
39
35
|
});
|
|
40
|
-
this.promises.set(nonce, { resolve, timeout });
|
|
41
|
-
return promise;
|
|
42
36
|
}
|
|
43
37
|
scan(...rest) {
|
|
44
38
|
return this.send('scan', ...rest);
|
|
@@ -64,6 +58,9 @@ class WorkerAdapter {
|
|
|
64
58
|
remove(...rest) {
|
|
65
59
|
return this.send('remove', ...rest);
|
|
66
60
|
}
|
|
61
|
+
flush() {
|
|
62
|
+
return this.send('flush');
|
|
63
|
+
}
|
|
67
64
|
contains(...rest) {
|
|
68
65
|
return this.send('contains', ...rest);
|
|
69
66
|
}
|
package/lib/cache/index.d.ts
CHANGED
|
@@ -11,15 +11,16 @@ import { StageInstances } from './resources/stage-instances';
|
|
|
11
11
|
import { Stickers } from './resources/stickers';
|
|
12
12
|
import { Threads } from './resources/threads';
|
|
13
13
|
import { VoiceStates } from './resources/voice-states';
|
|
14
|
-
import { type GatewayDispatchPayload
|
|
14
|
+
import { GatewayIntentBits, type GatewayDispatchPayload } from 'discord-api-types/v10';
|
|
15
15
|
import type { InternalOptions, UsingClient } from '../commands';
|
|
16
16
|
import { Overwrites } from './resources/overwrites';
|
|
17
|
+
import { Messages } from './resources/messages';
|
|
17
18
|
export type InferAsyncCache = InternalOptions extends {
|
|
18
19
|
asyncCache: infer P;
|
|
19
20
|
} ? P : false;
|
|
20
21
|
export type ReturnCache<T> = If<InferAsyncCache, Promise<T>, T>;
|
|
21
22
|
export type GuildBased = 'members' | 'voiceStates';
|
|
22
|
-
export type GuildRelated = 'emojis' | 'roles' | 'threads' | 'channels' | 'stickers' | 'presences' | 'stageInstances' | 'overwrites';
|
|
23
|
+
export type GuildRelated = 'emojis' | 'roles' | 'threads' | 'channels' | 'stickers' | 'presences' | 'stageInstances' | 'overwrites' | 'messages';
|
|
23
24
|
export type NonGuildBased = 'users' | 'guilds';
|
|
24
25
|
export * from './adapters/index';
|
|
25
26
|
export type CachedEvents = 'READY' | 'GUILD_CREATE' | 'GUILD_UPDATE' | 'GUILD_DELETE' | 'CHANNEL_CREATE' | 'CHANNEL_UPDATE' | 'CHANNEL_DELETE' | 'GUILD_ROLE_CREATE' | 'GUILD_ROLE_UPDATE' | 'GUILD_ROLE_DELETE' | 'GUILD_EMOJIS_UPDATE' | 'GUILD_STICKERS_UPDATE' | 'GUILD_MEMBER_ADD' | 'GUILD_MEMBER_UPDATE' | 'GUILD_MEMBER_REMOVE' | 'MESSAGE_CREATE' | 'PRESENCE_UPDATE' | 'THREAD_DELETE' | 'THREAD_CREATE' | 'THREAD_UPDATE' | 'USER_UPDATE' | 'VOICE_STATE_UPDATE' | 'STAGE_INSTANCE_CREATE' | 'STAGE_INSTANCE_UPDATE' | 'STAGE_INSTANCE_DELETE';
|
|
@@ -39,7 +40,9 @@ export declare class Cache {
|
|
|
39
40
|
stickers?: Stickers;
|
|
40
41
|
presences?: Presences;
|
|
41
42
|
stageInstances?: StageInstances;
|
|
43
|
+
messages?: Messages;
|
|
42
44
|
constructor(intents: number, adapter: Adapter, disabledCache?: (NonGuildBased | GuildBased | GuildRelated)[], client?: UsingClient);
|
|
45
|
+
flush(): ReturnCache<void>;
|
|
43
46
|
hasIntent(intent: keyof typeof GatewayIntentBits): boolean;
|
|
44
47
|
get hasGuildsIntent(): boolean;
|
|
45
48
|
get hasRolesIntent(): boolean;
|
|
@@ -64,12 +67,13 @@ export declare class Cache {
|
|
|
64
67
|
channels: NonNullable<ReturnCache<import("..").AllChannels | undefined>>[];
|
|
65
68
|
members: import("..").GuildMember[];
|
|
66
69
|
users: import("..").User[];
|
|
67
|
-
|
|
70
|
+
messages: import("..").Message[];
|
|
68
71
|
presences: (Omit<import("discord-api-types/v10").GatewayPresenceUpdate, "user"> & {
|
|
69
72
|
id: string;
|
|
70
73
|
} & {
|
|
71
74
|
guild_id: string;
|
|
72
75
|
})[];
|
|
76
|
+
threads: import("..").ThreadChannel[];
|
|
73
77
|
voiceStates: import("..").VoiceState[];
|
|
74
78
|
stageInstances: (import("discord-api-types/v10").APIStageInstance & {
|
|
75
79
|
guild_id: string;
|
|
@@ -79,6 +83,7 @@ export declare class Cache {
|
|
|
79
83
|
id: string;
|
|
80
84
|
deny: import("../structures/extra/Permissions").PermissionsBitField;
|
|
81
85
|
allow: import("../structures/extra/Permissions").PermissionsBitField;
|
|
86
|
+
guildId: string;
|
|
82
87
|
}[][];
|
|
83
88
|
}>>;
|
|
84
89
|
bulkPatch(keys: (readonly [
|