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
|
@@ -8,7 +8,6 @@ class BaseCommand {
|
|
|
8
8
|
__filePath;
|
|
9
9
|
__t;
|
|
10
10
|
__autoload;
|
|
11
|
-
__tGroups;
|
|
12
11
|
guildId;
|
|
13
12
|
name;
|
|
14
13
|
type; // ApplicationCommandType.ChatInput | ApplicationCommandOptionType.Subcommand
|
|
@@ -21,6 +20,8 @@ class BaseCommand {
|
|
|
21
20
|
name_localizations;
|
|
22
21
|
description_localizations;
|
|
23
22
|
options;
|
|
23
|
+
ignore;
|
|
24
|
+
aliases;
|
|
24
25
|
/** @internal */
|
|
25
26
|
async __runOptions(ctx, resolver) {
|
|
26
27
|
if (!this?.options?.length) {
|
|
@@ -127,18 +128,20 @@ class BaseCommand {
|
|
|
127
128
|
}
|
|
128
129
|
async reload() {
|
|
129
130
|
delete require.cache[this.__filePath];
|
|
130
|
-
const __tempCommand = await (0, common_1.magicImport)(this.__filePath).then(x => x.default ?? x);
|
|
131
|
-
Object.setPrototypeOf(this, __tempCommand.prototype);
|
|
132
131
|
for (const i of this.options ?? []) {
|
|
133
132
|
if (i instanceof SubCommand && i.__filePath) {
|
|
134
133
|
await i.reload();
|
|
135
134
|
}
|
|
136
135
|
}
|
|
136
|
+
const __tempCommand = await (0, common_1.magicImport)(this.__filePath).then(x => x.default ?? x);
|
|
137
|
+
Object.setPrototypeOf(this, __tempCommand.prototype);
|
|
137
138
|
}
|
|
138
139
|
}
|
|
139
140
|
class Command extends BaseCommand {
|
|
140
141
|
type = v10_1.ApplicationCommandType.ChatInput;
|
|
141
142
|
groups;
|
|
143
|
+
groupsAliases;
|
|
144
|
+
__tGroups;
|
|
142
145
|
toJSON() {
|
|
143
146
|
const options = [];
|
|
144
147
|
for (const i of this.options ?? []) {
|
|
@@ -168,24 +171,6 @@ class Command extends BaseCommand {
|
|
|
168
171
|
options,
|
|
169
172
|
};
|
|
170
173
|
}
|
|
171
|
-
onRunError(context, error) {
|
|
172
|
-
context.client.logger.fatal(`${this.name}.<onRunError>`, context.author.id, error);
|
|
173
|
-
}
|
|
174
|
-
onOptionsError(context, metadata) {
|
|
175
|
-
context.client.logger.fatal(`${this.name}.<onOptionsError>`, context.author.id, metadata);
|
|
176
|
-
}
|
|
177
|
-
onMiddlewaresError(context, error) {
|
|
178
|
-
context.client.logger.fatal(`${this.name}.<onMiddlewaresError>`, context.author.id, error);
|
|
179
|
-
}
|
|
180
|
-
onBotPermissionsFail(context, permissions) {
|
|
181
|
-
context.client.logger.fatal(`${this.name}.<onBotPermissionsFail>`, context.author.id, permissions);
|
|
182
|
-
}
|
|
183
|
-
onPermissionsFail(context, permissions) {
|
|
184
|
-
context.client.logger.fatal(`${this.name}.<onPermissionsFail>`, context.author.id, permissions);
|
|
185
|
-
}
|
|
186
|
-
onInternalError(client, error) {
|
|
187
|
-
client.logger.fatal(`${this.name}.<onInternalError>`, error);
|
|
188
|
-
}
|
|
189
174
|
}
|
|
190
175
|
exports.Command = Command;
|
|
191
176
|
class SubCommand extends BaseCommand {
|
|
@@ -28,7 +28,7 @@ export declare class CommandContext<T extends OptionsRecord = {}, M extends keyo
|
|
|
28
28
|
get fullCommandName(): string;
|
|
29
29
|
write<FR extends boolean = false>(body: InteractionCreateBodyRequest, fetchReply?: FR): Promise<When<FR, WebhookMessage | Message, void | WebhookMessage | Message>>;
|
|
30
30
|
deferReply(ephemeral?: boolean): Promise<void | Message>;
|
|
31
|
-
editResponse(body: InteractionMessageUpdateBodyRequest): Promise<Message>;
|
|
31
|
+
editResponse(body: InteractionMessageUpdateBodyRequest): Promise<Message | WebhookMessage>;
|
|
32
32
|
deleteResponse(): Promise<void>;
|
|
33
33
|
editOrReply<FR extends boolean = false>(body: InteractionCreateBodyRequest | InteractionMessageUpdateBodyRequest, fetchReply?: FR): Promise<When<FR, WebhookMessage | Message, void | WebhookMessage | Message>>;
|
|
34
34
|
fetchResponse(): Promise<If<InferWithPrefix, WebhookMessage | Message | undefined, WebhookMessage | undefined>>;
|
|
@@ -23,7 +23,7 @@ export declare class MenuCommandContext<T extends MessageCommandInteraction | Us
|
|
|
23
23
|
write<FR extends boolean = false>(body: InteractionCreateBodyRequest, fetchReply?: FR): Promise<When<FR, WebhookMessage, void | WebhookMessage>>;
|
|
24
24
|
modal(body: ModalCreateBodyRequest): Promise<void>;
|
|
25
25
|
deferReply(ephemeral?: boolean): Promise<void>;
|
|
26
|
-
editResponse(body: InteractionMessageUpdateBodyRequest): Promise<
|
|
26
|
+
editResponse(body: InteractionMessageUpdateBodyRequest): Promise<WebhookMessage>;
|
|
27
27
|
deleteResponse(): Promise<void | undefined>;
|
|
28
28
|
editOrReply<FR extends boolean = false>(body: InteractionCreateBodyRequest | InteractionMessageUpdateBodyRequest, fetchReply?: FR): Promise<When<FR, WebhookMessage | Message, void | WebhookMessage | Message>>;
|
|
29
29
|
fetchResponse(): Promise<WebhookMessage | undefined>;
|
|
@@ -1,2 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IgnoreCommand = void 0;
|
|
4
|
+
var IgnoreCommand;
|
|
5
|
+
(function (IgnoreCommand) {
|
|
6
|
+
IgnoreCommand[IgnoreCommand["Slash"] = 0] = "Slash";
|
|
7
|
+
IgnoreCommand[IgnoreCommand["Message"] = 1] = "Message";
|
|
8
|
+
})(IgnoreCommand || (exports.IgnoreCommand = IgnoreCommand = {}));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ApplicationCommandType, type LocaleString } from 'discord-api-types/v10';
|
|
2
2
|
import type { FlatObjectKeys, PermissionStrings } from '../common';
|
|
3
3
|
import type { CommandOption, OptionsRecord, SubCommand } from './applications/chat';
|
|
4
|
-
import type { DefaultLocale, MiddlewareContext } from './applications/shared';
|
|
4
|
+
import type { DefaultLocale, IgnoreCommand, MiddlewareContext } from './applications/shared';
|
|
5
5
|
export interface RegisteredMiddlewares {
|
|
6
6
|
}
|
|
7
7
|
export declare enum IntegrationTypes {
|
|
@@ -22,6 +22,8 @@ type DeclareOptions = {
|
|
|
22
22
|
nsfw?: boolean;
|
|
23
23
|
integrationTypes?: (keyof typeof IntegrationTypes)[];
|
|
24
24
|
contexts?: (keyof typeof InteractionContextTypes)[];
|
|
25
|
+
ignore?: IgnoreCommand;
|
|
26
|
+
aliases?: string[];
|
|
25
27
|
} | (Omit<{
|
|
26
28
|
name: string;
|
|
27
29
|
description: string;
|
|
@@ -59,26 +61,32 @@ export declare function GroupsT(groups: Record<string, {
|
|
|
59
61
|
name?: FlatObjectKeys<DefaultLocale>;
|
|
60
62
|
description?: FlatObjectKeys<DefaultLocale>;
|
|
61
63
|
defaultDescription: string;
|
|
64
|
+
aliases?: string[];
|
|
62
65
|
}>): <T extends new (...args: any[]) => {}>(target: T) => {
|
|
63
66
|
new (...args: any[]): {
|
|
64
67
|
__tGroups: Record<string, {
|
|
65
68
|
name?: undefined;
|
|
66
69
|
description?: undefined;
|
|
67
70
|
defaultDescription: string;
|
|
71
|
+
aliases?: string[] | undefined;
|
|
68
72
|
}>;
|
|
73
|
+
groupsAliases: Record<string, string>;
|
|
69
74
|
};
|
|
70
75
|
} & T;
|
|
71
76
|
export declare function Groups(groups: Record<string, {
|
|
72
77
|
name?: [language: LocaleString, value: string][];
|
|
73
78
|
description?: [language: LocaleString, value: string][];
|
|
74
79
|
defaultDescription: string;
|
|
80
|
+
aliases?: string[];
|
|
75
81
|
}>): <T extends new (...args: any[]) => {}>(target: T) => {
|
|
76
82
|
new (...args: any[]): {
|
|
77
83
|
groups: Record<string, {
|
|
78
84
|
name?: [language: "id" | "en-US" | "en-GB" | "bg" | "zh-CN" | "zh-TW" | "hr" | "cs" | "da" | "nl" | "fi" | "fr" | "de" | "el" | "hi" | "hu" | "it" | "ja" | "ko" | "lt" | "no" | "pl" | "pt-BR" | "ro" | "ru" | "es-ES" | "es-419" | "sv-SE" | "th" | "tr" | "uk" | "vi", value: string][] | undefined;
|
|
79
85
|
description?: [language: "id" | "en-US" | "en-GB" | "bg" | "zh-CN" | "zh-TW" | "hr" | "cs" | "da" | "nl" | "fi" | "fr" | "de" | "el" | "hi" | "hu" | "it" | "ja" | "ko" | "lt" | "no" | "pl" | "pt-BR" | "ro" | "ru" | "es-ES" | "es-419" | "sv-SE" | "th" | "tr" | "uk" | "vi", value: string][] | undefined;
|
|
80
86
|
defaultDescription: string;
|
|
87
|
+
aliases?: string[] | undefined;
|
|
81
88
|
}>;
|
|
89
|
+
groupsAliases: Record<string, string>;
|
|
82
90
|
};
|
|
83
91
|
} & T;
|
|
84
92
|
export declare function Group(groupName: string): <T extends new (...args: any[]) => {}>(target: T) => {
|
|
@@ -115,6 +123,8 @@ export declare function Declare(declare: DeclareOptions): <T extends new (...arg
|
|
|
115
123
|
description: string;
|
|
116
124
|
type: ApplicationCommandType;
|
|
117
125
|
guildId?: string[] | undefined;
|
|
126
|
+
ignore?: IgnoreCommand | undefined;
|
|
127
|
+
aliases?: string[] | undefined;
|
|
118
128
|
};
|
|
119
129
|
} & T;
|
|
120
130
|
export {};
|
|
@@ -29,12 +29,30 @@ exports.LocalesT = LocalesT;
|
|
|
29
29
|
function GroupsT(groups) {
|
|
30
30
|
return (target) => class extends target {
|
|
31
31
|
__tGroups = groups;
|
|
32
|
+
groupsAliases = {};
|
|
33
|
+
constructor(...args) {
|
|
34
|
+
super(...args);
|
|
35
|
+
for (const i in groups) {
|
|
36
|
+
for (const j of groups[i].aliases ?? []) {
|
|
37
|
+
this.groupsAliases[j] = i;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
32
41
|
};
|
|
33
42
|
}
|
|
34
43
|
exports.GroupsT = GroupsT;
|
|
35
44
|
function Groups(groups) {
|
|
36
45
|
return (target) => class extends target {
|
|
37
46
|
groups = groups;
|
|
47
|
+
groupsAliases = {};
|
|
48
|
+
constructor(...args) {
|
|
49
|
+
super(...args);
|
|
50
|
+
for (const i in groups) {
|
|
51
|
+
for (const j of groups[i].aliases ?? []) {
|
|
52
|
+
this.groupsAliases[j] = i;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
38
56
|
};
|
|
39
57
|
}
|
|
40
58
|
exports.Groups = Groups;
|
|
@@ -84,6 +102,8 @@ function Declare(declare) {
|
|
|
84
102
|
description = '';
|
|
85
103
|
type = v10_1.ApplicationCommandType.ChatInput;
|
|
86
104
|
guildId;
|
|
105
|
+
ignore;
|
|
106
|
+
aliases;
|
|
87
107
|
constructor(...args) {
|
|
88
108
|
super(...args);
|
|
89
109
|
if ('description' in declare)
|
|
@@ -92,6 +112,10 @@ function Declare(declare) {
|
|
|
92
112
|
this.type = declare.type;
|
|
93
113
|
if ('guildId' in declare)
|
|
94
114
|
this.guildId = declare.guildId;
|
|
115
|
+
if ('ignore' in declare)
|
|
116
|
+
this.ignore = declare.ignore;
|
|
117
|
+
if ('aliases' in declare)
|
|
118
|
+
this.aliases = declare.aliases;
|
|
95
119
|
// check if all properties are valid
|
|
96
120
|
}
|
|
97
121
|
};
|
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
import type { Logger } from '../common';
|
|
2
2
|
import { BaseHandler } from '../common';
|
|
3
|
-
import { Command } from './applications/chat';
|
|
3
|
+
import { Command, SubCommand } from './applications/chat';
|
|
4
4
|
import { ContextMenuCommand } from './applications/menu';
|
|
5
5
|
import type { UsingClient } from './applications/shared';
|
|
6
|
-
export interface CommandHandlerLike {
|
|
7
|
-
values: CommandHandler['values'];
|
|
8
|
-
load: CommandHandler['load'];
|
|
9
|
-
reload: CommandHandler['reload'];
|
|
10
|
-
reloadAll: CommandHandler['reloadAll'];
|
|
11
|
-
}
|
|
12
6
|
export declare class CommandHandler extends BaseHandler {
|
|
13
7
|
protected logger: Logger;
|
|
14
8
|
protected client: UsingClient;
|
|
@@ -19,4 +13,14 @@ export declare class CommandHandler extends BaseHandler {
|
|
|
19
13
|
reloadAll(stopIfFail?: boolean): Promise<void>;
|
|
20
14
|
load(commandsDir: string, client: UsingClient): Promise<(Command | ContextMenuCommand)[]>;
|
|
21
15
|
private __parseCommandLocales;
|
|
16
|
+
setHandlers({ onCommand, onSubCommand, }: {
|
|
17
|
+
onCommand?: CommandHandler['onCommand'];
|
|
18
|
+
onSubCommand?: CommandHandler['onSubCommand'];
|
|
19
|
+
}): void;
|
|
20
|
+
onCommand: (file: {
|
|
21
|
+
new (): Command | SubCommand | ContextMenuCommand;
|
|
22
|
+
}) => Command | SubCommand | ContextMenuCommand | false;
|
|
23
|
+
onSubCommand: (file: {
|
|
24
|
+
new (): SubCommand;
|
|
25
|
+
}) => SubCommand | false;
|
|
22
26
|
}
|
package/lib/commands/handler.js
CHANGED
|
@@ -40,8 +40,9 @@ class CommandHandler extends common_1.BaseHandler {
|
|
|
40
40
|
for (const command of result) {
|
|
41
41
|
let commandInstance;
|
|
42
42
|
try {
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
commandInstance = this.onCommand(command.file);
|
|
44
|
+
if (!commandInstance)
|
|
45
|
+
continue;
|
|
45
46
|
}
|
|
46
47
|
catch (e) {
|
|
47
48
|
if (e instanceof Error && e.message === 'command.file is not a constructor') {
|
|
@@ -57,12 +58,18 @@ class CommandHandler extends common_1.BaseHandler {
|
|
|
57
58
|
if (commandInstance instanceof menu_1.ContextMenuCommand) {
|
|
58
59
|
this.values.push(commandInstance);
|
|
59
60
|
commandInstance.__filePath = command.path;
|
|
60
|
-
await this.__callback?.(commandInstance);
|
|
61
61
|
continue;
|
|
62
62
|
}
|
|
63
63
|
if (!(commandInstance instanceof chat_1.Command)) {
|
|
64
64
|
continue;
|
|
65
65
|
}
|
|
66
|
+
commandInstance.onAfterRun ??= client.options?.commands?.defaults?.onAfterRun;
|
|
67
|
+
commandInstance.onBotPermissionsFail ??= client.options?.commands?.defaults?.onBotPermissionsFail;
|
|
68
|
+
commandInstance.onInternalError ??= client.options?.commands?.defaults?.onInternalError;
|
|
69
|
+
commandInstance.onMiddlewaresError ??= client.options?.commands?.defaults?.onMiddlewaresError;
|
|
70
|
+
commandInstance.onOptionsError ??= client.options?.commands?.defaults?.onOptionsError;
|
|
71
|
+
commandInstance.onPermissionsFail ??= client.options?.commands?.defaults?.onPermissionsFail;
|
|
72
|
+
commandInstance.onRunError ??= client.options?.commands?.defaults?.onRunError;
|
|
66
73
|
commandInstance.__filePath = command.path;
|
|
67
74
|
commandInstance.options ??= [];
|
|
68
75
|
if (commandInstance.__autoload) {
|
|
@@ -73,9 +80,8 @@ class CommandHandler extends common_1.BaseHandler {
|
|
|
73
80
|
continue;
|
|
74
81
|
}
|
|
75
82
|
try {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
if (subCommand instanceof chat_1.SubCommand) {
|
|
83
|
+
const subCommand = this.onSubCommand(result.find(x => x.path === option).file);
|
|
84
|
+
if (subCommand && subCommand instanceof chat_1.SubCommand) {
|
|
79
85
|
subCommand.__filePath = option;
|
|
80
86
|
commandInstance.options.push(subCommand);
|
|
81
87
|
}
|
|
@@ -89,17 +95,33 @@ class CommandHandler extends common_1.BaseHandler {
|
|
|
89
95
|
if (option instanceof chat_1.SubCommand) {
|
|
90
96
|
option.middlewares = (commandInstance.middlewares ?? []).concat(option.middlewares ?? []);
|
|
91
97
|
option.onMiddlewaresError =
|
|
92
|
-
option.onMiddlewaresError?.bind(option) ??
|
|
93
|
-
|
|
98
|
+
option.onMiddlewaresError?.bind(option) ??
|
|
99
|
+
commandInstance.onMiddlewaresError?.bind(commandInstance) ??
|
|
100
|
+
this.client.options?.commands?.defaults?.onMiddlewaresError;
|
|
101
|
+
option.onRunError =
|
|
102
|
+
option.onRunError?.bind(option) ??
|
|
103
|
+
commandInstance.onRunError?.bind(commandInstance) ??
|
|
104
|
+
this.client.options?.commands?.defaults?.onRunError;
|
|
94
105
|
option.onOptionsError =
|
|
95
|
-
option.onOptionsError?.bind(option) ??
|
|
106
|
+
option.onOptionsError?.bind(option) ??
|
|
107
|
+
commandInstance.onOptionsError?.bind(commandInstance) ??
|
|
108
|
+
this.client.options?.commands?.defaults?.onOptionsError;
|
|
96
109
|
option.onInternalError =
|
|
97
|
-
option.onInternalError?.bind(option) ??
|
|
98
|
-
|
|
110
|
+
option.onInternalError?.bind(option) ??
|
|
111
|
+
commandInstance.onInternalError?.bind(commandInstance) ??
|
|
112
|
+
this.client.options?.commands?.defaults?.onInternalError;
|
|
113
|
+
option.onAfterRun =
|
|
114
|
+
option.onAfterRun?.bind(option) ??
|
|
115
|
+
commandInstance.onAfterRun?.bind(commandInstance) ??
|
|
116
|
+
this.client.options?.commands?.defaults?.onAfterRun;
|
|
99
117
|
option.onBotPermissionsFail =
|
|
100
|
-
option.onBotPermissionsFail?.bind(option) ??
|
|
118
|
+
option.onBotPermissionsFail?.bind(option) ??
|
|
119
|
+
commandInstance.onBotPermissionsFail?.bind(commandInstance) ??
|
|
120
|
+
this.client.options?.commands?.defaults?.onBotPermissionsFail;
|
|
101
121
|
option.onPermissionsFail =
|
|
102
|
-
option.onPermissionsFail?.bind(option) ??
|
|
122
|
+
option.onPermissionsFail?.bind(option) ??
|
|
123
|
+
commandInstance.onPermissionsFail?.bind(commandInstance) ??
|
|
124
|
+
this.client.options?.commands?.defaults?.onPermissionsFail;
|
|
103
125
|
}
|
|
104
126
|
}
|
|
105
127
|
this.values.push(commandInstance);
|
|
@@ -109,7 +131,6 @@ class CommandHandler extends common_1.BaseHandler {
|
|
|
109
131
|
this.__parseCommandLocales(i, client);
|
|
110
132
|
}
|
|
111
133
|
}
|
|
112
|
-
await this.__callback?.(commandInstance);
|
|
113
134
|
}
|
|
114
135
|
return this.values;
|
|
115
136
|
}
|
|
@@ -194,5 +215,13 @@ class CommandHandler extends common_1.BaseHandler {
|
|
|
194
215
|
}
|
|
195
216
|
}
|
|
196
217
|
}
|
|
218
|
+
setHandlers({ onCommand, onSubCommand, }) {
|
|
219
|
+
if (onCommand)
|
|
220
|
+
this.onCommand = onCommand;
|
|
221
|
+
if (onSubCommand)
|
|
222
|
+
this.onSubCommand = onSubCommand;
|
|
223
|
+
}
|
|
224
|
+
onCommand = (file) => new file();
|
|
225
|
+
onSubCommand = (file) => new file();
|
|
197
226
|
}
|
|
198
227
|
exports.CommandHandler = CommandHandler;
|
package/lib/common/index.d.ts
CHANGED
|
@@ -11,7 +11,9 @@ export * from './shorters/reactions';
|
|
|
11
11
|
export * from './shorters/roles';
|
|
12
12
|
export * from './shorters/templates';
|
|
13
13
|
export * from './shorters/users';
|
|
14
|
+
export * from './shorters/threads';
|
|
14
15
|
export * from './shorters/webhook';
|
|
16
|
+
export * from './shorters/interaction';
|
|
15
17
|
export * from './types/options';
|
|
16
18
|
export * from './types/resolvables';
|
|
17
19
|
export * from './types/util';
|
package/lib/common/index.js
CHANGED
|
@@ -28,7 +28,9 @@ __exportStar(require("./shorters/reactions"), exports);
|
|
|
28
28
|
__exportStar(require("./shorters/roles"), exports);
|
|
29
29
|
__exportStar(require("./shorters/templates"), exports);
|
|
30
30
|
__exportStar(require("./shorters/users"), exports);
|
|
31
|
+
__exportStar(require("./shorters/threads"), exports);
|
|
31
32
|
__exportStar(require("./shorters/webhook"), exports);
|
|
33
|
+
__exportStar(require("./shorters/interaction"), exports);
|
|
32
34
|
__exportStar(require("./types/options"), exports);
|
|
33
35
|
__exportStar(require("./types/resolvables"), exports);
|
|
34
36
|
__exportStar(require("./types/util"), exports);
|
package/lib/common/it/utils.d.ts
CHANGED
|
@@ -40,7 +40,6 @@ export declare function filterSplit<Element, Predicate extends (value: Element)
|
|
|
40
40
|
*/
|
|
41
41
|
export declare class BaseHandler {
|
|
42
42
|
protected logger: Logger;
|
|
43
|
-
__callback?: (...args: any[]) => any;
|
|
44
43
|
/**
|
|
45
44
|
* Initializes a new instance of the BaseHandler class.
|
|
46
45
|
* @param logger The logger instance.
|
package/lib/common/it/utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { type RESTPatchAPIChannelJSONBody, type RESTPostAPIChannelThreadsJSONBody, type RESTPostAPIGuildForumThreadsJSONBody } from 'discord-api-types/v10';
|
|
1
|
+
import { type RESTGetAPIChannelMessagesQuery, type RESTPatchAPIChannelJSONBody, type RESTPostAPIChannelThreadsJSONBody, type RESTPostAPIGuildForumThreadsJSONBody } from 'discord-api-types/v10';
|
|
2
2
|
import { Message, type GuildMember, type GuildRole } from '../../structures';
|
|
3
|
-
import { type AllChannels
|
|
3
|
+
import { type AllChannels } from '../../structures/channels';
|
|
4
4
|
import { PermissionsBitField } from '../../structures/extra/Permissions';
|
|
5
5
|
import { BaseShorter } from './base';
|
|
6
6
|
export declare class ChannelShorter extends BaseShorter {
|
|
@@ -55,7 +55,7 @@ export declare class ChannelShorter extends BaseShorter {
|
|
|
55
55
|
* @param reason The reason for unpinning the message.
|
|
56
56
|
* @returns A promise that resolves when the thread is succesfully created.
|
|
57
57
|
*/
|
|
58
|
-
thread(channelId: string, body: RESTPostAPIChannelThreadsJSONBody | RESTPostAPIGuildForumThreadsJSONBody, reason?: string): Promise<ThreadChannel>;
|
|
58
|
+
thread(channelId: string, body: RESTPostAPIChannelThreadsJSONBody | RESTPostAPIGuildForumThreadsJSONBody, reason?: string): Promise<import("../../structures").ThreadChannel>;
|
|
59
59
|
memberPermissions(channelId: string, member: GuildMember, checkAdmin?: boolean): Promise<PermissionsBitField>;
|
|
60
60
|
overwritesFor(channelId: string, member: GuildMember): Promise<{
|
|
61
61
|
everyone: {
|
|
@@ -63,21 +63,26 @@ export declare class ChannelShorter extends BaseShorter {
|
|
|
63
63
|
id: string;
|
|
64
64
|
deny: PermissionsBitField;
|
|
65
65
|
allow: PermissionsBitField;
|
|
66
|
+
guildId: string;
|
|
66
67
|
} | undefined;
|
|
67
68
|
roles: {
|
|
68
69
|
type: number;
|
|
69
70
|
id: string;
|
|
70
71
|
deny: PermissionsBitField;
|
|
71
72
|
allow: PermissionsBitField;
|
|
73
|
+
guildId: string;
|
|
72
74
|
}[];
|
|
73
75
|
member: {
|
|
74
76
|
type: number;
|
|
75
77
|
id: string;
|
|
76
78
|
deny: PermissionsBitField;
|
|
77
79
|
allow: PermissionsBitField;
|
|
80
|
+
guildId: string;
|
|
78
81
|
} | undefined;
|
|
79
82
|
}>;
|
|
80
83
|
rolePermissions(channelId: string, role: GuildRole, checkAdmin?: boolean): Promise<PermissionsBitField>;
|
|
84
|
+
fetchMessages(channelId: string, query?: RESTGetAPIChannelMessagesQuery): Promise<Message[]>;
|
|
85
|
+
setVoiceStatus(channelId: string, status?: string | null): Promise<never>;
|
|
81
86
|
}
|
|
82
87
|
export type ChannelShorterOptionalParams = Partial<{
|
|
83
88
|
guildId: string;
|
|
@@ -9,6 +9,7 @@ const structures_1 = require("../../structures");
|
|
|
9
9
|
const channels_1 = __importDefault(require("../../structures/channels"));
|
|
10
10
|
const Permissions_1 = require("../../structures/extra/Permissions");
|
|
11
11
|
const base_1 = require("./base");
|
|
12
|
+
const utils_1 = require("../it/utils");
|
|
12
13
|
class ChannelShorter extends base_1.BaseShorter {
|
|
13
14
|
/**
|
|
14
15
|
* Fetches a channel by its ID.
|
|
@@ -34,8 +35,9 @@ class ChannelShorter extends base_1.BaseShorter {
|
|
|
34
35
|
* @returns A Promise that resolves to the deleted channel.
|
|
35
36
|
*/
|
|
36
37
|
async delete(id, optional = { guildId: '@me' }) {
|
|
37
|
-
const
|
|
38
|
-
await this.client.
|
|
38
|
+
const options = (0, utils_1.MergeOptions)({ guildId: '@me' }, optional);
|
|
39
|
+
const res = await this.client.proxy.channels(id).delete({ reason: options.reason });
|
|
40
|
+
await this.client.cache.channels?.removeIfNI(structures_1.BaseChannel.__intent__(options.guildId), res.id, options.guildId);
|
|
39
41
|
return (0, channels_1.default)(res, this.client);
|
|
40
42
|
}
|
|
41
43
|
/**
|
|
@@ -46,10 +48,11 @@ class ChannelShorter extends base_1.BaseShorter {
|
|
|
46
48
|
* @returns A Promise that resolves to the edited channel.
|
|
47
49
|
*/
|
|
48
50
|
async edit(id, body, optional = { guildId: '@me' }) {
|
|
49
|
-
const
|
|
50
|
-
await this.client.
|
|
51
|
+
const options = (0, utils_1.MergeOptions)({ guildId: '@me' }, optional);
|
|
52
|
+
const res = await this.client.proxy.channels(id).patch({ body, reason: options.reason });
|
|
53
|
+
await this.client.cache.channels?.setIfNI(structures_1.BaseChannel.__intent__(options.guildId), res.id, options.guildId, res);
|
|
51
54
|
if (body.permission_overwrites && 'permission_overwrites' in res)
|
|
52
|
-
await this.client.cache.overwrites?.setIfNI(structures_1.BaseChannel.__intent__(
|
|
55
|
+
await this.client.cache.overwrites?.setIfNI(structures_1.BaseChannel.__intent__(options.guildId), res.id, options.guildId, res.permission_overwrites);
|
|
53
56
|
return (0, channels_1.default)(res, this.client);
|
|
54
57
|
}
|
|
55
58
|
/**
|
|
@@ -62,6 +65,9 @@ class ChannelShorter extends base_1.BaseShorter {
|
|
|
62
65
|
}
|
|
63
66
|
async pins(channelId) {
|
|
64
67
|
const messages = await this.client.proxy.channels(channelId).pins.get();
|
|
68
|
+
await this.client.cache.messages?.patch(messages.map(x => {
|
|
69
|
+
return [x.id, x];
|
|
70
|
+
}), channelId);
|
|
65
71
|
return messages.map(message => new structures_1.Message(this.client, message));
|
|
66
72
|
}
|
|
67
73
|
/**
|
|
@@ -91,18 +97,15 @@ class ChannelShorter extends base_1.BaseShorter {
|
|
|
91
97
|
* @returns A promise that resolves when the thread is succesfully created.
|
|
92
98
|
*/
|
|
93
99
|
async thread(channelId, body, reason) {
|
|
94
|
-
return
|
|
95
|
-
.channels(channelId)
|
|
96
|
-
.threads.post({ body, reason })
|
|
97
|
-
// When testing this, discord returns the thread object, but in discord api types it does not.
|
|
98
|
-
.then(thread => (0, channels_1.default)(thread, this.client)));
|
|
100
|
+
return this.client.threads.create(channelId, body, reason);
|
|
99
101
|
}
|
|
100
102
|
async memberPermissions(channelId, member, checkAdmin = true) {
|
|
101
|
-
const
|
|
102
|
-
if (checkAdmin &&
|
|
103
|
+
const memberPermissions = await member.fetchPermissions();
|
|
104
|
+
if (checkAdmin && memberPermissions.has(v10_1.PermissionFlagsBits.Administrator)) {
|
|
103
105
|
return new Permissions_1.PermissionsBitField(Permissions_1.PermissionsBitField.All);
|
|
104
106
|
}
|
|
105
107
|
const overwrites = await this.overwritesFor(channelId, member);
|
|
108
|
+
const permissions = new Permissions_1.PermissionsBitField(memberPermissions.bits);
|
|
106
109
|
permissions.remove(overwrites.everyone?.deny.bits ?? 0n);
|
|
107
110
|
permissions.add(overwrites.everyone?.allow.bits ?? 0n);
|
|
108
111
|
permissions.remove(overwrites.roles.length > 0 ? overwrites.roles.map(role => role.deny.bits) : 0n);
|
|
@@ -147,5 +150,17 @@ class ChannelShorter extends base_1.BaseShorter {
|
|
|
147
150
|
permissions.add(roleOverwrites?.allow.bits ?? 0n);
|
|
148
151
|
return permissions;
|
|
149
152
|
}
|
|
153
|
+
async fetchMessages(channelId, query) {
|
|
154
|
+
const result = await this.client.proxy.channels(channelId).messages.get({
|
|
155
|
+
query,
|
|
156
|
+
});
|
|
157
|
+
await this.client.cache.messages?.patch(result.map(x => {
|
|
158
|
+
return [x.id, x];
|
|
159
|
+
}), channelId);
|
|
160
|
+
return result.map(message => new structures_1.Message(this.client, message));
|
|
161
|
+
}
|
|
162
|
+
setVoiceStatus(channelId, status = null) {
|
|
163
|
+
return this.client.proxy.channels(channelId)['voice-status'].put({ body: { status } });
|
|
164
|
+
}
|
|
150
165
|
}
|
|
151
166
|
exports.ChannelShorter = ChannelShorter;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { GuildWidgetStyle, RESTGetAPICurrentUserGuildsQuery, RESTPatchAPIAutoModerationRuleJSONBody, RESTPatchAPIChannelJSONBody, RESTPatchAPIGuildChannelPositionsJSONBody, RESTPatchAPIGuildStickerJSONBody, RESTPostAPIAutoModerationRuleJSONBody, RESTPostAPIGuildChannelJSONBody, RESTPostAPIGuildsJSONBody } from 'discord-api-types/v10';
|
|
2
2
|
import type { ObjectToLower } from '..';
|
|
3
|
-
import { AnonymousGuild, Guild, GuildMember, Sticker, type CreateStickerBodyRequest } from '../../structures';
|
|
3
|
+
import { AnonymousGuild, AutoModerationRule, Guild, GuildMember, Sticker, type CreateStickerBodyRequest } from '../../structures';
|
|
4
4
|
import { BaseShorter } from './base';
|
|
5
5
|
export declare class GuildShorter extends BaseShorter {
|
|
6
6
|
/**
|
|
@@ -75,6 +75,7 @@ export declare class GuildShorter extends BaseShorter {
|
|
|
75
75
|
* @param body The data containing the new positions of channels.
|
|
76
76
|
*/
|
|
77
77
|
editPositions: (guildId: string, body: RESTPatchAPIGuildChannelPositionsJSONBody) => Promise<never>;
|
|
78
|
+
addFollower: (channelId: string, webhook_channel_id: string, reason?: string) => Promise<import("discord-api-types/v10").APIFollowedChannel>;
|
|
78
79
|
};
|
|
79
80
|
/**
|
|
80
81
|
* Provides access to auto-moderation rule-related functionality in a guild.
|
|
@@ -85,14 +86,14 @@ export declare class GuildShorter extends BaseShorter {
|
|
|
85
86
|
* @param guildId The ID of the guild.
|
|
86
87
|
* @returns A Promise that resolves to an array of auto-moderation rules.
|
|
87
88
|
*/
|
|
88
|
-
list: (guildId: string) => Promise<
|
|
89
|
+
list: (guildId: string) => Promise<AutoModerationRule[]>;
|
|
89
90
|
/**
|
|
90
91
|
* Creates a new auto-moderation rule in the guild.
|
|
91
92
|
* @param guildId The ID of the guild.
|
|
92
93
|
* @param body The data for creating the auto-moderation rule.
|
|
93
94
|
* @returns A Promise that resolves to the created auto-moderation rule.
|
|
94
95
|
*/
|
|
95
|
-
create: (guildId: string, body: RESTPostAPIAutoModerationRuleJSONBody) => Promise<
|
|
96
|
+
create: (guildId: string, body: RESTPostAPIAutoModerationRuleJSONBody) => Promise<AutoModerationRule>;
|
|
96
97
|
/**
|
|
97
98
|
* Deletes an auto-moderation rule from the guild.
|
|
98
99
|
* @param guildId The ID of the guild.
|
|
@@ -107,7 +108,7 @@ export declare class GuildShorter extends BaseShorter {
|
|
|
107
108
|
* @param ruleId The ID of the rule to fetch.
|
|
108
109
|
* @returns A Promise that resolves to the fetched auto-moderation rule.
|
|
109
110
|
*/
|
|
110
|
-
fetch: (guildId: string, ruleId: string) => Promise<
|
|
111
|
+
fetch: (guildId: string, ruleId: string) => Promise<AutoModerationRule>;
|
|
111
112
|
/**
|
|
112
113
|
* Edits an auto-moderation rule in the guild.
|
|
113
114
|
* @param guildId The ID of the guild.
|
|
@@ -116,7 +117,7 @@ export declare class GuildShorter extends BaseShorter {
|
|
|
116
117
|
* @param reason The reason for editing the rule.
|
|
117
118
|
* @returns A Promise that resolves to the edited auto-moderation rule.
|
|
118
119
|
*/
|
|
119
|
-
edit: (guildId: string, ruleId: string, body: ObjectToLower<RESTPatchAPIAutoModerationRuleJSONBody>, reason?: string) => Promise<
|
|
120
|
+
edit: (guildId: string, ruleId: string, body: ObjectToLower<RESTPatchAPIAutoModerationRuleJSONBody>, reason?: string) => Promise<AutoModerationRule>;
|
|
120
121
|
};
|
|
121
122
|
/**
|
|
122
123
|
* Provides access to sticker-related functionality in a guild.
|
|
@@ -154,6 +154,14 @@ class GuildShorter extends base_1.BaseShorter {
|
|
|
154
154
|
* @param body The data containing the new positions of channels.
|
|
155
155
|
*/
|
|
156
156
|
editPositions: (guildId, body) => this.client.proxy.guilds(guildId).channels.patch({ body }),
|
|
157
|
+
addFollower: async (channelId, webhook_channel_id, reason) => {
|
|
158
|
+
return this.client.proxy.channels(channelId).followers.post({
|
|
159
|
+
body: {
|
|
160
|
+
webhook_channel_id,
|
|
161
|
+
},
|
|
162
|
+
reason,
|
|
163
|
+
});
|
|
164
|
+
},
|
|
157
165
|
};
|
|
158
166
|
}
|
|
159
167
|
/**
|
|
@@ -166,14 +174,18 @@ class GuildShorter extends base_1.BaseShorter {
|
|
|
166
174
|
* @param guildId The ID of the guild.
|
|
167
175
|
* @returns A Promise that resolves to an array of auto-moderation rules.
|
|
168
176
|
*/
|
|
169
|
-
list: (guildId) => this.client.proxy
|
|
177
|
+
list: (guildId) => this.client.proxy
|
|
178
|
+
.guilds(guildId)['auto-moderation'].rules.get()
|
|
179
|
+
.then(rules => rules.map(rule => new structures_1.AutoModerationRule(this.client, rule))),
|
|
170
180
|
/**
|
|
171
181
|
* Creates a new auto-moderation rule in the guild.
|
|
172
182
|
* @param guildId The ID of the guild.
|
|
173
183
|
* @param body The data for creating the auto-moderation rule.
|
|
174
184
|
* @returns A Promise that resolves to the created auto-moderation rule.
|
|
175
185
|
*/
|
|
176
|
-
create: (guildId, body) => this.client.proxy
|
|
186
|
+
create: (guildId, body) => this.client.proxy
|
|
187
|
+
.guilds(guildId)['auto-moderation'].rules.post({ body })
|
|
188
|
+
.then(rule => new structures_1.AutoModerationRule(this.client, rule)),
|
|
177
189
|
/**
|
|
178
190
|
* Deletes an auto-moderation rule from the guild.
|
|
179
191
|
* @param guildId The ID of the guild.
|
|
@@ -191,7 +203,10 @@ class GuildShorter extends base_1.BaseShorter {
|
|
|
191
203
|
* @returns A Promise that resolves to the fetched auto-moderation rule.
|
|
192
204
|
*/
|
|
193
205
|
fetch: (guildId, ruleId) => {
|
|
194
|
-
return this.client.proxy
|
|
206
|
+
return this.client.proxy
|
|
207
|
+
.guilds(guildId)['auto-moderation'].rules(ruleId)
|
|
208
|
+
.get()
|
|
209
|
+
.then(rule => new structures_1.AutoModerationRule(this.client, rule));
|
|
195
210
|
},
|
|
196
211
|
/**
|
|
197
212
|
* Edits an auto-moderation rule in the guild.
|
|
@@ -202,7 +217,10 @@ class GuildShorter extends base_1.BaseShorter {
|
|
|
202
217
|
* @returns A Promise that resolves to the edited auto-moderation rule.
|
|
203
218
|
*/
|
|
204
219
|
edit: (guildId, ruleId, body, reason) => {
|
|
205
|
-
return this.client.proxy
|
|
220
|
+
return this.client.proxy
|
|
221
|
+
.guilds(guildId)['auto-moderation'].rules(ruleId)
|
|
222
|
+
.patch({ body, reason })
|
|
223
|
+
.then(rule => new structures_1.AutoModerationRule(this.client, rule));
|
|
206
224
|
},
|
|
207
225
|
};
|
|
208
226
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { WebhookMessage, type ReplyInteractionBody } from '../..';
|
|
2
|
+
import type { InteractionMessageUpdateBodyRequest, MessageWebhookCreateBodyRequest } from '../types/write';
|
|
3
|
+
import { BaseShorter } from './base';
|
|
4
|
+
export declare class InteractionShorter extends BaseShorter {
|
|
5
|
+
reply(id: string, token: string, body: ReplyInteractionBody): Promise<never>;
|
|
6
|
+
fetchResponse(token: string, messageId: string): Promise<WebhookMessage | undefined>;
|
|
7
|
+
fetchOriginal(token: string): Promise<WebhookMessage | undefined>;
|
|
8
|
+
editMessage(token: string, messageId: string, body: InteractionMessageUpdateBodyRequest): Promise<WebhookMessage>;
|
|
9
|
+
editOriginal(token: string, body: InteractionMessageUpdateBodyRequest): Promise<WebhookMessage>;
|
|
10
|
+
deleteResponse(interactionId: string, token: string, messageId: string): Promise<void | undefined>;
|
|
11
|
+
deleteOriginal(interactionId: string, token: string): Promise<void | undefined>;
|
|
12
|
+
followup(token: string, { files, ...body }: MessageWebhookCreateBodyRequest): Promise<WebhookMessage>;
|
|
13
|
+
}
|