@magicyan/discord 1.0.22 → 1.0.23

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.
@@ -59,5 +59,10 @@ function findChannel(guild, type) {
59
59
  }
60
60
  };
61
61
  }
62
+ function getChannelUrlInfo(url) {
63
+ const [channelId, guildId] = url.split("/").reverse();
64
+ return { channelId, guildId };
65
+ }
62
66
 
63
67
  exports.findChannel = findChannel;
68
+ exports.getChannelUrlInfo = getChannelUrlInfo;
@@ -57,5 +57,9 @@ function findChannel(guild, type) {
57
57
  }
58
58
  };
59
59
  }
60
+ function getChannelUrlInfo(url) {
61
+ const [channelId, guildId] = url.split("/").reverse();
62
+ return { channelId, guildId };
63
+ }
60
64
 
61
- export { findChannel };
65
+ export { findChannel, getChannelUrlInfo };
@@ -0,0 +1,15 @@
1
+ 'use strict';
2
+
3
+ const discord_js = require('discord.js');
4
+
5
+ function createEmbedAsset(source, options) {
6
+ if (source instanceof discord_js.Attachment || source instanceof discord_js.AttachmentBuilder) {
7
+ return { url: `attachment://${source.name}`, ...options };
8
+ }
9
+ if (source && typeof source === "object" && "url" in source) {
10
+ return source;
11
+ }
12
+ return source ? { url: source, ...options } : void 0;
13
+ }
14
+
15
+ exports.createEmbedAsset = createEmbedAsset;
@@ -0,0 +1,13 @@
1
+ import { Attachment, AttachmentBuilder } from 'discord.js';
2
+
3
+ function createEmbedAsset(source, options) {
4
+ if (source instanceof Attachment || source instanceof AttachmentBuilder) {
5
+ return { url: `attachment://${source.name}`, ...options };
6
+ }
7
+ if (source && typeof source === "object" && "url" in source) {
8
+ return source;
9
+ }
10
+ return source ? { url: source, ...options } : void 0;
11
+ }
12
+
13
+ export { createEmbedAsset };
@@ -0,0 +1,30 @@
1
+ 'use strict';
2
+
3
+ function createEmbedAuthor(options) {
4
+ const { prefix, suffix, url, iconURL } = options;
5
+ const { size = 512, extension, forceStatic } = options;
6
+ const avatarOptions = { size, extension, forceStatic };
7
+ if ("member" in options) {
8
+ const { member, property: property2 = "displayName" } = options;
9
+ const name = {
10
+ id: member.id,
11
+ username: member.user.username,
12
+ displayName: member.displayName,
13
+ globalName: member.user.globalName,
14
+ nickname: member.nickname
15
+ }[property2] ?? member.displayName;
16
+ return {
17
+ name: `${prefix}${name}${suffix}`,
18
+ url,
19
+ iconURL: iconURL || member.displayAvatarURL(avatarOptions)
20
+ };
21
+ }
22
+ const { property = "displayName", user } = options;
23
+ return {
24
+ name: `${prefix}${options.user[property]}${suffix}`,
25
+ url,
26
+ iconURL: iconURL || user.displayAvatarURL(avatarOptions)
27
+ };
28
+ }
29
+
30
+ exports.createEmbedAuthor = createEmbedAuthor;
@@ -0,0 +1,28 @@
1
+ function createEmbedAuthor(options) {
2
+ const { prefix, suffix, url, iconURL } = options;
3
+ const { size = 512, extension, forceStatic } = options;
4
+ const avatarOptions = { size, extension, forceStatic };
5
+ if ("member" in options) {
6
+ const { member, property: property2 = "displayName" } = options;
7
+ const name = {
8
+ id: member.id,
9
+ username: member.user.username,
10
+ displayName: member.displayName,
11
+ globalName: member.user.globalName,
12
+ nickname: member.nickname
13
+ }[property2] ?? member.displayName;
14
+ return {
15
+ name: `${prefix}${name}${suffix}`,
16
+ url,
17
+ iconURL: iconURL || member.displayAvatarURL(avatarOptions)
18
+ };
19
+ }
20
+ const { property = "displayName", user } = options;
21
+ return {
22
+ name: `${prefix}${options.user[property]}${suffix}`,
23
+ url,
24
+ iconURL: iconURL || user.displayAvatarURL(avatarOptions)
25
+ };
26
+ }
27
+
28
+ export { createEmbedAuthor };
@@ -0,0 +1,93 @@
1
+ 'use strict';
2
+
3
+ const discord_js = require('discord.js');
4
+ const chars = require('../../constants/chars.cjs');
5
+ const assets = require('./assets.cjs');
6
+ const footer = require('./footer.cjs');
7
+
8
+ class EmbedPlusBuilder extends discord_js.EmbedBuilder {
9
+ constructor(data) {
10
+ const extendsEmbed = data.extends ? new EmbedPlusBuilder(
11
+ data.extends instanceof discord_js.Embed || data.extends instanceof discord_js.EmbedBuilder ? data.extends.data : data.extends
12
+ ).data : {};
13
+ const { fields: extendsFields, ...exetendData } = extendsEmbed;
14
+ const fields = (data.mergeFields ? [extendsFields ?? [], data.fields ?? []].flat() : data.fields ?? extendsFields ?? []).map(({ name = chars.chars.invisible, value = chars.chars.invisible, inline }) => ({
15
+ name,
16
+ value,
17
+ inline
18
+ }));
19
+ const embed = new discord_js.EmbedBuilder({
20
+ ...exetendData,
21
+ ...data.title ? { title: data.title } : {},
22
+ ...data.description ? { description: data.description } : {},
23
+ ...data.url ? { url: data.url } : {},
24
+ ...data.footer ? { footer: footer.createEmbedFooter(data.footer) } : {},
25
+ ...data.author ? { author: data.author } : {},
26
+ ...data.image ? { image: assets.createEmbedAsset(data.image) } : {},
27
+ ...data.thumbnail ? { thumbnail: assets.createEmbedAsset(data.thumbnail) } : {},
28
+ ...fields.length > 0 ? { fields } : {}
29
+ });
30
+ if (data.timestamp)
31
+ embed.setTimestamp(
32
+ typeof data.timestamp === "string" ? new Date(data.timestamp) : data.timestamp
33
+ );
34
+ if (data.color)
35
+ embed.setColor(data.color);
36
+ super(embed.data);
37
+ }
38
+ has(property) {
39
+ return Boolean(this.data[property]);
40
+ }
41
+ toArray() {
42
+ return Array.from([this]);
43
+ }
44
+ toString(space = 2) {
45
+ return JSON.stringify(this, null, space);
46
+ }
47
+ updateField(index, field) {
48
+ if (this.fields.at(index)) {
49
+ const fields = Array.from(this.fields);
50
+ if (field.name)
51
+ fields[index].name = field.name;
52
+ if (field.value)
53
+ fields[index].value = field.value;
54
+ if (field.inline)
55
+ fields[index].inline = field.inline;
56
+ this.setFields(fields);
57
+ }
58
+ return this;
59
+ }
60
+ deleteField(index) {
61
+ if (this.fields.at(index)) {
62
+ this.setFields(this.fields.toSpliced(index, 1));
63
+ }
64
+ return this;
65
+ }
66
+ popField() {
67
+ const fields = Array.from(this.fields);
68
+ const field = fields.pop();
69
+ this.setFields(fields);
70
+ return field;
71
+ }
72
+ setAsset(asset, source) {
73
+ const assetData = assets.createEmbedAsset(source);
74
+ if (!assetData?.url)
75
+ return this;
76
+ asset === "image" ? this.setImage(assetData.url) : this.setThumbnail(assetData.url);
77
+ return this;
78
+ }
79
+ get fieldsLength() {
80
+ return this.data.fields?.length ?? 0;
81
+ }
82
+ get fields() {
83
+ return this.data.fields ?? [];
84
+ }
85
+ }
86
+ function createEmbed(options) {
87
+ const { array = false, ...data } = options;
88
+ const embed = new EmbedPlusBuilder(data);
89
+ return array ? [embed] : embed;
90
+ }
91
+
92
+ exports.EmbedPlusBuilder = EmbedPlusBuilder;
93
+ exports.createEmbed = createEmbed;
@@ -0,0 +1,90 @@
1
+ import { EmbedBuilder, Embed } from 'discord.js';
2
+ import { chars } from '../../constants/chars.mjs';
3
+ import { createEmbedAsset } from './assets.mjs';
4
+ import { createEmbedFooter } from './footer.mjs';
5
+
6
+ class EmbedPlusBuilder extends EmbedBuilder {
7
+ constructor(data) {
8
+ const extendsEmbed = data.extends ? new EmbedPlusBuilder(
9
+ data.extends instanceof Embed || data.extends instanceof EmbedBuilder ? data.extends.data : data.extends
10
+ ).data : {};
11
+ const { fields: extendsFields, ...exetendData } = extendsEmbed;
12
+ const fields = (data.mergeFields ? [extendsFields ?? [], data.fields ?? []].flat() : data.fields ?? extendsFields ?? []).map(({ name = chars.invisible, value = chars.invisible, inline }) => ({
13
+ name,
14
+ value,
15
+ inline
16
+ }));
17
+ const embed = new EmbedBuilder({
18
+ ...exetendData,
19
+ ...data.title ? { title: data.title } : {},
20
+ ...data.description ? { description: data.description } : {},
21
+ ...data.url ? { url: data.url } : {},
22
+ ...data.footer ? { footer: createEmbedFooter(data.footer) } : {},
23
+ ...data.author ? { author: data.author } : {},
24
+ ...data.image ? { image: createEmbedAsset(data.image) } : {},
25
+ ...data.thumbnail ? { thumbnail: createEmbedAsset(data.thumbnail) } : {},
26
+ ...fields.length > 0 ? { fields } : {}
27
+ });
28
+ if (data.timestamp)
29
+ embed.setTimestamp(
30
+ typeof data.timestamp === "string" ? new Date(data.timestamp) : data.timestamp
31
+ );
32
+ if (data.color)
33
+ embed.setColor(data.color);
34
+ super(embed.data);
35
+ }
36
+ has(property) {
37
+ return Boolean(this.data[property]);
38
+ }
39
+ toArray() {
40
+ return Array.from([this]);
41
+ }
42
+ toString(space = 2) {
43
+ return JSON.stringify(this, null, space);
44
+ }
45
+ updateField(index, field) {
46
+ if (this.fields.at(index)) {
47
+ const fields = Array.from(this.fields);
48
+ if (field.name)
49
+ fields[index].name = field.name;
50
+ if (field.value)
51
+ fields[index].value = field.value;
52
+ if (field.inline)
53
+ fields[index].inline = field.inline;
54
+ this.setFields(fields);
55
+ }
56
+ return this;
57
+ }
58
+ deleteField(index) {
59
+ if (this.fields.at(index)) {
60
+ this.setFields(this.fields.toSpliced(index, 1));
61
+ }
62
+ return this;
63
+ }
64
+ popField() {
65
+ const fields = Array.from(this.fields);
66
+ const field = fields.pop();
67
+ this.setFields(fields);
68
+ return field;
69
+ }
70
+ setAsset(asset, source) {
71
+ const assetData = createEmbedAsset(source);
72
+ if (!assetData?.url)
73
+ return this;
74
+ asset === "image" ? this.setImage(assetData.url) : this.setThumbnail(assetData.url);
75
+ return this;
76
+ }
77
+ get fieldsLength() {
78
+ return this.data.fields?.length ?? 0;
79
+ }
80
+ get fields() {
81
+ return this.data.fields ?? [];
82
+ }
83
+ }
84
+ function createEmbed(options) {
85
+ const { array = false, ...data } = options;
86
+ const embed = new EmbedPlusBuilder(data);
87
+ return array ? [embed] : embed;
88
+ }
89
+
90
+ export { EmbedPlusBuilder, createEmbed };
@@ -0,0 +1,11 @@
1
+ 'use strict';
2
+
3
+ const core = require('@magicyan/core');
4
+ const chars = require('../../constants/chars.cjs');
5
+
6
+ function createEmbedFooter(options) {
7
+ const { text, iconURL } = options;
8
+ return !text && !iconURL ? void 0 : { text: text ?? chars.chars.invisible, iconURL: core.notFound(iconURL) };
9
+ }
10
+
11
+ exports.createEmbedFooter = createEmbedFooter;
@@ -0,0 +1,9 @@
1
+ import { notFound } from '@magicyan/core';
2
+ import { chars } from '../../constants/chars.mjs';
3
+
4
+ function createEmbedFooter(options) {
5
+ const { text, iconURL } = options;
6
+ return !text && !iconURL ? void 0 : { text: text ?? chars.invisible, iconURL: notFound(iconURL) };
7
+ }
8
+
9
+ export { createEmbedFooter };
@@ -40,5 +40,10 @@ function findMessage(channel) {
40
40
  }
41
41
  };
42
42
  }
43
+ function getMessageUrlInfo(url) {
44
+ const [messageId, channelId, guildId] = url.split("/").reverse();
45
+ return { messageId, channelId, guildId };
46
+ }
43
47
 
44
48
  exports.findMessage = findMessage;
49
+ exports.getMessageUrlInfo = getMessageUrlInfo;
@@ -38,5 +38,9 @@ function findMessage(channel) {
38
38
  }
39
39
  };
40
40
  }
41
+ function getMessageUrlInfo(url) {
42
+ const [messageId, channelId, guildId] = url.split("/").reverse();
43
+ return { messageId, channelId, guildId };
44
+ }
41
45
 
42
- export { findMessage };
46
+ export { findMessage, getMessageUrlInfo };
@@ -0,0 +1,9 @@
1
+ 'use strict';
2
+
3
+ const discord_js = require('discord.js');
4
+
5
+ function setMobileStatus() {
6
+ discord_js.DefaultWebSocketManagerOptions.identifyProperties.browser = "Discord Android";
7
+ }
8
+
9
+ exports.setMobileStatus = setMobileStatus;
@@ -0,0 +1,7 @@
1
+ import { DefaultWebSocketManagerOptions } from 'discord.js';
2
+
3
+ function setMobileStatus() {
4
+ DefaultWebSocketManagerOptions.identifyProperties.browser = "Discord Android";
5
+ }
6
+
7
+ export { setMobileStatus };
package/dist/index.cjs CHANGED
@@ -2,16 +2,20 @@
2
2
 
3
3
  const chars = require('./constants/chars.cjs');
4
4
  const client = require('./constants/client.cjs');
5
+ const misc = require('./functions/misc.cjs');
5
6
  const channels = require('./functions/channels.cjs');
6
7
  const commands = require('./functions/commands.cjs');
7
8
  const components = require('./functions/components.cjs');
8
- const embeds = require('./functions/embeds.cjs');
9
9
  const emojis = require('./functions/emojis.cjs');
10
10
  const format = require('./functions/format.cjs');
11
11
  const members = require('./functions/members.cjs');
12
12
  const message = require('./functions/message.cjs');
13
13
  const roles = require('./functions/roles.cjs');
14
14
  const regex = require('./functions/regex.cjs');
15
+ const assets = require('./functions/embeds/assets.cjs');
16
+ const author = require('./functions/embeds/author.cjs');
17
+ const embedplus = require('./functions/embeds/embedplus.cjs');
18
+ const footer = require('./functions/embeds/footer.cjs');
15
19
  const core = require('@magicyan/core');
16
20
 
17
21
 
@@ -19,23 +23,26 @@ const core = require('@magicyan/core');
19
23
  exports.chars = chars.chars;
20
24
  exports.CustomItents = client.CustomItents;
21
25
  exports.CustomPartials = client.CustomPartials;
26
+ exports.setMobileStatus = misc.setMobileStatus;
22
27
  exports.findChannel = channels.findChannel;
28
+ exports.getChannelUrlInfo = channels.getChannelUrlInfo;
23
29
  exports.findCommand = commands.findCommand;
24
30
  exports.createComponentsManager = components.createComponentsManager;
25
31
  exports.createLinkButton = components.createLinkButton;
26
32
  exports.createModalInput = components.createModalInput;
27
33
  exports.createRow = components.createRow;
28
- exports.EmbedBuilderPlus = embeds.EmbedBuilderPlus;
29
- exports.createEmbed = embeds.createEmbed;
30
- exports.createEmbedAsset = embeds.createEmbedAsset;
31
- exports.createEmbedAuthor = embeds.createEmbedAuthor;
32
- exports.createEmbedFooter = embeds.createEmbedFooter;
33
34
  exports.findEmoji = emojis.findEmoji;
34
35
  exports.formatedMention = format.formatedMention;
35
36
  exports.findMember = members.findMember;
36
37
  exports.findMessage = message.findMessage;
38
+ exports.getMessageUrlInfo = message.getMessageUrlInfo;
37
39
  exports.findRole = roles.findRole;
38
40
  exports.extractMentionId = regex.extractMentionId;
41
+ exports.createEmbedAsset = assets.createEmbedAsset;
42
+ exports.createEmbedAuthor = author.createEmbedAuthor;
43
+ exports.EmbedPlusBuilder = embedplus.EmbedPlusBuilder;
44
+ exports.createEmbed = embedplus.createEmbed;
45
+ exports.createEmbedFooter = footer.createEmbedFooter;
39
46
  Object.keys(core).forEach(function (k) {
40
47
  if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) exports[k] = core[k];
41
48
  });
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as discord_js from 'discord.js';
2
- import { GatewayIntentBits, Partials, ChannelType, Guild, CommandInteractionOption, Client, ApplicationCommand, AnyComponentBuilder, ActionRowBuilder, TextInputBuilder, ButtonBuilder, ActionRow, MessageActionRowComponent, TextInputComponentData, LinkButtonComponentData, ButtonComponent, StringSelectMenuComponent, UserSelectMenuComponent, ChannelSelectMenuComponent, RoleSelectMenuComponent, MentionableSelectMenuComponent, EmbedAuthorData, EmbedFooterData, EmbedAssetData, EmbedBuilder, User, ImageURLOptions, Attachment, AttachmentBuilder, EmbedData, APIEmbed, Embed, ColorResolvable, GuildEmoji, GuildBasedChannel, Role, GuildMember, GuildTextBasedChannel, Message } from 'discord.js';
2
+ import { GatewayIntentBits, Partials, ChannelType, Guild, CommandInteractionOption, Client, ApplicationCommand, AnyComponentBuilder, ActionRowBuilder, TextInputBuilder, ButtonBuilder, ActionRow, MessageActionRowComponent, TextInputComponentData, LinkButtonComponentData, ButtonComponent, StringSelectMenuComponent, UserSelectMenuComponent, ChannelSelectMenuComponent, RoleSelectMenuComponent, MentionableSelectMenuComponent, GuildEmoji, GuildBasedChannel, Role, User, GuildMember, GuildTextBasedChannel, Message, Attachment, AttachmentBuilder, EmbedAssetData, EmbedAuthorData, ImageURLOptions, EmbedBuilder, EmbedData, APIEmbed, Embed, ColorResolvable, EmbedFooterData } from 'discord.js';
3
3
  export * from '@magicyan/core';
4
4
 
5
5
  declare const chars: {
@@ -16,25 +16,33 @@ declare const CustomPartials: {
16
16
  All: Partials[];
17
17
  };
18
18
 
19
- type FindChannelFilter<T extends ChannelType> = (channel: GetChannelType<T>) => boolean;
20
- type GetChannelType<Type extends ChannelType> = Extract<NonNullable<CommandInteractionOption<"cached">["channel"]>, {
19
+ declare function setMobileStatus(): void;
20
+
21
+ type GuildChannelType = Exclude<ChannelType, ChannelType.DM>;
22
+ type FindChannelFilter<T extends GuildChannelType> = (channel: GetChannelType<T>) => boolean;
23
+ type GetChannelType<Type extends GuildChannelType> = Extract<NonNullable<CommandInteractionOption<"cached">["channel"]>, {
21
24
  type: Type extends ChannelType.PublicThread | ChannelType.AnnouncementThread ? ChannelType.PublicThread | ChannelType.AnnouncementThread : Type;
22
25
  }>;
23
- declare function findChannel<Type extends Exclude<ChannelType, ChannelType.DM> = ChannelType.GuildText>(guild: Guild, type?: Type): {
26
+ declare function findChannel<Type extends GuildChannelType = ChannelType.GuildText>(guild: Guild, type?: Type): {
24
27
  byName(name: string, filter?: FindChannelFilter<Type>): GetChannelType<Type> | undefined;
25
28
  byId(id: string): GetChannelType<Type> | undefined;
26
- byFilter(filter: FindChannelFilter<Type>): discord_js.GuildBasedChannel | undefined;
29
+ byFilter(filter: FindChannelFilter<Type>): GetChannelType<Type> | undefined;
27
30
  inCategoryId(id: string): {
28
31
  byName(name: string, filter?: FindChannelFilter<Type>): GetChannelType<Type> | undefined;
29
32
  byId(id: string, filter?: FindChannelFilter<Type>): GetChannelType<Type> | undefined;
30
- byFilter(filter: FindChannelFilter<Type>): discord_js.GuildBasedChannel | undefined;
33
+ byFilter(filter: FindChannelFilter<Type>): GetChannelType<Type> | undefined;
31
34
  };
32
35
  inCategoryName(name: string): {
33
36
  byName(name: string, filter?: FindChannelFilter<Type>): GetChannelType<Type> | undefined;
34
37
  byId(id: string, filter?: FindChannelFilter<Type>): GetChannelType<Type> | undefined;
35
- byFilter(filter: FindChannelFilter<Type>): discord_js.GuildBasedChannel | undefined;
38
+ byFilter(filter: FindChannelFilter<Type>): GetChannelType<Type> | undefined;
36
39
  };
37
40
  };
41
+ interface ChannelUrlInfo {
42
+ channelId?: string;
43
+ guildId?: string;
44
+ }
45
+ declare function getChannelUrlInfo(url: string): ChannelUrlInfo;
38
46
 
39
47
  type FindCommandFilter = (command: ApplicationCommand) => boolean;
40
48
  declare function findCommand(guildOrClient: Guild | Client<true>): {
@@ -80,72 +88,6 @@ interface MessageComponentsManager {
80
88
  }
81
89
  declare function createComponentsManager(components: ActionRow<MessageActionRowComponent>[]): MessageComponentsManager;
82
90
 
83
- interface CreateEmbedAuthorOptions {
84
- user: User;
85
- property?: "username" | "displayName" | "id" | "globalName";
86
- imageSize?: ImageURLOptions["size"];
87
- iconURL?: string;
88
- url?: string;
89
- prefix?: string;
90
- suffix?: string;
91
- }
92
- declare function createEmbedAuthor(options: CreateEmbedAuthorOptions): EmbedAuthorData;
93
- interface CreateEmbedFooterOptions {
94
- text?: string | null;
95
- iconURL?: string | null;
96
- }
97
- declare function createEmbedFooter(options: CreateEmbedFooterOptions): EmbedFooterData | undefined;
98
- type EmbedAssetOptions = Omit<EmbedAssetData, "url">;
99
- type AssetSource = string | Attachment | AttachmentBuilder | EmbedAssetData | undefined | null;
100
- declare function createEmbedAsset(source: AssetSource, options?: EmbedAssetOptions): EmbedAssetData | undefined;
101
- type EmbedBuilderPlusAssetData = AssetSource;
102
- type EmbedBuilderPlusColorData = string & {} | ColorResolvable | null;
103
- type EmbedBuilderPlusFieldData = {
104
- name: string;
105
- value: string;
106
- inline?: boolean;
107
- };
108
- type EmbedBuilderPlusFooterData = {
109
- text?: string | null;
110
- iconURL?: string | null;
111
- };
112
- type EmbedBuilderPlusAuthorData = {
113
- name: string;
114
- url?: string;
115
- iconURL?: string;
116
- };
117
- interface EmbedBuilderPlusOptions {
118
- extend?: Omit<EmbedBuilderPlusData, keyof EmbedBuilderPlusOptions> | EmbedData | APIEmbed | Embed;
119
- mergeFields?: boolean;
120
- }
121
- interface EmbedBuilderPlusData extends EmbedBuilderPlusOptions {
122
- title?: string | null;
123
- color?: EmbedBuilderPlusColorData | null;
124
- description?: string | null;
125
- url?: string | null;
126
- thumbnail?: EmbedBuilderPlusAssetData | null;
127
- image?: EmbedBuilderPlusAssetData | null;
128
- fields?: Partial<EmbedBuilderPlusFieldData>[] | null;
129
- timestamp?: string | number | Date | null;
130
- footer?: EmbedBuilderPlusFooterData;
131
- author?: EmbedBuilderPlusAuthorData;
132
- }
133
- declare class EmbedBuilderPlus extends EmbedBuilder {
134
- constructor(data: EmbedBuilderPlusData);
135
- has(property: keyof Omit<EmbedBuilderPlusData, keyof EmbedBuilderPlusOptions>): boolean;
136
- toArray(): this[];
137
- toString(space?: number): string;
138
- updateField(index: number, field: Partial<EmbedBuilderPlusFieldData>): this;
139
- deleteField(index: number): this;
140
- popField(): discord_js.APIEmbedField | undefined;
141
- setAsset(asset: "thumbnail" | "image", source: EmbedBuilderPlusAssetData): this;
142
- get fieldsLength(): number;
143
- get fields(): discord_js.APIEmbedField[];
144
- createFromThis(data?: EmbedBuilderPlusData): EmbedBuilderPlus;
145
- }
146
- type EmbedPropery<T extends keyof EmbedBuilderPlusData> = EmbedBuilderPlusData[T];
147
- declare function createEmbed(data: EmbedBuilderPlusData): EmbedBuilderPlus;
148
-
149
91
  type FindEmojiFilter = (emoji: GuildEmoji) => boolean;
150
92
  declare function findEmoji(guildOrClient: Guild | Client): {
151
93
  byName(name: string, animated?: boolean, and?: FindEmojiFilter): GuildEmoji | undefined;
@@ -175,6 +117,12 @@ declare function findMessage(channel: GuildTextBasedChannel): {
175
117
  };
176
118
  byFilter(filter: FindMessageFilter): Message<true> | undefined;
177
119
  };
120
+ interface MessageUrlInfo {
121
+ messageId?: string;
122
+ channelId?: string;
123
+ guildId?: string;
124
+ }
125
+ declare function getMessageUrlInfo(url: string): MessageUrlInfo;
178
126
 
179
127
  type FindRoleFilter = (role: Role) => boolean;
180
128
  declare function findRole(guild: Guild): {
@@ -202,4 +150,82 @@ declare function findRole(guild: Guild): {
202
150
  */
203
151
  declare function extractMentionId(mention: string): string | null;
204
152
 
205
- export { CustomItents, CustomPartials, EmbedBuilderPlus, type EmbedPropery, chars, createComponentsManager, createEmbed, createEmbedAsset, createEmbedAuthor, createEmbedFooter, createLinkButton, createModalInput, createRow, extractMentionId, findChannel, findCommand, findEmoji, findMember, findMessage, findRole, formatedMention };
153
+ type EmbedAssetOptions = Omit<EmbedAssetData, "url">;
154
+ type AssetSource = string | Attachment | AttachmentBuilder | EmbedAssetData | undefined | null;
155
+ declare function createEmbedAsset(source: AssetSource, options?: EmbedAssetOptions): EmbedAssetData | undefined;
156
+
157
+ interface UserAuthorOption {
158
+ user: User;
159
+ property?: "username" | "displayName" | "id" | "globalName";
160
+ }
161
+ interface MemberAuthorOption {
162
+ member: GuildMember;
163
+ property?: "username" | "displayName" | "id" | "globalName" | "nickname";
164
+ }
165
+ type AuthorOption = UserAuthorOption | MemberAuthorOption;
166
+ type CreateEmbedAuthorOptions = AuthorOption & ImageURLOptions & {
167
+ iconURL?: string;
168
+ url?: string;
169
+ prefix?: string;
170
+ suffix?: string;
171
+ };
172
+ declare function createEmbedAuthor(options: CreateEmbedAuthorOptions): EmbedAuthorData;
173
+
174
+ type EmbedPlusAssetData = AssetSource;
175
+ type EmbedPlusColorData = string & {} | ColorResolvable | null;
176
+ type EmbedPlusFieldData = {
177
+ name: string;
178
+ value: string;
179
+ inline?: boolean;
180
+ };
181
+ type EmbedPlusFooterData = {
182
+ text?: string | null;
183
+ iconURL?: string | null;
184
+ };
185
+ type EmbedPlusAuthorData = {
186
+ name: string;
187
+ url?: string;
188
+ iconURL?: string;
189
+ };
190
+ interface EmbedPlusData {
191
+ title?: string | null;
192
+ color?: EmbedPlusColorData | null;
193
+ description?: string | null;
194
+ url?: string | null;
195
+ thumbnail?: EmbedPlusAssetData | null;
196
+ image?: EmbedPlusAssetData | null;
197
+ fields?: Partial<EmbedPlusFieldData>[] | null;
198
+ timestamp?: string | number | Date | null;
199
+ footer?: EmbedPlusFooterData;
200
+ author?: EmbedPlusAuthorData;
201
+ }
202
+ interface EmbedPlusOptions extends EmbedPlusData {
203
+ extends?: Omit<EmbedPlusData, keyof EmbedPlusOptions> | EmbedData | APIEmbed | Embed;
204
+ mergeFields?: boolean;
205
+ }
206
+ declare class EmbedPlusBuilder extends EmbedBuilder {
207
+ constructor(data: EmbedPlusOptions);
208
+ has(property: keyof Omit<EmbedPlusData, keyof EmbedPlusOptions>): boolean;
209
+ toArray(): this[];
210
+ toString(space?: number): string;
211
+ updateField(index: number, field: Partial<EmbedPlusFieldData>): this;
212
+ deleteField(index: number): this;
213
+ popField(): discord_js.APIEmbedField | undefined;
214
+ setAsset(asset: "thumbnail" | "image", source: EmbedPlusAssetData): this;
215
+ get fieldsLength(): number;
216
+ get fields(): discord_js.APIEmbedField[];
217
+ }
218
+ type EmbedPlusPropery<P extends keyof EmbedPlusData> = EmbedPlusData[P];
219
+ interface CreateEmbedOptions<B extends boolean> extends EmbedPlusOptions {
220
+ array?: B;
221
+ }
222
+ type CreateEmbedReturn<B> = undefined extends B ? EmbedPlusBuilder : false extends B ? EmbedPlusBuilder : EmbedPlusBuilder[];
223
+ declare function createEmbed<B extends boolean>(options: CreateEmbedOptions<B>): CreateEmbedReturn<B>;
224
+
225
+ interface CreateEmbedFooterOptions {
226
+ text?: string | null;
227
+ iconURL?: string | null;
228
+ }
229
+ declare function createEmbedFooter(options: CreateEmbedFooterOptions): EmbedFooterData | undefined;
230
+
231
+ export { type AssetSource, CustomItents, CustomPartials, EmbedPlusBuilder, type EmbedPlusPropery, chars, createComponentsManager, createEmbed, createEmbedAsset, createEmbedAuthor, createEmbedFooter, createLinkButton, createModalInput, createRow, extractMentionId, findChannel, findCommand, findEmoji, findMember, findMessage, findRole, formatedMention, getChannelUrlInfo, getMessageUrlInfo, setMobileStatus };