seyfert 1.2.3 → 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/lib/api/Routes/channels.d.ts +15 -1
- package/lib/api/utils/utils.d.ts +1 -1
- package/lib/api/utils/utils.js +2 -2
- 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/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/index.d.ts +5 -2
- package/lib/cache/index.js +38 -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 +2 -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 +25 -13
- package/lib/client/base.js +33 -8
- 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 +2 -2
- package/lib/client/workerclient.d.ts +3 -3
- package/lib/client/workerclient.js +18 -3
- package/lib/collection.d.ts +8 -3
- package/lib/collection.js +22 -4
- package/lib/commands/applications/chat.d.ts +8 -14
- package/lib/commands/applications/chat.js +2 -20
- package/lib/commands/applications/chatcontext.d.ts +1 -1
- package/lib/commands/applications/menucontext.d.ts +1 -1
- 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 +5 -3
- package/lib/common/shorters/channels.js +24 -10
- 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/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/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.js +2 -2
- package/lib/structures/Webhook.d.ts +2 -2
- package/lib/structures/channels.d.ts +6 -3
- package/lib/structures/channels.js +16 -8
- 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/package.json +8 -8
|
@@ -46,7 +46,7 @@ export declare class ComponentContext<Type extends keyof ComponentCommandInterac
|
|
|
46
46
|
* Edits the response of the interaction.
|
|
47
47
|
* @param body - The updated body of the response.
|
|
48
48
|
*/
|
|
49
|
-
editResponse(body: InteractionMessageUpdateBodyRequest): Promise<
|
|
49
|
+
editResponse(body: InteractionMessageUpdateBodyRequest): Promise<WebhookMessage>;
|
|
50
50
|
/**
|
|
51
51
|
* Updates the interaction with new data.
|
|
52
52
|
* @param body - The updated body of the interaction.
|
|
@@ -16,23 +16,6 @@ type COMPONENTS = {
|
|
|
16
16
|
timeout?: NodeJS.Timeout;
|
|
17
17
|
__run: (customId: string | string[] | RegExp, callback: ComponentCallback) => any;
|
|
18
18
|
};
|
|
19
|
-
export interface ComponentHandlerLike {
|
|
20
|
-
readonly values: Map<string, COMPONENTS>;
|
|
21
|
-
readonly commands: (ComponentCommand | ModalCommand)[];
|
|
22
|
-
readonly modals: Map<string, ModalSubmitCallback> | LimitedCollection<string, ModalSubmitCallback>;
|
|
23
|
-
onFail: ComponentHandler['onFail'];
|
|
24
|
-
createComponentCollector: ComponentHandler['createComponentCollector'];
|
|
25
|
-
hasModal: ComponentHandler['hasModal'];
|
|
26
|
-
onModalSubmit: ComponentHandler['onModalSubmit'];
|
|
27
|
-
executeModal: ComponentHandler['executeModal'];
|
|
28
|
-
hasComponent: ComponentHandler['hasComponent'];
|
|
29
|
-
executeComponent: ComponentHandler['executeComponent'];
|
|
30
|
-
onComponent: ComponentHandler['onComponent'];
|
|
31
|
-
load: ComponentHandler['load'];
|
|
32
|
-
reload: ComponentHandler['reload'];
|
|
33
|
-
reloadAll: ComponentHandler['reloadAll'];
|
|
34
|
-
onMessageDelete: ComponentHandler['onMessageDelete'];
|
|
35
|
-
}
|
|
36
19
|
export declare class ComponentHandler extends BaseHandler {
|
|
37
20
|
protected client: UsingClient;
|
|
38
21
|
onFail: OnFailCallback;
|
|
@@ -57,5 +40,11 @@ export declare class ComponentHandler extends BaseHandler {
|
|
|
57
40
|
reloadAll(): Promise<void>;
|
|
58
41
|
executeComponent(interaction: ComponentInteraction): Promise<void>;
|
|
59
42
|
executeModal(interaction: ModalSubmitInteraction): Promise<void>;
|
|
43
|
+
setHandlers({ callback }: {
|
|
44
|
+
callback: ComponentHandler['callback'];
|
|
45
|
+
}): void;
|
|
46
|
+
callback: (file: {
|
|
47
|
+
new (): ModalCommand | ComponentCommand;
|
|
48
|
+
}) => ModalCommand | ComponentCommand | false;
|
|
60
49
|
}
|
|
61
50
|
export {};
|
|
@@ -121,7 +121,9 @@ class ComponentHandler extends common_1.BaseHandler {
|
|
|
121
121
|
for (let i = 0; i < paths.length; i++) {
|
|
122
122
|
let component;
|
|
123
123
|
try {
|
|
124
|
-
component =
|
|
124
|
+
component = this.callback(paths[i].file);
|
|
125
|
+
if (!component)
|
|
126
|
+
continue;
|
|
125
127
|
}
|
|
126
128
|
catch (e) {
|
|
127
129
|
if (e instanceof Error && e.message === 'paths[i].file is not a constructor') {
|
|
@@ -138,7 +140,6 @@ class ComponentHandler extends common_1.BaseHandler {
|
|
|
138
140
|
continue;
|
|
139
141
|
component.__filePath = paths[i].path;
|
|
140
142
|
this.commands.push(component);
|
|
141
|
-
await this.__callback?.(component);
|
|
142
143
|
}
|
|
143
144
|
}
|
|
144
145
|
async reload(path) {
|
|
@@ -201,5 +202,9 @@ class ComponentHandler extends common_1.BaseHandler {
|
|
|
201
202
|
}
|
|
202
203
|
}
|
|
203
204
|
}
|
|
205
|
+
setHandlers({ callback }) {
|
|
206
|
+
this.callback = callback;
|
|
207
|
+
}
|
|
208
|
+
callback = (file) => new file();
|
|
204
209
|
}
|
|
205
210
|
exports.ComponentHandler = ComponentHandler;
|
package/lib/events/handler.d.ts
CHANGED
|
@@ -1,23 +1,14 @@
|
|
|
1
1
|
import type { GatewayDispatchPayload } from 'discord-api-types/v10';
|
|
2
2
|
import type { Client, WorkerClient } from '../client';
|
|
3
|
-
import { BaseHandler, type MakeRequired, type
|
|
3
|
+
import { BaseHandler, type MakeRequired, type SnakeCase } from '../common';
|
|
4
4
|
import type { ClientEvents } from '../events/hooks';
|
|
5
5
|
import type { ClientEvent, ClientNameEvents } from './event';
|
|
6
|
-
type EventValue = MakeRequired<ClientEvent, '__filePath'> & {
|
|
6
|
+
export type EventValue = MakeRequired<ClientEvent, '__filePath'> & {
|
|
7
7
|
fired?: boolean;
|
|
8
8
|
};
|
|
9
|
-
type GatewayEvents = Uppercase<SnakeCase<keyof ClientEvents>>;
|
|
10
|
-
export interface EventHandlerLike {
|
|
11
|
-
runEvent: EventHandler['runEvent'];
|
|
12
|
-
execute: EventHandler['execute'];
|
|
13
|
-
load: EventHandler['load'];
|
|
14
|
-
reload: EventHandler['reload'];
|
|
15
|
-
reloadAll: EventHandler['reloadAll'];
|
|
16
|
-
values: EventHandler['values'];
|
|
17
|
-
onFail: EventHandler['onFail'];
|
|
18
|
-
}
|
|
9
|
+
export type GatewayEvents = Uppercase<SnakeCase<keyof ClientEvents>>;
|
|
19
10
|
export declare class EventHandler extends BaseHandler {
|
|
20
|
-
onFail:
|
|
11
|
+
onFail: (event: GatewayEvents, err: unknown) => void;
|
|
21
12
|
protected filter: (path: string) => boolean;
|
|
22
13
|
values: Partial<Record<GatewayEvents, EventValue>>;
|
|
23
14
|
load(eventsDir: string): Promise<void>;
|
|
@@ -25,5 +16,8 @@ export declare class EventHandler extends BaseHandler {
|
|
|
25
16
|
runEvent(name: GatewayEvents, client: Client | WorkerClient, packet: any, shardId: number): Promise<void>;
|
|
26
17
|
reload(name: ClientNameEvents): Promise<any>;
|
|
27
18
|
reloadAll(): Promise<void>;
|
|
19
|
+
setHandlers({ callback }: {
|
|
20
|
+
callback: EventHandler['callback'];
|
|
21
|
+
}): void;
|
|
22
|
+
callback: (file: ClientEvent) => ClientEvent | false;
|
|
28
23
|
}
|
|
29
|
-
export {};
|
package/lib/events/handler.js
CHANGED
|
@@ -27,19 +27,20 @@ exports.EventHandler = void 0;
|
|
|
27
27
|
const common_1 = require("../common");
|
|
28
28
|
const RawEvents = __importStar(require("../events/hooks"));
|
|
29
29
|
class EventHandler extends common_1.BaseHandler {
|
|
30
|
-
onFail = err => this.logger.warn('<Client>.events.onFail', err);
|
|
30
|
+
onFail = (event, err) => this.logger.warn('<Client>.events.onFail', err, event);
|
|
31
31
|
filter = (path) => path.endsWith('.js') || (!path.endsWith('.d.ts') && path.endsWith('.ts'));
|
|
32
32
|
values = {};
|
|
33
33
|
async load(eventsDir) {
|
|
34
34
|
for (const i of await this.loadFilesK(await this.getFiles(eventsDir))) {
|
|
35
|
-
const instance = i.file;
|
|
35
|
+
const instance = this.callback(i.file);
|
|
36
|
+
if (!instance)
|
|
37
|
+
continue;
|
|
36
38
|
if (typeof instance?.run !== 'function') {
|
|
37
39
|
this.logger.warn(i.path.split(process.cwd()).slice(1).join(process.cwd()), 'Missing run function, use `export default {...}` syntax');
|
|
38
40
|
continue;
|
|
39
41
|
}
|
|
40
42
|
instance.__filePath = i.path;
|
|
41
43
|
this.values[common_1.ReplaceRegex.snake(instance.data.name).toUpperCase()] = instance;
|
|
42
|
-
await this.__callback?.(instance);
|
|
43
44
|
}
|
|
44
45
|
}
|
|
45
46
|
async execute(name, ...args) {
|
|
@@ -95,7 +96,7 @@ class EventHandler extends common_1.BaseHandler {
|
|
|
95
96
|
await Event.run(...[hook, client, shardId]);
|
|
96
97
|
}
|
|
97
98
|
catch (e) {
|
|
98
|
-
await this.onFail(e);
|
|
99
|
+
await this.onFail(name, e);
|
|
99
100
|
}
|
|
100
101
|
}
|
|
101
102
|
async reload(name) {
|
|
@@ -114,5 +115,9 @@ class EventHandler extends common_1.BaseHandler {
|
|
|
114
115
|
await this.reload(common_1.ReplaceRegex.camel(i));
|
|
115
116
|
}
|
|
116
117
|
}
|
|
118
|
+
setHandlers({ callback }) {
|
|
119
|
+
this.callback = callback;
|
|
120
|
+
}
|
|
121
|
+
callback = (file) => file;
|
|
117
122
|
}
|
|
118
123
|
exports.EventHandler = EventHandler;
|
|
@@ -20,7 +20,7 @@ export declare const GUILD_BAN_REMOVE: (self: BaseClient, data: GatewayGuildBanR
|
|
|
20
20
|
guildId: string;
|
|
21
21
|
};
|
|
22
22
|
export declare const GUILD_CREATE: (self: BaseClient, data: GatewayGuildCreateDispatchData) => Guild<"create">;
|
|
23
|
-
export declare const GUILD_DELETE: (
|
|
23
|
+
export declare const GUILD_DELETE: (self: BaseClient, data: GatewayGuildDeleteDispatchData) => Promise<import("discord-api-types/v10").APIUnavailableGuild | Guild<"cached">>;
|
|
24
24
|
export declare const GUILD_EMOJIS_UPDATE: (self: BaseClient, data: GatewayGuildEmojisUpdateDispatchData) => {
|
|
25
25
|
emojis: GuildEmoji[];
|
|
26
26
|
guildId: string;
|
|
@@ -19,8 +19,8 @@ const GUILD_CREATE = (self, data) => {
|
|
|
19
19
|
return new structures_1.Guild(self, data);
|
|
20
20
|
};
|
|
21
21
|
exports.GUILD_CREATE = GUILD_CREATE;
|
|
22
|
-
const GUILD_DELETE = async (
|
|
23
|
-
return data;
|
|
22
|
+
const GUILD_DELETE = async (self, data) => {
|
|
23
|
+
return (await self.cache.guilds?.get(data.id)) ?? data;
|
|
24
24
|
};
|
|
25
25
|
exports.GUILD_DELETE = GUILD_DELETE;
|
|
26
26
|
const GUILD_EMOJIS_UPDATE = (self, data) => {
|
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import type { GatewayMessageCreateDispatchData, GatewayMessageDeleteBulkDispatchData, GatewayMessageDeleteDispatchData, GatewayMessageReactionAddDispatchData, GatewayMessageReactionRemoveAllDispatchData, GatewayMessageReactionRemoveDispatchData, GatewayMessageReactionRemoveEmojiDispatchData, GatewayMessageUpdateDispatchData } from 'discord-api-types/v10';
|
|
1
|
+
import type { GatewayMessageCreateDispatchData, GatewayMessageDeleteBulkDispatchData, GatewayMessageDeleteDispatchData, GatewayMessagePollVoteDispatchData, GatewayMessageReactionAddDispatchData, GatewayMessageReactionRemoveAllDispatchData, GatewayMessageReactionRemoveDispatchData, GatewayMessageReactionRemoveEmojiDispatchData, GatewayMessageUpdateDispatchData } from 'discord-api-types/v10';
|
|
2
2
|
import type { BaseClient } from '../../client/base';
|
|
3
3
|
import { type MakeRequired, type PartialClass } from '../../common';
|
|
4
4
|
import { Message } from '../../structures';
|
|
5
5
|
export declare const MESSAGE_CREATE: (self: BaseClient, data: GatewayMessageCreateDispatchData) => Message;
|
|
6
|
-
export declare const MESSAGE_DELETE: (
|
|
6
|
+
export declare const MESSAGE_DELETE: (self: BaseClient, data: GatewayMessageDeleteDispatchData) => Promise<{
|
|
7
7
|
id: string;
|
|
8
8
|
channelId: string;
|
|
9
9
|
guildId?: string | undefined;
|
|
10
|
-
}
|
|
11
|
-
export declare const MESSAGE_DELETE_BULK: (
|
|
10
|
+
}>;
|
|
11
|
+
export declare const MESSAGE_DELETE_BULK: (self: BaseClient, data: GatewayMessageDeleteBulkDispatchData) => Promise<{
|
|
12
|
+
messages: import("../..").ReturnCache<Message | undefined>[];
|
|
12
13
|
ids: string[];
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
14
|
+
channel_id: string;
|
|
15
|
+
guild_id?: string | undefined;
|
|
16
|
+
}>;
|
|
16
17
|
export declare const MESSAGE_REACTION_ADD: (_self: BaseClient, data: GatewayMessageReactionAddDispatchData) => {
|
|
17
18
|
emoji: {
|
|
18
19
|
roles?: string[] | undefined;
|
|
@@ -67,4 +68,21 @@ export declare const MESSAGE_REACTION_REMOVE_EMOJI: (_self: BaseClient, data: Ga
|
|
|
67
68
|
messageId: string;
|
|
68
69
|
guildId?: string | undefined;
|
|
69
70
|
};
|
|
70
|
-
export declare const MESSAGE_UPDATE: (self: BaseClient, data: GatewayMessageUpdateDispatchData) =>
|
|
71
|
+
export declare const MESSAGE_UPDATE: (self: BaseClient, data: GatewayMessageUpdateDispatchData) => Promise<[
|
|
72
|
+
undefined | Message,
|
|
73
|
+
MakeRequired<PartialClass<Message>, 'id' | 'channelId' | 'createdAt' | 'createdTimestamp' | 'rest' | 'cache' | 'api' | 'client'>
|
|
74
|
+
]>;
|
|
75
|
+
export declare const MESSAGE_POLL_VOTE_ADD: (_: BaseClient, data: GatewayMessagePollVoteDispatchData) => {
|
|
76
|
+
userId: string;
|
|
77
|
+
channelId: string;
|
|
78
|
+
messageId: string;
|
|
79
|
+
guildId?: string | undefined;
|
|
80
|
+
answerId: number;
|
|
81
|
+
};
|
|
82
|
+
export declare const MESSAGE_POLL_VOTE_REMOVE: (_: BaseClient, data: GatewayMessagePollVoteDispatchData) => {
|
|
83
|
+
userId: string;
|
|
84
|
+
channelId: string;
|
|
85
|
+
messageId: string;
|
|
86
|
+
guildId?: string | undefined;
|
|
87
|
+
answerId: number;
|
|
88
|
+
};
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MESSAGE_UPDATE = exports.MESSAGE_REACTION_REMOVE_EMOJI = exports.MESSAGE_REACTION_REMOVE_ALL = exports.MESSAGE_REACTION_REMOVE = exports.MESSAGE_REACTION_ADD = exports.MESSAGE_DELETE_BULK = exports.MESSAGE_DELETE = exports.MESSAGE_CREATE = void 0;
|
|
3
|
+
exports.MESSAGE_POLL_VOTE_REMOVE = exports.MESSAGE_POLL_VOTE_ADD = exports.MESSAGE_UPDATE = exports.MESSAGE_REACTION_REMOVE_EMOJI = exports.MESSAGE_REACTION_REMOVE_ALL = exports.MESSAGE_REACTION_REMOVE = exports.MESSAGE_REACTION_ADD = exports.MESSAGE_DELETE_BULK = exports.MESSAGE_DELETE = exports.MESSAGE_CREATE = void 0;
|
|
4
4
|
const common_1 = require("../../common");
|
|
5
5
|
const structures_1 = require("../../structures");
|
|
6
6
|
const MESSAGE_CREATE = (self, data) => {
|
|
7
7
|
return new structures_1.Message(self, data);
|
|
8
8
|
};
|
|
9
9
|
exports.MESSAGE_CREATE = MESSAGE_CREATE;
|
|
10
|
-
const MESSAGE_DELETE = (
|
|
11
|
-
return (0, common_1.toCamelCase)(data);
|
|
10
|
+
const MESSAGE_DELETE = async (self, data) => {
|
|
11
|
+
return (await self.cache.messages?.get(data.id)) ?? (0, common_1.toCamelCase)(data);
|
|
12
12
|
};
|
|
13
13
|
exports.MESSAGE_DELETE = MESSAGE_DELETE;
|
|
14
|
-
const MESSAGE_DELETE_BULK = (
|
|
15
|
-
return
|
|
14
|
+
const MESSAGE_DELETE_BULK = async (self, data) => {
|
|
15
|
+
return {
|
|
16
|
+
...data,
|
|
17
|
+
messages: await Promise.all(data.ids.map(id => self.cache.messages?.get(id))),
|
|
18
|
+
};
|
|
16
19
|
};
|
|
17
20
|
exports.MESSAGE_DELETE_BULK = MESSAGE_DELETE_BULK;
|
|
18
21
|
const MESSAGE_REACTION_ADD = (_self, data) => {
|
|
@@ -31,7 +34,15 @@ const MESSAGE_REACTION_REMOVE_EMOJI = (_self, data) => {
|
|
|
31
34
|
return (0, common_1.toCamelCase)(data);
|
|
32
35
|
};
|
|
33
36
|
exports.MESSAGE_REACTION_REMOVE_EMOJI = MESSAGE_REACTION_REMOVE_EMOJI;
|
|
34
|
-
const MESSAGE_UPDATE = (self, data) => {
|
|
35
|
-
return new structures_1.Message(self, data);
|
|
37
|
+
const MESSAGE_UPDATE = async (self, data) => {
|
|
38
|
+
return [await self.cache.messages?.get(data.id), new structures_1.Message(self, data)];
|
|
36
39
|
};
|
|
37
40
|
exports.MESSAGE_UPDATE = MESSAGE_UPDATE;
|
|
41
|
+
const MESSAGE_POLL_VOTE_ADD = (_, data) => {
|
|
42
|
+
return (0, common_1.toCamelCase)(data);
|
|
43
|
+
};
|
|
44
|
+
exports.MESSAGE_POLL_VOTE_ADD = MESSAGE_POLL_VOTE_ADD;
|
|
45
|
+
const MESSAGE_POLL_VOTE_REMOVE = (_, data) => {
|
|
46
|
+
return (0, common_1.toCamelCase)(data);
|
|
47
|
+
};
|
|
48
|
+
exports.MESSAGE_POLL_VOTE_REMOVE = MESSAGE_POLL_VOTE_REMOVE;
|
package/lib/langs/handler.d.ts
CHANGED
|
@@ -1,13 +1,5 @@
|
|
|
1
1
|
import type { LocaleString } from 'discord-api-types/v10';
|
|
2
2
|
import { BaseHandler } from '../common';
|
|
3
|
-
export interface LangsHandlerLike {
|
|
4
|
-
getKey: LangsHandler['getKey'];
|
|
5
|
-
load: LangsHandler['load'];
|
|
6
|
-
values: LangsHandler['values'];
|
|
7
|
-
aliases: LangsHandler['aliases'];
|
|
8
|
-
get: LangsHandler['get'];
|
|
9
|
-
defaultLang?: LangsHandler['defaultLang'];
|
|
10
|
-
}
|
|
11
3
|
export declare class LangsHandler extends BaseHandler {
|
|
12
4
|
values: Partial<Record<string, any>>;
|
|
13
5
|
protected filter: (path: string) => boolean;
|
|
@@ -19,4 +11,8 @@ export declare class LangsHandler extends BaseHandler {
|
|
|
19
11
|
get(locale?: string | undefined): import("..").DefaultLocale;
|
|
20
12
|
};
|
|
21
13
|
load(dir: string): Promise<void>;
|
|
14
|
+
setHandlers({ callback }: {
|
|
15
|
+
callback: LangsHandler['callback'];
|
|
16
|
+
}): void;
|
|
17
|
+
callback: (_locale: string, file: Record<string, any>) => Record<string, any> | false;
|
|
22
18
|
}
|
package/lib/langs/handler.js
CHANGED
|
@@ -34,9 +34,14 @@ class LangsHandler extends common_1.BaseHandler {
|
|
|
34
34
|
const files = await this.loadFilesK(await this.getFiles(dir));
|
|
35
35
|
for (const i of files) {
|
|
36
36
|
const locale = i.name.split('.').slice(0, -1).join('.');
|
|
37
|
-
this.
|
|
38
|
-
|
|
37
|
+
const result = this.callback(locale, i.file);
|
|
38
|
+
if (result)
|
|
39
|
+
this.values[locale] = result;
|
|
39
40
|
}
|
|
40
41
|
}
|
|
42
|
+
setHandlers({ callback }) {
|
|
43
|
+
this.callback = callback;
|
|
44
|
+
}
|
|
45
|
+
callback = (_locale, file) => file;
|
|
41
46
|
}
|
|
42
47
|
exports.LangsHandler = LangsHandler;
|
|
@@ -8,16 +8,16 @@ export declare class AutoModerationRule extends DiscordBase<APIAutoModerationRul
|
|
|
8
8
|
constructor(client: UsingClient, data: APIAutoModerationRule);
|
|
9
9
|
fetchCreator(force?: boolean): Promise<import("./GuildMember").GuildMember>;
|
|
10
10
|
guild(force?: boolean): Promise<import("./Guild").Guild<"cached"> | import("./Guild").Guild<"api">>;
|
|
11
|
-
fetch(): Promise<
|
|
12
|
-
edit(body: ObjectToLower<RESTPatchAPIAutoModerationRuleJSONBody>, reason?: string): Promise<
|
|
11
|
+
fetch(): Promise<AutoModerationRule>;
|
|
12
|
+
edit(body: ObjectToLower<RESTPatchAPIAutoModerationRuleJSONBody>, reason?: string): Promise<AutoModerationRule>;
|
|
13
13
|
delete(reason?: string): Promise<never>;
|
|
14
14
|
static methods({ client, guildId }: MethodContext<{
|
|
15
15
|
guildId: string;
|
|
16
16
|
}>): {
|
|
17
|
-
list: () => Promise<
|
|
18
|
-
create: (body: RESTPostAPIAutoModerationRuleJSONBody) => Promise<
|
|
17
|
+
list: () => Promise<AutoModerationRule[]>;
|
|
18
|
+
create: (body: RESTPostAPIAutoModerationRuleJSONBody) => Promise<AutoModerationRule>;
|
|
19
19
|
delete: (ruleId: string, reason?: string) => Promise<never>;
|
|
20
|
-
fetch: (ruleId: string) => Promise<
|
|
21
|
-
edit: (ruleId: string, body: RESTPatchAPIAutoModerationRuleJSONBody, reason?: string) => Promise<
|
|
20
|
+
fetch: (ruleId: string) => Promise<AutoModerationRule>;
|
|
21
|
+
edit: (ruleId: string, body: RESTPatchAPIAutoModerationRuleJSONBody, reason?: string) => Promise<AutoModerationRule>;
|
|
22
22
|
};
|
|
23
23
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { APIGuild, GatewayGuildCreateDispatchData } from 'discord-api-types/v10';
|
|
2
2
|
import type { UsingClient } from '../commands';
|
|
3
3
|
import type { ObjectToLower, StructPropState, StructStates, ToClass } from '../common/types/util';
|
|
4
|
+
import { AutoModerationRule } from './AutoModerationRule';
|
|
4
5
|
import { GuildEmoji } from './GuildEmoji';
|
|
5
6
|
import { GuildMember } from './GuildMember';
|
|
6
7
|
import { GuildRole } from './GuildRole';
|
|
8
|
+
import { GuildTemplate } from './GuildTemplate';
|
|
7
9
|
import { Sticker } from './Sticker';
|
|
8
10
|
import { BaseGuild } from './extra/BaseGuild';
|
|
9
11
|
import type { DiscordBase } from './extra/DiscordBase';
|
|
@@ -23,12 +25,12 @@ export declare class Guild<State extends StructStates = 'api'> extends Guild_bas
|
|
|
23
25
|
get maxEmojis(): MaxEmojis;
|
|
24
26
|
fetchOwner(force?: boolean): Promise<null> | Promise<GuildMember>;
|
|
25
27
|
templates: {
|
|
26
|
-
fetch: (code: string) => Promise<
|
|
27
|
-
list: () => Promise<
|
|
28
|
-
create: (body: import("discord-api-types/v10").RESTPostAPIGuildTemplatesJSONBody) => Promise<
|
|
29
|
-
sync: (code: string) => Promise<
|
|
30
|
-
edit: (code: string, body: import("discord-api-types/utils/internals").AddUndefinedToPossiblyUndefinedPropertiesOfInterface<Partial<import("discord-api-types/v10").RESTPostAPIGuildTemplatesJSONBody>>) => Promise<
|
|
31
|
-
delete: (code: string) => Promise<
|
|
28
|
+
fetch: (code: string) => Promise<GuildTemplate>;
|
|
29
|
+
list: () => Promise<GuildTemplate[]>;
|
|
30
|
+
create: (body: import("discord-api-types/v10").RESTPostAPIGuildTemplatesJSONBody) => Promise<GuildTemplate>;
|
|
31
|
+
sync: (code: string) => Promise<GuildTemplate>;
|
|
32
|
+
edit: (code: string, body: import("discord-api-types/utils/internals").AddUndefinedToPossiblyUndefinedPropertiesOfInterface<Partial<import("discord-api-types/v10").RESTPostAPIGuildTemplatesJSONBody>>) => Promise<GuildTemplate>;
|
|
33
|
+
delete: (code: string) => Promise<GuildTemplate>;
|
|
32
34
|
};
|
|
33
35
|
stickers: {
|
|
34
36
|
list: () => Promise<Sticker[]>;
|
|
@@ -49,17 +51,17 @@ export declare class Guild<State extends StructStates = 'api'> extends Guild_bas
|
|
|
49
51
|
list: (query?: import("discord-api-types/v10").RESTGetAPIGuildMembersQuery | undefined, force?: boolean) => Promise<GuildMember[]>;
|
|
50
52
|
};
|
|
51
53
|
moderationRules: {
|
|
52
|
-
list: () => Promise<
|
|
53
|
-
create: (body: import("discord-api-types/v10").RESTPostAPIAutoModerationRuleJSONBody) => Promise<
|
|
54
|
+
list: () => Promise<AutoModerationRule[]>;
|
|
55
|
+
create: (body: import("discord-api-types/v10").RESTPostAPIAutoModerationRuleJSONBody) => Promise<AutoModerationRule>;
|
|
54
56
|
delete: (ruleId: string, reason?: string | undefined) => Promise<never>;
|
|
55
|
-
fetch: (ruleId: string) => Promise<
|
|
56
|
-
edit: (ruleId: string, body: import("discord-api-types/v10").RESTPatchAPIAutoModerationRuleJSONBody, reason?: string | undefined) => Promise<
|
|
57
|
+
fetch: (ruleId: string) => Promise<AutoModerationRule>;
|
|
58
|
+
edit: (ruleId: string, body: import("discord-api-types/v10").RESTPatchAPIAutoModerationRuleJSONBody, reason?: string | undefined) => Promise<AutoModerationRule>;
|
|
57
59
|
};
|
|
58
60
|
roles: {
|
|
59
|
-
create: (body: import("discord-api-types/v10").RESTPostAPIGuildRoleJSONBody) => Promise<
|
|
61
|
+
create: (body: import("discord-api-types/v10").RESTPostAPIGuildRoleJSONBody) => Promise<GuildRole>;
|
|
60
62
|
list: (force?: boolean) => Promise<GuildRole[]>;
|
|
61
|
-
edit: (roleId: string, body: import("discord-api-types/v10").RESTPatchAPIGuildRoleJSONBody, reason?: string | undefined) => Promise<
|
|
62
|
-
delete: (roleId: string, reason?: string | undefined) => Promise<
|
|
63
|
+
edit: (roleId: string, body: import("discord-api-types/v10").RESTPatchAPIGuildRoleJSONBody, reason?: string | undefined) => Promise<GuildRole>;
|
|
64
|
+
delete: (roleId: string, reason?: string | undefined) => Promise<GuildRole>;
|
|
63
65
|
editPositions: (body: import("discord-api-types/v10").RESTPatchAPIGuildRolePositionsJSONBody) => Promise<GuildRole[]>;
|
|
64
66
|
};
|
|
65
67
|
channels: {
|
|
@@ -10,15 +10,15 @@ export declare class GuildRole extends DiscordBase {
|
|
|
10
10
|
permissions: PermissionsBitField;
|
|
11
11
|
constructor(client: UsingClient, data: APIRole, guildId: string);
|
|
12
12
|
guild(force?: boolean): Promise<import("./Guild").Guild<"cached"> | import("./Guild").Guild<"api">> | undefined;
|
|
13
|
-
edit(body: RESTPatchAPIGuildRoleJSONBody, reason?: string): Promise<
|
|
14
|
-
delete(reason?: string): Promise<
|
|
13
|
+
edit(body: RESTPatchAPIGuildRoleJSONBody, reason?: string): Promise<GuildRole>;
|
|
14
|
+
delete(reason?: string): Promise<GuildRole>;
|
|
15
15
|
static methods(ctx: MethodContext<{
|
|
16
16
|
guildId: string;
|
|
17
17
|
}>): {
|
|
18
|
-
create: (body: RESTPostAPIGuildRoleJSONBody) => Promise<
|
|
18
|
+
create: (body: RESTPostAPIGuildRoleJSONBody) => Promise<GuildRole>;
|
|
19
19
|
list: (force?: boolean) => Promise<GuildRole[]>;
|
|
20
|
-
edit: (roleId: string, body: RESTPatchAPIGuildRoleJSONBody, reason?: string) => Promise<
|
|
21
|
-
delete: (roleId: string, reason?: string) => Promise<
|
|
20
|
+
edit: (roleId: string, body: RESTPatchAPIGuildRoleJSONBody, reason?: string) => Promise<GuildRole>;
|
|
21
|
+
delete: (roleId: string, reason?: string) => Promise<GuildRole>;
|
|
22
22
|
editPositions: (body: RESTPatchAPIGuildRolePositionsJSONBody) => Promise<GuildRole[]>;
|
|
23
23
|
};
|
|
24
24
|
}
|
|
@@ -7,18 +7,18 @@ export interface GuildTemplate extends Base, ObjectToLower<APITemplate> {
|
|
|
7
7
|
export declare class GuildTemplate extends Base {
|
|
8
8
|
constructor(client: UsingClient, data: APITemplate);
|
|
9
9
|
guild(force?: boolean): Promise<import("./Guild").Guild<"cached"> | import("./Guild").Guild<"api">>;
|
|
10
|
-
fetch(): Promise<
|
|
11
|
-
sync(): Promise<
|
|
12
|
-
edit(body: RESTPatchAPIGuildTemplateJSONBody): Promise<
|
|
13
|
-
delete(): Promise<
|
|
10
|
+
fetch(): Promise<GuildTemplate>;
|
|
11
|
+
sync(): Promise<GuildTemplate>;
|
|
12
|
+
edit(body: RESTPatchAPIGuildTemplateJSONBody): Promise<GuildTemplate>;
|
|
13
|
+
delete(): Promise<GuildTemplate>;
|
|
14
14
|
static methods(ctx: MethodContext<{
|
|
15
15
|
guildId: string;
|
|
16
16
|
}>): {
|
|
17
|
-
fetch: (code: string) => Promise<
|
|
18
|
-
list: () => Promise<
|
|
19
|
-
create: (body: RESTPostAPIGuildTemplatesJSONBody) => Promise<
|
|
20
|
-
sync: (code: string) => Promise<
|
|
21
|
-
edit: (code: string, body: RESTPatchAPIGuildTemplateJSONBody) => Promise<
|
|
22
|
-
delete: (code: string) => Promise<
|
|
17
|
+
fetch: (code: string) => Promise<GuildTemplate>;
|
|
18
|
+
list: () => Promise<GuildTemplate[]>;
|
|
19
|
+
create: (body: RESTPostAPIGuildTemplatesJSONBody) => Promise<GuildTemplate>;
|
|
20
|
+
sync: (code: string) => Promise<GuildTemplate>;
|
|
21
|
+
edit: (code: string, body: RESTPatchAPIGuildTemplateJSONBody) => Promise<GuildTemplate>;
|
|
22
|
+
delete: (code: string) => Promise<GuildTemplate>;
|
|
23
23
|
};
|
|
24
24
|
}
|
|
@@ -55,11 +55,11 @@ export declare class Interaction<FromGuild extends boolean = boolean, Type exten
|
|
|
55
55
|
write<FR extends boolean = false>(body: InteractionCreateBodyRequest, fetchReply?: FR): Promise<When<FR, WebhookMessage, void>>;
|
|
56
56
|
modal(body: ModalCreateBodyRequest): Promise<void>;
|
|
57
57
|
editOrReply<FR extends boolean = false>(body: InteractionCreateBodyRequest, fetchReply?: FR): Promise<When<FR, WebhookMessage, void>>;
|
|
58
|
-
editMessage(messageId: string, body: InteractionMessageUpdateBodyRequest): Promise<
|
|
59
|
-
editResponse(body: InteractionMessageUpdateBodyRequest): Promise<
|
|
58
|
+
editMessage(messageId: string, body: InteractionMessageUpdateBodyRequest): Promise<WebhookMessage>;
|
|
59
|
+
editResponse(body: InteractionMessageUpdateBodyRequest): Promise<WebhookMessage>;
|
|
60
60
|
deleteResponse(): Promise<void | undefined>;
|
|
61
61
|
deleteMessage(messageId: string): Promise<void | undefined>;
|
|
62
|
-
|
|
62
|
+
followup(body: MessageWebhookCreateBodyRequest): Promise<WebhookMessage>;
|
|
63
63
|
}
|
|
64
64
|
export declare class ApplicationCommandInteraction<FromGuild extends boolean = boolean, Type extends APIApplicationCommandInteraction = APIApplicationCommandInteraction> extends Interaction<FromGuild, Type> {
|
|
65
65
|
type: ApplicationCommandType;
|
|
@@ -55,19 +55,21 @@ class BaseInteraction extends DiscordBase_1.DiscordBase {
|
|
|
55
55
|
case v10_1.InteractionResponseType.DeferredChannelMessageWithSource:
|
|
56
56
|
return body;
|
|
57
57
|
case v10_1.InteractionResponseType.ChannelMessageWithSource:
|
|
58
|
-
case v10_1.InteractionResponseType.UpdateMessage:
|
|
58
|
+
case v10_1.InteractionResponseType.UpdateMessage: {
|
|
59
|
+
const poll = body.poll;
|
|
59
60
|
return {
|
|
60
61
|
type: body.type,
|
|
61
|
-
|
|
62
|
+
//@ts-ignore
|
|
62
63
|
data: {
|
|
63
|
-
// @ts-ignore
|
|
64
64
|
...(body.data ?? {}),
|
|
65
|
-
|
|
65
|
+
//@ts-ignore
|
|
66
66
|
components: body.data?.components?.map(x => (x instanceof builders_1.ActionRow ? x.toJSON() : x)) ?? undefined,
|
|
67
67
|
embeds: body.data?.embeds?.map(x => (x instanceof builders_1.Embed ? x.toJSON() : x)) ?? undefined,
|
|
68
68
|
attachments: body.data?.attachments?.map((x, i) => ({ id: i, ...(0, builders_1.resolveAttachment)(x) })) ?? undefined,
|
|
69
|
+
poll: poll ? (poll instanceof builders_1.PollBuilder ? poll.toJSON() : poll) : undefined,
|
|
69
70
|
},
|
|
70
71
|
};
|
|
72
|
+
}
|
|
71
73
|
case v10_1.InteractionResponseType.Modal:
|
|
72
74
|
return {
|
|
73
75
|
type: body.type,
|
|
@@ -87,38 +89,34 @@ class BaseInteraction extends DiscordBase_1.DiscordBase {
|
|
|
87
89
|
}
|
|
88
90
|
}
|
|
89
91
|
static transformBody(body) {
|
|
92
|
+
const poll = body.poll;
|
|
90
93
|
return {
|
|
91
94
|
...body,
|
|
92
95
|
components: body.components?.map(x => (x instanceof builders_1.ActionRow ? x.toJSON() : x)) ?? undefined,
|
|
93
96
|
embeds: body?.embeds?.map(x => (x instanceof builders_1.Embed ? x.toJSON() : x)) ?? undefined,
|
|
94
|
-
|
|
97
|
+
poll: poll ? (poll instanceof builders_1.PollBuilder ? poll.toJSON() : poll) : undefined,
|
|
95
98
|
};
|
|
96
99
|
}
|
|
97
|
-
matchReplied(
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
100
|
+
async matchReplied(body) {
|
|
101
|
+
if (this.__reply) {
|
|
102
|
+
//@ts-expect-error
|
|
103
|
+
const { files, ...data } = body.data ?? {};
|
|
104
|
+
return (this.replied = this.__reply({
|
|
105
|
+
body: BaseInteraction.transformBodyRequest({ data, type: body.type }),
|
|
106
|
+
files: files ? await (0, builders_1.resolveFiles)(files) : undefined,
|
|
107
|
+
}).then(() => (this.replied = true)));
|
|
108
|
+
}
|
|
109
|
+
return (this.replied = this.client.interactions.reply(this.id, this.token, body).then(() => (this.replied = true)));
|
|
103
110
|
}
|
|
104
111
|
async reply(body) {
|
|
105
112
|
if (this.replied) {
|
|
106
113
|
throw new Error('Interaction already replied');
|
|
107
114
|
}
|
|
115
|
+
await this.matchReplied(body);
|
|
108
116
|
// @ts-expect-error
|
|
109
|
-
if (body.data
|
|
110
|
-
// @ts-expect-error
|
|
111
|
-
const { files, ...rest } = body.data;
|
|
112
|
-
this.matchReplied(rest, body.type, await (0, builders_1.resolveFiles)(files));
|
|
113
|
-
// @ts-expect-error
|
|
114
|
-
}
|
|
115
|
-
else
|
|
116
|
-
this.matchReplied(body.data, body.type);
|
|
117
|
-
// @ts-expect-error
|
|
118
|
-
if (body.data instanceof builders_1.Modal)
|
|
117
|
+
if (body.data instanceof builders_1.Modal && body.data.__exec)
|
|
119
118
|
// @ts-expect-error
|
|
120
119
|
this.client.components.modals.set(this.user.id, body.data.__exec);
|
|
121
|
-
await this.replied;
|
|
122
120
|
}
|
|
123
121
|
deferReply(flags) {
|
|
124
122
|
return this.reply({
|
|
@@ -191,7 +189,7 @@ class AutocompleteInteraction extends BaseInteraction {
|
|
|
191
189
|
exports.AutocompleteInteraction = AutocompleteInteraction;
|
|
192
190
|
class Interaction extends BaseInteraction {
|
|
193
191
|
fetchMessage(messageId) {
|
|
194
|
-
return this.client.
|
|
192
|
+
return this.client.interactions.fetchResponse(this.token, messageId);
|
|
195
193
|
}
|
|
196
194
|
fetchResponse() {
|
|
197
195
|
return this.fetchMessage('@original');
|
|
@@ -218,16 +216,8 @@ class Interaction extends BaseInteraction {
|
|
|
218
216
|
}
|
|
219
217
|
return this.write(body, fetchReply);
|
|
220
218
|
}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
const apiMessage = await this.api
|
|
224
|
-
.webhooks(this.applicationId)(this.token)
|
|
225
|
-
.messages(messageId)
|
|
226
|
-
.patch({
|
|
227
|
-
body: BaseInteraction.transformBody(data),
|
|
228
|
-
files: files ? await (0, builders_1.resolveFiles)(files) : undefined,
|
|
229
|
-
});
|
|
230
|
-
return new Message_1.Message(this.client, apiMessage);
|
|
219
|
+
editMessage(messageId, body) {
|
|
220
|
+
return this.client.interactions.editMessage(this.token, messageId, body);
|
|
231
221
|
}
|
|
232
222
|
editResponse(body) {
|
|
233
223
|
return this.editMessage('@original', body);
|
|
@@ -236,21 +226,10 @@ class Interaction extends BaseInteraction {
|
|
|
236
226
|
return this.deleteMessage('@original');
|
|
237
227
|
}
|
|
238
228
|
deleteMessage(messageId) {
|
|
239
|
-
return this.
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
.then(() => this.client.components?.onMessageDelete(messageId === '@original' ? this.id : messageId));
|
|
244
|
-
}
|
|
245
|
-
async createResponse({ files, ...body }) {
|
|
246
|
-
files ??= files ? await (0, builders_1.resolveFiles)(files) : undefined;
|
|
247
|
-
const apiMessage = await this.api
|
|
248
|
-
.webhooks(this.applicationId)(this.token)
|
|
249
|
-
.post({
|
|
250
|
-
body: BaseInteraction.transformBody(body),
|
|
251
|
-
files: files,
|
|
252
|
-
});
|
|
253
|
-
return new Message_1.Message(this.client, apiMessage);
|
|
229
|
+
return this.client.interactions.deleteResponse(this.id, this.token, messageId);
|
|
230
|
+
}
|
|
231
|
+
async followup(body) {
|
|
232
|
+
return this.client.interactions.followup(this.token, body);
|
|
254
233
|
}
|
|
255
234
|
}
|
|
256
235
|
exports.Interaction = Interaction;
|
|
@@ -10,8 +10,9 @@ import { GuildMember } from './GuildMember';
|
|
|
10
10
|
import { User } from './User';
|
|
11
11
|
import type { MessageWebhookMethodEditParams, MessageWebhookMethodWriteParams } from './Webhook';
|
|
12
12
|
import { DiscordBase } from './extra/DiscordBase';
|
|
13
|
+
import { Poll } from '..';
|
|
13
14
|
export type MessageData = APIMessage | GatewayMessageCreateDispatchData;
|
|
14
|
-
export interface BaseMessage extends DiscordBase, ObjectToLower<Omit<MessageData, 'timestamp' | 'author' | 'mentions' | 'components'>> {
|
|
15
|
+
export interface BaseMessage extends DiscordBase, ObjectToLower<Omit<MessageData, 'timestamp' | 'author' | 'mentions' | 'components' | 'poll'>> {
|
|
15
16
|
}
|
|
16
17
|
export declare class BaseMessage extends DiscordBase {
|
|
17
18
|
guildId: string | undefined;
|
|
@@ -19,6 +20,7 @@ export declare class BaseMessage extends DiscordBase {
|
|
|
19
20
|
author: User;
|
|
20
21
|
member?: GuildMember;
|
|
21
22
|
components: MessageActionRowComponent<ActionRowMessageComponents>[];
|
|
23
|
+
poll?: Poll;
|
|
22
24
|
mentions: {
|
|
23
25
|
roles: string[];
|
|
24
26
|
channels: APIChannelMention[];
|
|
@@ -27,7 +29,7 @@ export declare class BaseMessage extends DiscordBase {
|
|
|
27
29
|
constructor(client: UsingClient, data: MessageData);
|
|
28
30
|
get user(): User;
|
|
29
31
|
createComponentCollector(options?: ListenerOptions): {
|
|
30
|
-
run<T extends import("./Interaction").StringSelectMenuInteraction<string[]> | import("./Interaction").ComponentInteraction<boolean, import("discord-api-types/v10").APIMessageComponentInteraction> = import("./Interaction").StringSelectMenuInteraction<string[]> | import("./Interaction").ComponentInteraction<boolean, import("discord-api-types/v10").APIMessageComponentInteraction>>(customId: string | RegExp | string[], callback: import("
|
|
32
|
+
run<T extends import("./Interaction").StringSelectMenuInteraction<string[]> | import("./Interaction").ComponentInteraction<boolean, import("discord-api-types/v10").APIMessageComponentInteraction> = import("./Interaction").StringSelectMenuInteraction<string[]> | import("./Interaction").ComponentInteraction<boolean, import("discord-api-types/v10").APIMessageComponentInteraction>>(customId: string | RegExp | string[], callback: import("..").ComponentCallback<T>): any;
|
|
31
33
|
stop(reason?: string | undefined): any;
|
|
32
34
|
};
|
|
33
35
|
get url(): string;
|
|
@@ -36,7 +38,7 @@ export declare class BaseMessage extends DiscordBase {
|
|
|
36
38
|
react(emoji: EmojiResolvable): Promise<void>;
|
|
37
39
|
private patch;
|
|
38
40
|
}
|
|
39
|
-
export interface Message extends BaseMessage, ObjectToLower<Omit<MessageData, 'timestamp' | 'author' | 'mentions' | 'components'>> {
|
|
41
|
+
export interface Message extends BaseMessage, ObjectToLower<Omit<MessageData, 'timestamp' | 'author' | 'mentions' | 'components' | 'poll'>> {
|
|
40
42
|
}
|
|
41
43
|
export declare class Message extends BaseMessage {
|
|
42
44
|
constructor(client: UsingClient, data: MessageData);
|