seyfert 0.1.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 -0
- package/README.md +57 -0
- package/lib/api/CDN.d.ts +220 -0
- package/lib/api/CDN.js +236 -0
- package/lib/api/REST.d.ts +127 -0
- package/lib/api/REST.js +424 -0
- package/lib/api/Router.d.ts +17 -0
- package/lib/api/Router.js +63 -0
- package/lib/api/Routes/applications.d.ts +46 -0
- package/lib/api/Routes/applications.js +2 -0
- package/lib/api/Routes/cdn.d.ts +66 -0
- package/lib/api/Routes/cdn.js +2 -0
- package/lib/api/Routes/channels.d.ts +109 -0
- package/lib/api/Routes/channels.js +2 -0
- package/lib/api/Routes/gateway.d.ts +11 -0
- package/lib/api/Routes/gateway.js +2 -0
- package/lib/api/Routes/guilds.d.ts +171 -0
- package/lib/api/Routes/guilds.js +2 -0
- package/lib/api/Routes/index.d.ts +13 -0
- package/lib/api/Routes/index.js +17 -0
- package/lib/api/Routes/interactions.d.ts +14 -0
- package/lib/api/Routes/interactions.js +2 -0
- package/lib/api/Routes/invites.d.ts +9 -0
- package/lib/api/Routes/invites.js +2 -0
- package/lib/api/Routes/stage-instances.d.ts +13 -0
- package/lib/api/Routes/stage-instances.js +2 -0
- package/lib/api/Routes/stickers.d.ts +11 -0
- package/lib/api/Routes/stickers.js +2 -0
- package/lib/api/Routes/users.d.ts +35 -0
- package/lib/api/Routes/users.js +2 -0
- package/lib/api/Routes/voice.d.ts +10 -0
- package/lib/api/Routes/voice.js +2 -0
- package/lib/api/Routes/webhooks.d.ts +29 -0
- package/lib/api/Routes/webhooks.js +2 -0
- package/lib/api/errors/DiscordAPIError.d.ts +51 -0
- package/lib/api/errors/DiscordAPIError.js +81 -0
- package/lib/api/errors/HTTPError.d.ts +20 -0
- package/lib/api/errors/HTTPError.js +28 -0
- package/lib/api/errors/RateLimitError.d.ts +19 -0
- package/lib/api/errors/RateLimitError.js +37 -0
- package/lib/api/handlers/BurstHandler.d.ts +51 -0
- package/lib/api/handlers/BurstHandler.js +124 -0
- package/lib/api/handlers/SequentialHandler.d.ts +81 -0
- package/lib/api/handlers/SequentialHandler.js +365 -0
- package/lib/api/handlers/Shared.d.ts +14 -0
- package/lib/api/handlers/Shared.js +125 -0
- package/lib/api/index.d.ts +5 -0
- package/lib/api/index.js +21 -0
- package/lib/api/interfaces/Handler.d.ts +21 -0
- package/lib/api/interfaces/Handler.js +2 -0
- package/lib/api/shared.d.ts +7 -0
- package/lib/api/shared.js +27 -0
- package/lib/api/utils/constants.d.ts +39 -0
- package/lib/api/utils/constants.js +50 -0
- package/lib/api/utils/types.d.ts +335 -0
- package/lib/api/utils/types.js +14 -0
- package/lib/api/utils/utils.d.ts +52 -0
- package/lib/api/utils/utils.js +159 -0
- package/lib/builders/ActionRow.d.ts +40 -0
- package/lib/builders/ActionRow.js +58 -0
- package/lib/builders/Attachment.d.ts +106 -0
- package/lib/builders/Attachment.js +196 -0
- package/lib/builders/Base.d.ts +10 -0
- package/lib/builders/Base.js +13 -0
- package/lib/builders/Button.d.ts +59 -0
- package/lib/builders/Button.js +94 -0
- package/lib/builders/MessageEmbed.d.ts +116 -0
- package/lib/builders/MessageEmbed.js +159 -0
- package/lib/builders/Modal.d.ts +111 -0
- package/lib/builders/Modal.js +162 -0
- package/lib/builders/SelectMenu.d.ts +201 -0
- package/lib/builders/SelectMenu.js +293 -0
- package/lib/builders/index.d.ts +12 -0
- package/lib/builders/index.js +54 -0
- package/lib/builders/types.d.ts +21 -0
- package/lib/builders/types.js +2 -0
- package/lib/cache/adapters/default.d.ts +24 -0
- package/lib/cache/adapters/default.js +118 -0
- package/lib/cache/adapters/index.d.ts +4 -0
- package/lib/cache/adapters/index.js +20 -0
- package/lib/cache/adapters/redis.d.ts +35 -0
- package/lib/cache/adapters/redis.js +180 -0
- package/lib/cache/adapters/types.d.ts +25 -0
- package/lib/cache/adapters/types.js +2 -0
- package/lib/cache/adapters/workeradapter.d.ts +24 -0
- package/lib/cache/adapters/workeradapter.js +76 -0
- package/lib/cache/index.d.ts +97 -0
- package/lib/cache/index.js +394 -0
- package/lib/cache/resources/channels.d.ts +7 -0
- package/lib/cache/resources/channels.js +20 -0
- package/lib/cache/resources/default/base.d.ts +25 -0
- package/lib/cache/resources/default/base.js +75 -0
- package/lib/cache/resources/default/guild-based.d.ts +33 -0
- package/lib/cache/resources/default/guild-based.js +91 -0
- package/lib/cache/resources/default/guild-related.d.ts +32 -0
- package/lib/cache/resources/default/guild-related.js +102 -0
- package/lib/cache/resources/emojis.d.ts +7 -0
- package/lib/cache/resources/emojis.js +17 -0
- package/lib/cache/resources/guilds.d.ts +10 -0
- package/lib/cache/resources/guilds.js +117 -0
- package/lib/cache/resources/members.d.ts +10 -0
- package/lib/cache/resources/members.js +41 -0
- package/lib/cache/resources/presence.d.ts +9 -0
- package/lib/cache/resources/presence.js +14 -0
- package/lib/cache/resources/roles.d.ts +7 -0
- package/lib/cache/resources/roles.js +17 -0
- package/lib/cache/resources/stage-instances.d.ts +5 -0
- package/lib/cache/resources/stage-instances.js +8 -0
- package/lib/cache/resources/stickers.d.ts +7 -0
- package/lib/cache/resources/stickers.js +17 -0
- package/lib/cache/resources/threads.d.ts +7 -0
- package/lib/cache/resources/threads.js +17 -0
- package/lib/cache/resources/users.d.ts +7 -0
- package/lib/cache/resources/users.js +17 -0
- package/lib/cache/resources/voice-states.d.ts +9 -0
- package/lib/cache/resources/voice-states.js +13 -0
- package/lib/client/base.d.ts +244 -0
- package/lib/client/base.js +178 -0
- package/lib/client/client.d.ts +32 -0
- package/lib/client/client.js +156 -0
- package/lib/client/httpclient.d.ts +21 -0
- package/lib/client/httpclient.js +143 -0
- package/lib/client/index.d.ts +4 -0
- package/lib/client/index.js +19 -0
- package/lib/client/oninteraction.d.ts +4 -0
- package/lib/client/oninteraction.js +180 -0
- package/lib/client/workerclient.d.ts +28 -0
- package/lib/client/workerclient.js +213 -0
- package/lib/collection.d.ts +233 -0
- package/lib/collection.js +371 -0
- package/lib/commands/applications/chat.d.ts +139 -0
- package/lib/commands/applications/chat.js +173 -0
- package/lib/commands/applications/chatcontext.d.ts +28 -0
- package/lib/commands/applications/chatcontext.js +53 -0
- package/lib/commands/applications/menu.d.ts +39 -0
- package/lib/commands/applications/menu.js +87 -0
- package/lib/commands/applications/menucontext.d.ts +25 -0
- package/lib/commands/applications/menucontext.js +64 -0
- package/lib/commands/applications/options.d.ts +67 -0
- package/lib/commands/applications/options.js +44 -0
- package/lib/commands/applications/shared.d.ts +35 -0
- package/lib/commands/applications/shared.js +2 -0
- package/lib/commands/decorators.d.ts +107 -0
- package/lib/commands/decorators.js +85 -0
- package/lib/commands/handler.d.ts +15 -0
- package/lib/commands/handler.js +140 -0
- package/lib/commands/index.d.ts +8 -0
- package/lib/commands/index.js +24 -0
- package/lib/commands/optionresolver.d.ts +49 -0
- package/lib/commands/optionresolver.js +146 -0
- package/lib/common/bot/watcher.d.ts +53 -0
- package/lib/common/bot/watcher.js +104 -0
- package/lib/common/index.d.ts +13 -0
- package/lib/common/index.js +30 -0
- package/lib/common/it/colors.d.ts +274 -0
- package/lib/common/it/colors.js +453 -0
- package/lib/common/it/constants.d.ts +36 -0
- package/lib/common/it/constants.js +40 -0
- package/lib/common/it/logger.d.ts +114 -0
- package/lib/common/it/logger.js +189 -0
- package/lib/common/it/utils.d.ts +107 -0
- package/lib/common/it/utils.js +275 -0
- package/lib/common/shorters/base.d.ts +5 -0
- package/lib/common/shorters/base.js +10 -0
- package/lib/common/shorters/channels.d.ts +90 -0
- package/lib/common/shorters/channels.js +95 -0
- package/lib/common/shorters/guilds.d.ts +389 -0
- package/lib/common/shorters/guilds.js +350 -0
- package/lib/common/shorters/members.d.ts +115 -0
- package/lib/common/shorters/members.js +179 -0
- package/lib/common/shorters/messages.d.ts +27 -0
- package/lib/common/shorters/messages.js +117 -0
- package/lib/common/shorters/roles.d.ts +12 -0
- package/lib/common/shorters/roles.js +51 -0
- package/lib/common/shorters/templates.d.ts +12 -0
- package/lib/common/shorters/templates.js +29 -0
- package/lib/common/shorters/users.d.ts +11 -0
- package/lib/common/shorters/users.js +42 -0
- package/lib/common/shorters/webhook.d.ts +33 -0
- package/lib/common/shorters/webhook.js +69 -0
- package/lib/common/types/options.d.ts +10 -0
- package/lib/common/types/options.js +2 -0
- package/lib/common/types/resolvables.d.ts +10 -0
- package/lib/common/types/resolvables.js +2 -0
- package/lib/common/types/util.d.ts +90 -0
- package/lib/common/types/util.js +2 -0
- package/lib/common/types/write.d.ts +21 -0
- package/lib/common/types/write.js +2 -0
- package/lib/components/ActionRow.d.ts +10 -0
- package/lib/components/ActionRow.js +13 -0
- package/lib/components/ButtonComponent.d.ts +19 -0
- package/lib/components/ButtonComponent.js +34 -0
- package/lib/components/ChannelSelectMenuComponent.d.ts +6 -0
- package/lib/components/ChannelSelectMenuComponent.js +12 -0
- package/lib/components/MentionableSelectMenuComponent.d.ts +4 -0
- package/lib/components/MentionableSelectMenuComponent.js +7 -0
- package/lib/components/RoleSelectMenuComponent.d.ts +4 -0
- package/lib/components/RoleSelectMenuComponent.js +7 -0
- package/lib/components/StringSelectMenuComponent.d.ts +6 -0
- package/lib/components/StringSelectMenuComponent.js +12 -0
- package/lib/components/TextInputComponent.d.ts +7 -0
- package/lib/components/TextInputComponent.js +14 -0
- package/lib/components/UserSelectMenuComponent.d.ts +4 -0
- package/lib/components/UserSelectMenuComponent.js +7 -0
- package/lib/components/command.d.ts +23 -0
- package/lib/components/command.js +15 -0
- package/lib/components/handler.d.ts +48 -0
- package/lib/components/handler.js +231 -0
- package/lib/components/index.d.ts +20 -0
- package/lib/components/index.js +55 -0
- package/lib/components/listener.d.ts +11 -0
- package/lib/components/listener.js +18 -0
- package/lib/events/event.d.ts +23 -0
- package/lib/events/event.js +2 -0
- package/lib/events/handler.d.ts +19 -0
- package/lib/events/handler.js +112 -0
- package/lib/events/hooks/application_command.d.ts +12 -0
- package/lib/events/hooks/application_command.js +8 -0
- package/lib/events/hooks/auto_moderation.d.ts +22 -0
- package/lib/events/hooks/auto_moderation.js +21 -0
- package/lib/events/hooks/channel.d.ts +11 -0
- package/lib/events/hooks/channel.js +24 -0
- package/lib/events/hooks/custom.d.ts +4 -0
- package/lib/events/hooks/custom.js +11 -0
- package/lib/events/hooks/dispatch.d.ts +5 -0
- package/lib/events/hooks/dispatch.js +12 -0
- package/lib/events/hooks/entitlement.d.ts +35 -0
- package/lib/events/hooks/entitlement.js +16 -0
- package/lib/events/hooks/guild.d.ts +228 -0
- package/lib/events/hooks/guild.js +101 -0
- package/lib/events/hooks/index.d.ts +23 -0
- package/lib/events/hooks/index.js +34 -0
- package/lib/events/hooks/integration.d.ts +94 -0
- package/lib/events/hooks/integration.js +27 -0
- package/lib/events/hooks/interactions.d.ts +4 -0
- package/lib/events/hooks/interactions.js +8 -0
- package/lib/events/hooks/invite.d.ts +21 -0
- package/lib/events/hooks/invite.js +12 -0
- package/lib/events/hooks/message.d.ts +69 -0
- package/lib/events/hooks/message.js +37 -0
- package/lib/events/hooks/presence.d.ts +27 -0
- package/lib/events/hooks/presence.js +8 -0
- package/lib/events/hooks/stage.d.ts +29 -0
- package/lib/events/hooks/stage.js +16 -0
- package/lib/events/hooks/thread.d.ts +198 -0
- package/lib/events/hooks/thread.js +29 -0
- package/lib/events/hooks/typing.d.ts +16 -0
- package/lib/events/hooks/typing.js +14 -0
- package/lib/events/hooks/user.d.ts +4 -0
- package/lib/events/hooks/user.js +8 -0
- package/lib/events/hooks/voice.d.ts +37 -0
- package/lib/events/hooks/voice.js +18 -0
- package/lib/events/hooks/webhook.d.ts +6 -0
- package/lib/events/hooks/webhook.js +8 -0
- package/lib/events/index.d.ts +2 -0
- package/lib/events/index.js +18 -0
- package/lib/index.d.ts +79 -0
- package/lib/index.js +104 -0
- package/lib/langs/handler.d.ts +11 -0
- package/lib/langs/handler.js +34 -0
- package/lib/langs/index.d.ts +2 -0
- package/lib/langs/index.js +18 -0
- package/lib/langs/router.d.ts +18 -0
- package/lib/langs/router.js +42 -0
- package/lib/structures/AnonymousGuild.d.ts +7 -0
- package/lib/structures/AnonymousGuild.js +11 -0
- package/lib/structures/AutoModerationRule.d.ts +22 -0
- package/lib/structures/AutoModerationRule.js +34 -0
- package/lib/structures/ClientUser.d.ts +25 -0
- package/lib/structures/ClientUser.js +52 -0
- package/lib/structures/Guild.d.ts +86 -0
- package/lib/structures/Guild.js +66 -0
- package/lib/structures/GuildEmoji.d.ts +29 -0
- package/lib/structures/GuildEmoji.js +47 -0
- package/lib/structures/GuildMember.d.ts +92 -0
- package/lib/structures/GuildMember.js +137 -0
- package/lib/structures/GuildPreview.d.ts +10 -0
- package/lib/structures/GuildPreview.js +14 -0
- package/lib/structures/GuildRole.d.ts +21 -0
- package/lib/structures/GuildRole.js +32 -0
- package/lib/structures/GuildTemplate.d.ts +23 -0
- package/lib/structures/GuildTemplate.js +36 -0
- package/lib/structures/Interaction.d.ts +152 -0
- package/lib/structures/Interaction.js +409 -0
- package/lib/structures/Message.d.ts +53 -0
- package/lib/structures/Message.js +123 -0
- package/lib/structures/Sticker.d.ts +27 -0
- package/lib/structures/Sticker.js +44 -0
- package/lib/structures/User.d.ts +20 -0
- package/lib/structures/User.js +37 -0
- package/lib/structures/Webhook.d.ts +42 -0
- package/lib/structures/Webhook.js +63 -0
- package/lib/structures/channels.d.ts +232 -0
- package/lib/structures/channels.js +366 -0
- package/lib/structures/extra/Base.d.ts +7 -0
- package/lib/structures/extra/Base.js +39 -0
- package/lib/structures/extra/BaseComponent.d.ts +9 -0
- package/lib/structures/extra/BaseComponent.js +12 -0
- package/lib/structures/extra/BaseGuild.d.ts +40 -0
- package/lib/structures/extra/BaseGuild.js +71 -0
- package/lib/structures/extra/BaseSelectMenuComponent.d.ts +9 -0
- package/lib/structures/extra/BaseSelectMenuComponent.js +13 -0
- package/lib/structures/extra/BitField.d.ts +14 -0
- package/lib/structures/extra/BitField.js +56 -0
- package/lib/structures/extra/DiscordBase.d.ts +18 -0
- package/lib/structures/extra/DiscordBase.js +28 -0
- package/lib/structures/extra/Permissions.d.ts +54 -0
- package/lib/structures/extra/Permissions.js +9 -0
- package/lib/structures/extra/functions.d.ts +11 -0
- package/lib/structures/extra/functions.js +69 -0
- package/lib/structures/index.d.ts +15 -0
- package/lib/structures/index.js +31 -0
- package/lib/websocket/SharedTypes.d.ts +128 -0
- package/lib/websocket/SharedTypes.js +2 -0
- package/lib/websocket/constants/index.d.ts +26 -0
- package/lib/websocket/constants/index.js +31 -0
- package/lib/websocket/discord/basesocket.d.ts +12 -0
- package/lib/websocket/discord/basesocket.js +37 -0
- package/lib/websocket/discord/events/memberUpdate.d.ts +16 -0
- package/lib/websocket/discord/events/memberUpdate.js +47 -0
- package/lib/websocket/discord/events/presenceUpdate.d.ts +24 -0
- package/lib/websocket/discord/events/presenceUpdate.js +46 -0
- package/lib/websocket/discord/handlemessage.d.ts +0 -0
- package/lib/websocket/discord/handlemessage.js +1 -0
- package/lib/websocket/discord/index.d.ts +4 -0
- package/lib/websocket/discord/index.js +20 -0
- package/lib/websocket/discord/memberUpdate.d.ts +16 -0
- package/lib/websocket/discord/memberUpdate.js +47 -0
- package/lib/websocket/discord/shard.d.ts +46 -0
- package/lib/websocket/discord/shard.js +278 -0
- package/lib/websocket/discord/sharder.d.ts +25 -0
- package/lib/websocket/discord/sharder.js +153 -0
- package/lib/websocket/discord/shared.d.ts +99 -0
- package/lib/websocket/discord/shared.js +8 -0
- package/lib/websocket/discord/worker.d.ts +43 -0
- package/lib/websocket/discord/worker.js +2 -0
- package/lib/websocket/discord/workermanager.d.ts +69 -0
- package/lib/websocket/discord/workermanager.js +273 -0
- package/lib/websocket/index.d.ts +3 -0
- package/lib/websocket/index.js +19 -0
- package/lib/websocket/structures/index.d.ts +117 -0
- package/lib/websocket/structures/index.js +261 -0
- package/lib/websocket/structures/timeout.d.ts +20 -0
- package/lib/websocket/structures/timeout.js +75 -0
- package/package.json +70 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ActionRow = void 0;
|
|
4
|
+
const common_1 = require("../common");
|
|
5
|
+
const Base_1 = require("./Base");
|
|
6
|
+
const index_1 = require("./index");
|
|
7
|
+
/**
|
|
8
|
+
* Represents an Action Row component in a message.
|
|
9
|
+
* @template T - The type of components in the Action Row.
|
|
10
|
+
*/
|
|
11
|
+
class ActionRow extends Base_1.BaseComponentBuilder {
|
|
12
|
+
/**
|
|
13
|
+
* Creates a new instance of the ActionRow class.
|
|
14
|
+
* @param data - Optional data to initialize the Action Row.
|
|
15
|
+
* @example
|
|
16
|
+
* const actionRow = new ActionRow<Button>({ components: [buttonRawJSON] });
|
|
17
|
+
*/
|
|
18
|
+
constructor({ components, ...data } = {}) {
|
|
19
|
+
super({ ...data, type: common_1.ComponentType.ActionRow });
|
|
20
|
+
this.components = (components?.map(index_1.fromComponent) ?? []);
|
|
21
|
+
}
|
|
22
|
+
components;
|
|
23
|
+
/**
|
|
24
|
+
* Adds one or more components to the Action Row.
|
|
25
|
+
* @param component - The component(s) to add.
|
|
26
|
+
* @returns The updated Action Row instance.
|
|
27
|
+
* @example
|
|
28
|
+
* actionRow.addComponents(buttonComponent);
|
|
29
|
+
* actionRow.addComponents(buttonComponent1, buttonComponent2);
|
|
30
|
+
* actionRow.addComponents([buttonComponent1, buttonComponent2]);
|
|
31
|
+
*/
|
|
32
|
+
addComponents(...component) {
|
|
33
|
+
this.components = this.components.concat((0, common_1.fastFlat)(component));
|
|
34
|
+
return this;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Sets the components of the Action Row.
|
|
38
|
+
* @param component - The components to set.
|
|
39
|
+
* @returns The updated Action Row instance.
|
|
40
|
+
* @example
|
|
41
|
+
* actionRow.setComponents([buttonComponent1, buttonComponent2]);
|
|
42
|
+
*/
|
|
43
|
+
setComponents(component) {
|
|
44
|
+
this.components = [...component];
|
|
45
|
+
return this;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Converts the Action Row to its JSON representation.
|
|
49
|
+
* @returns The JSON representation of the Action Row.
|
|
50
|
+
*/
|
|
51
|
+
toJSON() {
|
|
52
|
+
const components = this.components.map(c => {
|
|
53
|
+
return c.toJSON();
|
|
54
|
+
});
|
|
55
|
+
return { type: common_1.ComponentType.ActionRow, components };
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
exports.ActionRow = ActionRow;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import type { RESTAPIAttachment } from 'discord-api-types/v10';
|
|
3
|
+
import { type RawFile } from '..';
|
|
4
|
+
import type { ImageResolvable } from '../common';
|
|
5
|
+
export interface AttachmentResolvableMap {
|
|
6
|
+
url: string;
|
|
7
|
+
buffer: Buffer;
|
|
8
|
+
path: string;
|
|
9
|
+
}
|
|
10
|
+
export type AttachmentResolvable = AttachmentResolvableMap[keyof AttachmentResolvableMap] | Attachment;
|
|
11
|
+
export type AttachmentDataType = keyof AttachmentResolvableMap;
|
|
12
|
+
export interface AttachmentData {
|
|
13
|
+
name: string;
|
|
14
|
+
description: string;
|
|
15
|
+
resolvable: AttachmentResolvable;
|
|
16
|
+
type: AttachmentDataType;
|
|
17
|
+
}
|
|
18
|
+
export declare class Attachment {
|
|
19
|
+
data: Partial<AttachmentData>;
|
|
20
|
+
/**
|
|
21
|
+
* Creates a new Attachment instance.
|
|
22
|
+
* @param data - The partial attachment data.
|
|
23
|
+
*/
|
|
24
|
+
constructor(data?: Partial<AttachmentData>);
|
|
25
|
+
/**
|
|
26
|
+
* Sets the name of the attachment.
|
|
27
|
+
* @param name - The name of the attachment.
|
|
28
|
+
* @returns The Attachment instance.
|
|
29
|
+
* @example
|
|
30
|
+
* attachment.setName('example.jpg');
|
|
31
|
+
*/
|
|
32
|
+
setName(name: string): this;
|
|
33
|
+
/**
|
|
34
|
+
* Sets the description of the attachment.
|
|
35
|
+
* @param desc - The description of the attachment.
|
|
36
|
+
* @returns The Attachment instance.
|
|
37
|
+
* @example
|
|
38
|
+
* attachment.setDescription('This is an example attachment');
|
|
39
|
+
*/
|
|
40
|
+
setDescription(desc: string): this;
|
|
41
|
+
/**
|
|
42
|
+
* Sets the file data of the attachment.
|
|
43
|
+
* @param type - The type of the attachment data.
|
|
44
|
+
* @param data - The resolvable data of the attachment.
|
|
45
|
+
* @returns The Attachment instance.
|
|
46
|
+
* @example
|
|
47
|
+
* attachment.setFile('url', 'https://example.com/example.jpg');
|
|
48
|
+
* attachment.setFile('path', '../assets/example.jpg');
|
|
49
|
+
* attachment.setFile('buffer', Buffer.from(image.decode()));
|
|
50
|
+
*/
|
|
51
|
+
setFile<T extends AttachmentDataType = AttachmentDataType>(type: T, data: AttachmentResolvableMap[T]): this;
|
|
52
|
+
/**
|
|
53
|
+
* Sets whether the attachment is a spoiler.
|
|
54
|
+
* @param spoiler - Whether the attachment is a spoiler.
|
|
55
|
+
* @returns The Attachment instance.
|
|
56
|
+
* @example
|
|
57
|
+
* attachment.setSpoiler(true);
|
|
58
|
+
*/
|
|
59
|
+
setSpoiler(spoiler: boolean): this;
|
|
60
|
+
/**
|
|
61
|
+
* Gets whether the attachment is a spoiler.
|
|
62
|
+
*/
|
|
63
|
+
get spoiler(): boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Converts the Attachment instance to JSON.
|
|
66
|
+
* @returns The JSON representation of the Attachment instance.
|
|
67
|
+
*/
|
|
68
|
+
toJSON(): AttachmentData;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Resolves an attachment to a REST API attachment.
|
|
72
|
+
* @param resolve - The attachment or attachment data to resolve.
|
|
73
|
+
* @returns The resolved REST API attachment.
|
|
74
|
+
*/
|
|
75
|
+
export declare function resolveAttachment(resolve: Attachment | AttachmentData | RESTAPIAttachment): Omit<RESTAPIAttachment, 'id'>;
|
|
76
|
+
/**
|
|
77
|
+
* Resolves a list of attachments to raw files.
|
|
78
|
+
* @param resources - The list of attachments to resolve.
|
|
79
|
+
* @returns The resolved raw files.
|
|
80
|
+
*/
|
|
81
|
+
export declare function resolveFiles(resources: (Attachment | RawFile)[]): Promise<RawFile[]>;
|
|
82
|
+
/**
|
|
83
|
+
* Resolves the data of an attachment.
|
|
84
|
+
* @param data - The resolvable data of the attachment.
|
|
85
|
+
* @param type - The type of the attachment data.
|
|
86
|
+
* @returns The resolved attachment data.
|
|
87
|
+
*/
|
|
88
|
+
export declare function resolveAttachmentData(data: AttachmentResolvable, type: AttachmentDataType): Promise<{
|
|
89
|
+
data: AttachmentResolvable;
|
|
90
|
+
contentType?: undefined;
|
|
91
|
+
} | {
|
|
92
|
+
data: Buffer;
|
|
93
|
+
contentType: string | null;
|
|
94
|
+
}>;
|
|
95
|
+
/**
|
|
96
|
+
* Resolves a base64 data to a data URL.
|
|
97
|
+
* @param data - The base64 data.
|
|
98
|
+
* @returns The resolved data URL.
|
|
99
|
+
*/
|
|
100
|
+
export declare function resolveBase64(data: string | Buffer): string;
|
|
101
|
+
/**
|
|
102
|
+
* Resolves an image to a base64 data URL.
|
|
103
|
+
* @param image - The image to resolve.
|
|
104
|
+
* @returns The resolved base64 data URL.
|
|
105
|
+
*/
|
|
106
|
+
export declare function resolveImage(image: ImageResolvable): Promise<string>;
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.resolveImage = exports.resolveBase64 = exports.resolveAttachmentData = exports.resolveFiles = exports.resolveAttachment = exports.Attachment = void 0;
|
|
7
|
+
const node_crypto_1 = require("node:crypto");
|
|
8
|
+
const promises_1 = require("node:fs/promises");
|
|
9
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
10
|
+
const __1 = require("..");
|
|
11
|
+
class Attachment {
|
|
12
|
+
data;
|
|
13
|
+
/**
|
|
14
|
+
* Creates a new Attachment instance.
|
|
15
|
+
* @param data - The partial attachment data.
|
|
16
|
+
*/
|
|
17
|
+
constructor(data = { name: `${(0, node_crypto_1.randomBytes)(8).toString('base64url')}.jpg` }) {
|
|
18
|
+
this.data = data;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Sets the name of the attachment.
|
|
22
|
+
* @param name - The name of the attachment.
|
|
23
|
+
* @returns The Attachment instance.
|
|
24
|
+
* @example
|
|
25
|
+
* attachment.setName('example.jpg');
|
|
26
|
+
*/
|
|
27
|
+
setName(name) {
|
|
28
|
+
this.data.name = name;
|
|
29
|
+
return this;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Sets the description of the attachment.
|
|
33
|
+
* @param desc - The description of the attachment.
|
|
34
|
+
* @returns The Attachment instance.
|
|
35
|
+
* @example
|
|
36
|
+
* attachment.setDescription('This is an example attachment');
|
|
37
|
+
*/
|
|
38
|
+
setDescription(desc) {
|
|
39
|
+
this.data.description = desc;
|
|
40
|
+
return this;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Sets the file data of the attachment.
|
|
44
|
+
* @param type - The type of the attachment data.
|
|
45
|
+
* @param data - The resolvable data of the attachment.
|
|
46
|
+
* @returns The Attachment instance.
|
|
47
|
+
* @example
|
|
48
|
+
* attachment.setFile('url', 'https://example.com/example.jpg');
|
|
49
|
+
* attachment.setFile('path', '../assets/example.jpg');
|
|
50
|
+
* attachment.setFile('buffer', Buffer.from(image.decode()));
|
|
51
|
+
*/
|
|
52
|
+
setFile(type, data) {
|
|
53
|
+
this.data.type = type;
|
|
54
|
+
this.data.resolvable = data;
|
|
55
|
+
return this;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Sets whether the attachment is a spoiler.
|
|
59
|
+
* @param spoiler - Whether the attachment is a spoiler.
|
|
60
|
+
* @returns The Attachment instance.
|
|
61
|
+
* @example
|
|
62
|
+
* attachment.setSpoiler(true);
|
|
63
|
+
*/
|
|
64
|
+
setSpoiler(spoiler) {
|
|
65
|
+
if (spoiler === this.spoiler)
|
|
66
|
+
return this;
|
|
67
|
+
if (!spoiler) {
|
|
68
|
+
this.data.name = this.data.name.slice('SPOILER_'.length);
|
|
69
|
+
return this;
|
|
70
|
+
}
|
|
71
|
+
this.data.name = `SPOILER_${this.data.name}`;
|
|
72
|
+
return this;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Gets whether the attachment is a spoiler.
|
|
76
|
+
*/
|
|
77
|
+
get spoiler() {
|
|
78
|
+
return this.data.name?.startsWith('SPOILER_') ?? false;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Converts the Attachment instance to JSON.
|
|
82
|
+
* @returns The JSON representation of the Attachment instance.
|
|
83
|
+
*/
|
|
84
|
+
toJSON() {
|
|
85
|
+
return this.data;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
exports.Attachment = Attachment;
|
|
89
|
+
/**
|
|
90
|
+
* Resolves an attachment to a REST API attachment.
|
|
91
|
+
* @param resolve - The attachment or attachment data to resolve.
|
|
92
|
+
* @returns The resolved REST API attachment.
|
|
93
|
+
*/
|
|
94
|
+
function resolveAttachment(resolve) {
|
|
95
|
+
if ('id' in resolve)
|
|
96
|
+
return resolve;
|
|
97
|
+
if (resolve instanceof Attachment) {
|
|
98
|
+
const data = resolve.toJSON();
|
|
99
|
+
return { filename: data.name, description: data.description };
|
|
100
|
+
}
|
|
101
|
+
return { filename: resolve.name, description: resolve.description };
|
|
102
|
+
}
|
|
103
|
+
exports.resolveAttachment = resolveAttachment;
|
|
104
|
+
/**
|
|
105
|
+
* Resolves a list of attachments to raw files.
|
|
106
|
+
* @param resources - The list of attachments to resolve.
|
|
107
|
+
* @returns The resolved raw files.
|
|
108
|
+
*/
|
|
109
|
+
async function resolveFiles(resources) {
|
|
110
|
+
const data = await Promise.all(resources.map(async (resource, i) => {
|
|
111
|
+
if (resource instanceof Attachment) {
|
|
112
|
+
const { type, resolvable, name } = resource.toJSON();
|
|
113
|
+
const resolve = await resolveAttachmentData(resolvable, type);
|
|
114
|
+
return { ...resolve, key: `files[${i}]`, name };
|
|
115
|
+
}
|
|
116
|
+
return {
|
|
117
|
+
data: resource.data,
|
|
118
|
+
contentType: resource.contentType,
|
|
119
|
+
key: `files[${i}]`,
|
|
120
|
+
name: resource.name,
|
|
121
|
+
};
|
|
122
|
+
}));
|
|
123
|
+
return data;
|
|
124
|
+
}
|
|
125
|
+
exports.resolveFiles = resolveFiles;
|
|
126
|
+
/**
|
|
127
|
+
* Resolves the data of an attachment.
|
|
128
|
+
* @param data - The resolvable data of the attachment.
|
|
129
|
+
* @param type - The type of the attachment data.
|
|
130
|
+
* @returns The resolved attachment data.
|
|
131
|
+
*/
|
|
132
|
+
async function resolveAttachmentData(data, type) {
|
|
133
|
+
if (data instanceof Attachment) {
|
|
134
|
+
if (!data.data.resolvable)
|
|
135
|
+
return (0, __1.throwError)('The attachment type has been expressed as attachment but cannot be resolved as one.');
|
|
136
|
+
return { data: data.data.resolvable };
|
|
137
|
+
}
|
|
138
|
+
switch (type) {
|
|
139
|
+
case 'url': {
|
|
140
|
+
if (!/^https?:\/\//.test(data))
|
|
141
|
+
return (0, __1.throwError)(`The attachment type has been expressed as ${type.toUpperCase()} but cannot be resolved as one.`);
|
|
142
|
+
const res = await fetch(data);
|
|
143
|
+
return { data: Buffer.from(await res.arrayBuffer()), contentType: res.headers.get('content-type') };
|
|
144
|
+
}
|
|
145
|
+
case 'path': {
|
|
146
|
+
const file = node_path_1.default.resolve(data);
|
|
147
|
+
const stats = await (0, promises_1.stat)(file);
|
|
148
|
+
if (!stats.isFile())
|
|
149
|
+
return (0, __1.throwError)(`The attachment type has been expressed as ${type.toUpperCase()} but cannot be resolved as one.`);
|
|
150
|
+
return { data: await (0, promises_1.readFile)(file) };
|
|
151
|
+
}
|
|
152
|
+
case 'buffer': {
|
|
153
|
+
if (Buffer.isBuffer(data))
|
|
154
|
+
return { data };
|
|
155
|
+
// @ts-expect-error
|
|
156
|
+
if (typeof data[Symbol.asyncIterator] === 'function') {
|
|
157
|
+
const buffers = [];
|
|
158
|
+
for await (const resource of data)
|
|
159
|
+
buffers.push(Buffer.from(resource));
|
|
160
|
+
return { data: Buffer.concat(buffers) };
|
|
161
|
+
}
|
|
162
|
+
return (0, __1.throwError)(`The attachment type has been expressed as ${type.toUpperCase()} but cannot be resolved as one.`);
|
|
163
|
+
}
|
|
164
|
+
default: {
|
|
165
|
+
return (0, __1.throwError)(`The attachment type has been expressed as ${type} but cannot be resolved as one.`);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
exports.resolveAttachmentData = resolveAttachmentData;
|
|
170
|
+
/**
|
|
171
|
+
* Resolves a base64 data to a data URL.
|
|
172
|
+
* @param data - The base64 data.
|
|
173
|
+
* @returns The resolved data URL.
|
|
174
|
+
*/
|
|
175
|
+
function resolveBase64(data) {
|
|
176
|
+
if (Buffer.isBuffer(data))
|
|
177
|
+
return `data:image/jpg;base64,${data.toString('base64')}`;
|
|
178
|
+
return data;
|
|
179
|
+
}
|
|
180
|
+
exports.resolveBase64 = resolveBase64;
|
|
181
|
+
/**
|
|
182
|
+
* Resolves an image to a base64 data URL.
|
|
183
|
+
* @param image - The image to resolve.
|
|
184
|
+
* @returns The resolved base64 data URL.
|
|
185
|
+
*/
|
|
186
|
+
async function resolveImage(image) {
|
|
187
|
+
if (image instanceof Attachment) {
|
|
188
|
+
const { data: { type, resolvable }, } = image;
|
|
189
|
+
if (type && resolvable)
|
|
190
|
+
return resolveBase64((await resolveAttachmentData(resolvable, type)).data);
|
|
191
|
+
return (0, __1.throwError)(`The attachment type has been expressed as ${(type ?? 'Attachment').toUpperCase()} but cannot be resolved as one.`);
|
|
192
|
+
}
|
|
193
|
+
const file = await resolveAttachmentData(image.data, image.type);
|
|
194
|
+
return resolveBase64(file.data);
|
|
195
|
+
}
|
|
196
|
+
exports.resolveImage = resolveImage;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { APIBaseComponent, ComponentType } from '../common';
|
|
2
|
+
export declare abstract class BaseComponentBuilder<TYPE extends Partial<APIBaseComponent<ComponentType>> = APIBaseComponent<ComponentType>> {
|
|
3
|
+
data: Partial<TYPE>;
|
|
4
|
+
constructor(data: Partial<TYPE>);
|
|
5
|
+
toJSON(): TYPE;
|
|
6
|
+
}
|
|
7
|
+
export type OptionValuesLength = {
|
|
8
|
+
max: number;
|
|
9
|
+
min: number;
|
|
10
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BaseComponentBuilder = void 0;
|
|
4
|
+
class BaseComponentBuilder {
|
|
5
|
+
data;
|
|
6
|
+
constructor(data) {
|
|
7
|
+
this.data = data;
|
|
8
|
+
}
|
|
9
|
+
toJSON() {
|
|
10
|
+
return { ...this.data };
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.BaseComponentBuilder = BaseComponentBuilder;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { type APIButtonComponent, type APIButtonComponentWithCustomId, type APIButtonComponentWithURL, type ButtonStyle, type EmojiResolvable, type When } from '../common';
|
|
2
|
+
import type { ButtonInteraction } from '../structures';
|
|
3
|
+
import type { ComponentCallback } from './types';
|
|
4
|
+
export type ButtonStylesForID = Exclude<ButtonStyle, ButtonStyle.Link>;
|
|
5
|
+
/**
|
|
6
|
+
* Represents a button component.
|
|
7
|
+
* @template Type - The type of the button component.
|
|
8
|
+
*/
|
|
9
|
+
export declare class Button<Type extends boolean = boolean> {
|
|
10
|
+
data: Partial<When<Type, APIButtonComponentWithCustomId, APIButtonComponentWithURL>>;
|
|
11
|
+
/**
|
|
12
|
+
* Creates a new Button instance.
|
|
13
|
+
* @param data - The initial data for the button.
|
|
14
|
+
*/
|
|
15
|
+
constructor(data?: Partial<When<Type, APIButtonComponentWithCustomId, APIButtonComponentWithURL>>);
|
|
16
|
+
/**
|
|
17
|
+
* Sets the custom ID for the button.
|
|
18
|
+
* @param id - The custom ID to set.
|
|
19
|
+
* @returns The modified Button instance.
|
|
20
|
+
*/
|
|
21
|
+
setCustomId(id: string): Omit<this, 'setURL'>;
|
|
22
|
+
/**
|
|
23
|
+
* Sets the URL for the button.
|
|
24
|
+
* @param url - The URL to set.
|
|
25
|
+
* @returns The modified Button instance.
|
|
26
|
+
*/
|
|
27
|
+
setURL(url: string): Omit<this, 'setCustomId' | 'run'>;
|
|
28
|
+
/**
|
|
29
|
+
* Sets the label for the button.
|
|
30
|
+
* @param label - The label to set.
|
|
31
|
+
* @returns The modified Button instance.
|
|
32
|
+
*/
|
|
33
|
+
setLabel(label: string): this;
|
|
34
|
+
/**
|
|
35
|
+
* Sets the emoji for the button.
|
|
36
|
+
* @param emoji - The emoji to set.
|
|
37
|
+
* @returns The modified Button instance.
|
|
38
|
+
*/
|
|
39
|
+
setEmoji(emoji: EmojiResolvable): this;
|
|
40
|
+
/**
|
|
41
|
+
* Sets the disabled state of the button.
|
|
42
|
+
* @param disabled - Whether the button should be disabled or not.
|
|
43
|
+
* @returns The modified Button instance.
|
|
44
|
+
*/
|
|
45
|
+
setDisabled(disabled?: boolean): this;
|
|
46
|
+
setStyle(style: ButtonStyle.Link): Omit<this, 'setCustomId' | 'run'>;
|
|
47
|
+
setStyle(style: ButtonStylesForID): Omit<this, 'setURL'>;
|
|
48
|
+
/**
|
|
49
|
+
* Sets the callback function to be executed when the button is interacted with.
|
|
50
|
+
* @param func - The callback function to set.
|
|
51
|
+
* @returns The modified Button instance.
|
|
52
|
+
*/
|
|
53
|
+
run(func: ComponentCallback<ButtonInteraction>): Omit<this, 'setURL'>;
|
|
54
|
+
/**
|
|
55
|
+
* Converts the Button instance to its JSON representation.
|
|
56
|
+
* @returns The JSON representation of the Button instance.
|
|
57
|
+
*/
|
|
58
|
+
toJSON(): APIButtonComponent;
|
|
59
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Button = void 0;
|
|
4
|
+
const __1 = require("..");
|
|
5
|
+
const common_1 = require("../common");
|
|
6
|
+
const functions_1 = require("../structures/extra/functions");
|
|
7
|
+
/**
|
|
8
|
+
* Represents a button component.
|
|
9
|
+
* @template Type - The type of the button component.
|
|
10
|
+
*/
|
|
11
|
+
class Button {
|
|
12
|
+
data;
|
|
13
|
+
/** @internal */
|
|
14
|
+
__exec;
|
|
15
|
+
/**
|
|
16
|
+
* Creates a new Button instance.
|
|
17
|
+
* @param data - The initial data for the button.
|
|
18
|
+
*/
|
|
19
|
+
constructor(data = {}) {
|
|
20
|
+
this.data = data;
|
|
21
|
+
this.data.type = common_1.ComponentType.Button;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Sets the custom ID for the button.
|
|
25
|
+
* @param id - The custom ID to set.
|
|
26
|
+
* @returns The modified Button instance.
|
|
27
|
+
*/
|
|
28
|
+
setCustomId(id) {
|
|
29
|
+
// @ts-expect-error
|
|
30
|
+
this.data.custom_id = id;
|
|
31
|
+
return this;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Sets the URL for the button.
|
|
35
|
+
* @param url - The URL to set.
|
|
36
|
+
* @returns The modified Button instance.
|
|
37
|
+
*/
|
|
38
|
+
setURL(url) {
|
|
39
|
+
// @ts-expect-error
|
|
40
|
+
this.data.url = url;
|
|
41
|
+
return this;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Sets the label for the button.
|
|
45
|
+
* @param label - The label to set.
|
|
46
|
+
* @returns The modified Button instance.
|
|
47
|
+
*/
|
|
48
|
+
setLabel(label) {
|
|
49
|
+
this.data.label = label;
|
|
50
|
+
return this;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Sets the emoji for the button.
|
|
54
|
+
* @param emoji - The emoji to set.
|
|
55
|
+
* @returns The modified Button instance.
|
|
56
|
+
*/
|
|
57
|
+
setEmoji(emoji) {
|
|
58
|
+
const resolve = (0, functions_1.resolvePartialEmoji)(emoji);
|
|
59
|
+
if (!resolve)
|
|
60
|
+
return (0, __1.throwError)('Invalid Emoji');
|
|
61
|
+
this.data.emoji = resolve;
|
|
62
|
+
return this;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Sets the disabled state of the button.
|
|
66
|
+
* @param disabled - Whether the button should be disabled or not.
|
|
67
|
+
* @returns The modified Button instance.
|
|
68
|
+
*/
|
|
69
|
+
setDisabled(disabled = true) {
|
|
70
|
+
this.data.disabled = disabled;
|
|
71
|
+
return this;
|
|
72
|
+
}
|
|
73
|
+
setStyle(style) {
|
|
74
|
+
this.data.style = style;
|
|
75
|
+
return this;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Sets the callback function to be executed when the button is interacted with.
|
|
79
|
+
* @param func - The callback function to set.
|
|
80
|
+
* @returns The modified Button instance.
|
|
81
|
+
*/
|
|
82
|
+
run(func) {
|
|
83
|
+
this.__exec = func;
|
|
84
|
+
return this;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Converts the Button instance to its JSON representation.
|
|
88
|
+
* @returns The JSON representation of the Button instance.
|
|
89
|
+
*/
|
|
90
|
+
toJSON() {
|
|
91
|
+
return { ...this.data };
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
exports.Button = Button;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { type APIEmbed, type APIEmbedAuthor, type APIEmbedField, type APIEmbedFooter, type ColorResolvable, type ObjectToLower, type RestOrArray } from '../common';
|
|
2
|
+
/**
|
|
3
|
+
* Represents a message embed.
|
|
4
|
+
* @example
|
|
5
|
+
* const embed = new MessageEmbed();
|
|
6
|
+
* embed.setTitle('Seyfert');
|
|
7
|
+
* embed.setDescription('Better than discord.js');
|
|
8
|
+
* embed.setColor('Green');
|
|
9
|
+
* const embedJSON = embed.json();
|
|
10
|
+
*/
|
|
11
|
+
export declare class Embed {
|
|
12
|
+
data: Partial<APIEmbed>;
|
|
13
|
+
/**
|
|
14
|
+
* Creates a new instance of MessageEmbed.
|
|
15
|
+
* @param data - The initial data for the embed.
|
|
16
|
+
* @example
|
|
17
|
+
* const embed = new MessageEmbed({ title: 'Hello', description: 'This is an example embed' });
|
|
18
|
+
*/
|
|
19
|
+
constructor(data?: Partial<APIEmbed>);
|
|
20
|
+
/**
|
|
21
|
+
* Sets the author of the embed.
|
|
22
|
+
* @param author - The author information.
|
|
23
|
+
* @returns The updated MessageEmbed instance.
|
|
24
|
+
* @example
|
|
25
|
+
* embed.setAuthor({ name: 'John Doe', iconURL: 'https://example.com/avatar.png' });
|
|
26
|
+
*/
|
|
27
|
+
setAuthor(author: ObjectToLower<APIEmbedAuthor>): this;
|
|
28
|
+
/**
|
|
29
|
+
* Sets the color of the embed.
|
|
30
|
+
* @param color - The color of the embed.
|
|
31
|
+
* @returns The updated MessageEmbed instance.
|
|
32
|
+
* @example
|
|
33
|
+
* embed.setColor('#FF0000');
|
|
34
|
+
* embed.setColor('Blurple');
|
|
35
|
+
*/
|
|
36
|
+
setColor(color: ColorResolvable): this;
|
|
37
|
+
/**
|
|
38
|
+
* Sets the description of the embed.
|
|
39
|
+
* @param desc - The description of the embed.
|
|
40
|
+
* @returns The updated MessageEmbed instance.
|
|
41
|
+
* @example
|
|
42
|
+
* embed.setDescription('This is the description of the embed');
|
|
43
|
+
*/
|
|
44
|
+
setDescription(desc: string): this;
|
|
45
|
+
/**
|
|
46
|
+
* Adds one or more fields to the embed.
|
|
47
|
+
* @param fields - The fields to add to the embed.
|
|
48
|
+
* @returns The updated MessageEmbed instance.
|
|
49
|
+
* @example
|
|
50
|
+
* embed.addFields({ name: 'Field 1', value: 'Value 1' }, { name: 'Field 2', value: 'Value 2' });
|
|
51
|
+
*/
|
|
52
|
+
addFields(...fields: RestOrArray<APIEmbedField>): this;
|
|
53
|
+
/**
|
|
54
|
+
* Sets the fields of the embed.
|
|
55
|
+
* @param fields - The fields of the embed.
|
|
56
|
+
* @returns The updated MessageEmbed instance.
|
|
57
|
+
* @example
|
|
58
|
+
* embed.setFields([{ name: 'Field 1', value: 'Value 1' }, { name: 'Field 2', value: 'Value 2' }]);
|
|
59
|
+
*/
|
|
60
|
+
setFields(fields: APIEmbedField[]): this;
|
|
61
|
+
/**
|
|
62
|
+
* Sets the footer of the embed.
|
|
63
|
+
* @param footer - The footer information.
|
|
64
|
+
* @returns The updated MessageEmbed instance.
|
|
65
|
+
* @example
|
|
66
|
+
* embed.setFooter({ text: 'This is the footer', iconURL: 'https://example.com/footer.png' });
|
|
67
|
+
*/
|
|
68
|
+
setFooter(footer: ObjectToLower<Omit<APIEmbedFooter, 'proxy_icon_url'>>): this;
|
|
69
|
+
/**
|
|
70
|
+
* Sets the image of the embed.
|
|
71
|
+
* @param url - The URL of the image.
|
|
72
|
+
* @returns The updated MessageEmbed instance.
|
|
73
|
+
* @example
|
|
74
|
+
* embed.setImage('https://example.com/image.png');
|
|
75
|
+
*/
|
|
76
|
+
setImage(url: string): this;
|
|
77
|
+
/**
|
|
78
|
+
* Sets the timestamp of the embed.
|
|
79
|
+
* @param time - The timestamp value.
|
|
80
|
+
* @returns The updated MessageEmbed instance.
|
|
81
|
+
* @example
|
|
82
|
+
* embed.setTimestamp();
|
|
83
|
+
* embed.setTimestamp(1628761200000);
|
|
84
|
+
* embed.setTimestamp(new Date());
|
|
85
|
+
*/
|
|
86
|
+
setTimestamp(time?: string | number | Date): this;
|
|
87
|
+
/**
|
|
88
|
+
* Sets the title of the embed.
|
|
89
|
+
* @param title - The title of the embed.
|
|
90
|
+
* @returns The updated MessageEmbed instance.
|
|
91
|
+
* @example
|
|
92
|
+
* embed.setTitle('This is the title');
|
|
93
|
+
*/
|
|
94
|
+
setTitle(title: string): this;
|
|
95
|
+
/**
|
|
96
|
+
* Sets the URL of the embed.
|
|
97
|
+
* @param url - The URL of the embed.
|
|
98
|
+
* @returns The updated MessageEmbed instance.
|
|
99
|
+
* @example
|
|
100
|
+
* embed.setURL('https://seyfert.com');
|
|
101
|
+
*/
|
|
102
|
+
setURL(url: string): this;
|
|
103
|
+
/**
|
|
104
|
+
* Sets the thumbnail of the embed.
|
|
105
|
+
* @param url - The URL of the thumbnail.
|
|
106
|
+
* @returns The updated MessageEmbed instance.
|
|
107
|
+
* @example
|
|
108
|
+
* embed.setThumbnail('https://example.com/thumbnail.png');
|
|
109
|
+
*/
|
|
110
|
+
setThumbnail(url?: string): this;
|
|
111
|
+
/**
|
|
112
|
+
* Converts the MessageEmbed instance to a JSON object.
|
|
113
|
+
* @returns The JSON representation of the MessageEmbed instance.
|
|
114
|
+
*/
|
|
115
|
+
toJSON(): APIEmbed;
|
|
116
|
+
}
|