@magicyan/discord 1.0.25 → 1.0.27
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/dist/functions/embeds/embedplus.cjs +23 -13
- package/dist/functions/embeds/embedplus.mjs +25 -15
- package/dist/functions/embeds/fields.cjs +6 -2
- package/dist/functions/embeds/fields.mjs +6 -2
- package/dist/functions/modals.cjs +9 -0
- package/dist/functions/modals.mjs +9 -1
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +10 -6
- package/dist/index.d.mts +10 -6
- package/dist/index.d.ts +10 -6
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
|
@@ -14,18 +14,15 @@ var __publicField = (obj, key, value) => {
|
|
|
14
14
|
};
|
|
15
15
|
class EmbedPlusBuilder extends discord_js.EmbedBuilder {
|
|
16
16
|
constructor(data) {
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}));
|
|
27
|
-
const builderData = Object.assign({}, extendData, data, { fields: fields$1 });
|
|
28
|
-
const { color, footer: footer$1, image, thumbnail, timestamp } = data;
|
|
17
|
+
const { mergeFields = false, extends: extendsEmbed, ...embedData } = data;
|
|
18
|
+
const extendsEmbedData = extendsEmbed ? "data" in extendsEmbed ? extendsEmbed.data : data : {};
|
|
19
|
+
const { fields: extendsFields, ...extendsData } = extendsEmbedData;
|
|
20
|
+
const fields$1 = (mergeFields ? [extendsFields ?? [], data.fields ?? []].flat() : data.fields ?? extendsFields ?? []).map((field) => Object.assign(
|
|
21
|
+
{ name: field.name ?? chars.chars.invisible, value: field.value ?? chars.chars.invisible },
|
|
22
|
+
field.inline !== void 0 ? { inline: field.inline } : {}
|
|
23
|
+
));
|
|
24
|
+
const builderData = Object.assign({}, extendsData, embedData, { fields: fields$1 });
|
|
25
|
+
const { color, footer: footer$1, image, thumbnail, timestamp } = embedData;
|
|
29
26
|
if (footer$1)
|
|
30
27
|
Object.assign(builderData, { footer: footer.createEmbedFooter(footer$1) });
|
|
31
28
|
if (image)
|
|
@@ -41,7 +38,12 @@ class EmbedPlusBuilder extends discord_js.EmbedBuilder {
|
|
|
41
38
|
embed.setColor(color);
|
|
42
39
|
super(embed.data);
|
|
43
40
|
__publicField(this, "fields");
|
|
44
|
-
this.fields = new fields.
|
|
41
|
+
this.fields = new fields.EmbedPlusFields(this);
|
|
42
|
+
}
|
|
43
|
+
update(data) {
|
|
44
|
+
const updated = createEmbed({ mergeFields: true, extends: this, ...data });
|
|
45
|
+
Object.assign(this.data, updated.data);
|
|
46
|
+
return this;
|
|
45
47
|
}
|
|
46
48
|
has(property) {
|
|
47
49
|
return Boolean(this.data[property]);
|
|
@@ -52,6 +54,14 @@ class EmbedPlusBuilder extends discord_js.EmbedBuilder {
|
|
|
52
54
|
toString(space = 2) {
|
|
53
55
|
return JSON.stringify(this, null, space);
|
|
54
56
|
}
|
|
57
|
+
setBorderColor(color) {
|
|
58
|
+
if (color === null) {
|
|
59
|
+
this.setColor("#2B2D31");
|
|
60
|
+
} else {
|
|
61
|
+
this.setColor(color);
|
|
62
|
+
}
|
|
63
|
+
return this;
|
|
64
|
+
}
|
|
55
65
|
setAsset(asset, source) {
|
|
56
66
|
const assetData = assets.createEmbedAsset(source);
|
|
57
67
|
if (!assetData?.url)
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { EmbedBuilder
|
|
1
|
+
import { EmbedBuilder } from 'discord.js';
|
|
2
2
|
import { chars } from '../../constants/chars.mjs';
|
|
3
3
|
import { createEmbedAsset } from './assets.mjs';
|
|
4
4
|
import { createEmbedFooter } from './footer.mjs';
|
|
5
|
-
import {
|
|
5
|
+
import { EmbedPlusFields } from './fields.mjs';
|
|
6
6
|
|
|
7
7
|
var __defProp = Object.defineProperty;
|
|
8
8
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
@@ -12,18 +12,15 @@ var __publicField = (obj, key, value) => {
|
|
|
12
12
|
};
|
|
13
13
|
class EmbedPlusBuilder extends EmbedBuilder {
|
|
14
14
|
constructor(data) {
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}));
|
|
25
|
-
const builderData = Object.assign({}, extendData, data, { fields });
|
|
26
|
-
const { color, footer, image, thumbnail, timestamp } = data;
|
|
15
|
+
const { mergeFields = false, extends: extendsEmbed, ...embedData } = data;
|
|
16
|
+
const extendsEmbedData = extendsEmbed ? "data" in extendsEmbed ? extendsEmbed.data : data : {};
|
|
17
|
+
const { fields: extendsFields, ...extendsData } = extendsEmbedData;
|
|
18
|
+
const fields = (mergeFields ? [extendsFields ?? [], data.fields ?? []].flat() : data.fields ?? extendsFields ?? []).map((field) => Object.assign(
|
|
19
|
+
{ name: field.name ?? chars.invisible, value: field.value ?? chars.invisible },
|
|
20
|
+
field.inline !== void 0 ? { inline: field.inline } : {}
|
|
21
|
+
));
|
|
22
|
+
const builderData = Object.assign({}, extendsData, embedData, { fields });
|
|
23
|
+
const { color, footer, image, thumbnail, timestamp } = embedData;
|
|
27
24
|
if (footer)
|
|
28
25
|
Object.assign(builderData, { footer: createEmbedFooter(footer) });
|
|
29
26
|
if (image)
|
|
@@ -39,7 +36,12 @@ class EmbedPlusBuilder extends EmbedBuilder {
|
|
|
39
36
|
embed.setColor(color);
|
|
40
37
|
super(embed.data);
|
|
41
38
|
__publicField(this, "fields");
|
|
42
|
-
this.fields = new
|
|
39
|
+
this.fields = new EmbedPlusFields(this);
|
|
40
|
+
}
|
|
41
|
+
update(data) {
|
|
42
|
+
const updated = createEmbed({ mergeFields: true, extends: this, ...data });
|
|
43
|
+
Object.assign(this.data, updated.data);
|
|
44
|
+
return this;
|
|
43
45
|
}
|
|
44
46
|
has(property) {
|
|
45
47
|
return Boolean(this.data[property]);
|
|
@@ -50,6 +52,14 @@ class EmbedPlusBuilder extends EmbedBuilder {
|
|
|
50
52
|
toString(space = 2) {
|
|
51
53
|
return JSON.stringify(this, null, space);
|
|
52
54
|
}
|
|
55
|
+
setBorderColor(color) {
|
|
56
|
+
if (color === null) {
|
|
57
|
+
this.setColor("#2B2D31");
|
|
58
|
+
} else {
|
|
59
|
+
this.setColor(color);
|
|
60
|
+
}
|
|
61
|
+
return this;
|
|
62
|
+
}
|
|
53
63
|
setAsset(asset, source) {
|
|
54
64
|
const assetData = createEmbedAsset(source);
|
|
55
65
|
if (!assetData?.url)
|
|
@@ -6,9 +6,13 @@ var __publicField = (obj, key, value) => {
|
|
|
6
6
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
7
7
|
return value;
|
|
8
8
|
};
|
|
9
|
-
class
|
|
9
|
+
class EmbedPlusFields {
|
|
10
10
|
constructor(embed) {
|
|
11
11
|
__publicField(this, "embed");
|
|
12
|
+
Object.defineProperty(this, "embed", {
|
|
13
|
+
enumerable: false,
|
|
14
|
+
value: embed
|
|
15
|
+
});
|
|
12
16
|
this.embed = embed;
|
|
13
17
|
}
|
|
14
18
|
set fields(fields) {
|
|
@@ -90,4 +94,4 @@ class EmbedPlusField {
|
|
|
90
94
|
}
|
|
91
95
|
}
|
|
92
96
|
|
|
93
|
-
exports.
|
|
97
|
+
exports.EmbedPlusFields = EmbedPlusFields;
|
|
@@ -4,9 +4,13 @@ var __publicField = (obj, key, value) => {
|
|
|
4
4
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
5
|
return value;
|
|
6
6
|
};
|
|
7
|
-
class
|
|
7
|
+
class EmbedPlusFields {
|
|
8
8
|
constructor(embed) {
|
|
9
9
|
__publicField(this, "embed");
|
|
10
|
+
Object.defineProperty(this, "embed", {
|
|
11
|
+
enumerable: false,
|
|
12
|
+
value: embed
|
|
13
|
+
});
|
|
10
14
|
this.embed = embed;
|
|
11
15
|
}
|
|
12
16
|
set fields(fields) {
|
|
@@ -88,4 +92,4 @@ class EmbedPlusField {
|
|
|
88
92
|
}
|
|
89
93
|
}
|
|
90
94
|
|
|
91
|
-
export {
|
|
95
|
+
export { EmbedPlusFields };
|
|
@@ -11,6 +11,15 @@ function createModalFields(data) {
|
|
|
11
11
|
([customId, data2]) => createModalInput(Object.assign({ customId }, data2))
|
|
12
12
|
);
|
|
13
13
|
}
|
|
14
|
+
function modalFieldsToRecord(fields) {
|
|
15
|
+
const reduceFunction = (data, { customId, value }) => Object.assign(
|
|
16
|
+
data,
|
|
17
|
+
{ [customId]: value }
|
|
18
|
+
);
|
|
19
|
+
const modalFields = "fields" in fields ? fields.fields : fields;
|
|
20
|
+
return modalFields.reduce(reduceFunction, {});
|
|
21
|
+
}
|
|
14
22
|
|
|
15
23
|
exports.createModalFields = createModalFields;
|
|
16
24
|
exports.createModalInput = createModalInput;
|
|
25
|
+
exports.modalFieldsToRecord = modalFieldsToRecord;
|
|
@@ -9,5 +9,13 @@ function createModalFields(data) {
|
|
|
9
9
|
([customId, data2]) => createModalInput(Object.assign({ customId }, data2))
|
|
10
10
|
);
|
|
11
11
|
}
|
|
12
|
+
function modalFieldsToRecord(fields) {
|
|
13
|
+
const reduceFunction = (data, { customId, value }) => Object.assign(
|
|
14
|
+
data,
|
|
15
|
+
{ [customId]: value }
|
|
16
|
+
);
|
|
17
|
+
const modalFields = "fields" in fields ? fields.fields : fields;
|
|
18
|
+
return modalFields.reduce(reduceFunction, {});
|
|
19
|
+
}
|
|
12
20
|
|
|
13
|
-
export { createModalFields, createModalInput };
|
|
21
|
+
export { createModalFields, createModalInput, modalFieldsToRecord };
|
package/dist/index.cjs
CHANGED
|
@@ -33,6 +33,7 @@ exports.createLinkButton = components.createLinkButton;
|
|
|
33
33
|
exports.createRow = components.createRow;
|
|
34
34
|
exports.createModalFields = modals.createModalFields;
|
|
35
35
|
exports.createModalInput = modals.createModalInput;
|
|
36
|
+
exports.modalFieldsToRecord = modals.modalFieldsToRecord;
|
|
36
37
|
exports.findEmoji = emojis.findEmoji;
|
|
37
38
|
exports.formatedMention = format.formatedMention;
|
|
38
39
|
exports.findMember = members.findMember;
|
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, ButtonBuilder, ActionRow, MessageActionRowComponent, LinkButtonComponentData, ButtonComponent, StringSelectMenuComponent, UserSelectMenuComponent, ChannelSelectMenuComponent, RoleSelectMenuComponent, MentionableSelectMenuComponent, TextInputBuilder, TextInputComponentData, GuildEmoji, GuildBasedChannel, Role, User, GuildMember, GuildTextBasedChannel, Message, Attachment, AttachmentBuilder, EmbedAssetData, EmbedAuthorData, ImageURLOptions, EmbedFooterData, APIEmbed, Embed, EmbedBuilder, EmbedData, ColorResolvable } from 'discord.js';
|
|
2
|
+
import { GatewayIntentBits, Partials, ChannelType, Guild, CommandInteractionOption, Client, ApplicationCommand, AnyComponentBuilder, ActionRowBuilder, ButtonBuilder, ActionRow, MessageActionRowComponent, LinkButtonComponentData, ButtonComponent, StringSelectMenuComponent, UserSelectMenuComponent, ChannelSelectMenuComponent, RoleSelectMenuComponent, MentionableSelectMenuComponent, TextInputBuilder, ModalSubmitFields, Collection, TextInputComponent, TextInputComponentData, GuildEmoji, GuildBasedChannel, Role, User, GuildMember, GuildTextBasedChannel, Message, Attachment, AttachmentBuilder, EmbedAssetData, EmbedAuthorData, ImageURLOptions, EmbedFooterData, APIEmbed, Embed, EmbedBuilder, EmbedData, ColorResolvable } from 'discord.js';
|
|
3
3
|
export * from '@magicyan/core';
|
|
4
4
|
|
|
5
5
|
declare const chars: {
|
|
@@ -90,6 +90,8 @@ type CreateModalInputData = TextInputData;
|
|
|
90
90
|
declare function createModalInput(data: CreateModalInputData): ActionRowBuilder<TextInputBuilder>;
|
|
91
91
|
type ModalFieldsData = Record<string, Omit<TextInputData, "customId">>;
|
|
92
92
|
declare function createModalFields(data: ModalFieldsData): ActionRowBuilder<TextInputBuilder>[];
|
|
93
|
+
type ModalFieldsRecord = Record<string, string>;
|
|
94
|
+
declare function modalFieldsToRecord(fields: ModalSubmitFields | Collection<string, TextInputComponent>): ModalFieldsRecord;
|
|
93
95
|
|
|
94
96
|
type FindEmojiFilter = (emoji: GuildEmoji) => boolean;
|
|
95
97
|
declare function findEmoji(guildOrClient: Guild | Client): {
|
|
@@ -196,7 +198,7 @@ type EmbedPlusFieldData = {
|
|
|
196
198
|
inline?: boolean;
|
|
197
199
|
};
|
|
198
200
|
type FieldPredicate = (field: EmbedPlusFieldData, index: number, obj: EmbedPlusFieldData[]) => boolean;
|
|
199
|
-
declare class
|
|
201
|
+
declare class EmbedPlusFields {
|
|
200
202
|
private embed;
|
|
201
203
|
private set fields(value);
|
|
202
204
|
private get fields();
|
|
@@ -205,7 +207,7 @@ declare class EmbedPlusField {
|
|
|
205
207
|
next(): IteratorResult<EmbedPlusFieldData>;
|
|
206
208
|
};
|
|
207
209
|
get length(): number;
|
|
208
|
-
get record(): Record<string, string>;
|
|
210
|
+
get record(): Record<string, string | undefined>;
|
|
209
211
|
/**
|
|
210
212
|
* Get a filed by index
|
|
211
213
|
* @param name Field name
|
|
@@ -220,7 +222,7 @@ declare class EmbedPlusField {
|
|
|
220
222
|
push(...fields: EmbedPlusFieldData[]): void;
|
|
221
223
|
set(...fields: EmbedPlusFieldData[]): void;
|
|
222
224
|
update(predicate: string | number | FieldPredicate, field: Partial<EmbedPlusFieldData>): boolean;
|
|
223
|
-
delete(predicate: number | FieldPredicate): boolean;
|
|
225
|
+
delete(predicate: string | number | FieldPredicate): boolean;
|
|
224
226
|
toArray(): EmbedPlusFieldData[];
|
|
225
227
|
private getPredicateIndex;
|
|
226
228
|
}
|
|
@@ -255,11 +257,13 @@ interface EmbedPlusOptions extends EmbedPlusData {
|
|
|
255
257
|
mergeFields?: boolean;
|
|
256
258
|
}
|
|
257
259
|
declare class EmbedPlusBuilder extends EmbedBuilder {
|
|
258
|
-
fields:
|
|
260
|
+
fields: EmbedPlusFields;
|
|
259
261
|
constructor(data: EmbedPlusOptions);
|
|
262
|
+
update(data: EmbedPlusData): this;
|
|
260
263
|
has(property: keyof Omit<EmbedPlusData, keyof EmbedPlusOptions>): boolean;
|
|
261
264
|
toArray(): EmbedPlusBuilder[];
|
|
262
265
|
toString(space?: number): string;
|
|
266
|
+
setBorderColor(color: EmbedPlusColorData | null): this;
|
|
263
267
|
setAsset(asset: "thumbnail" | "image", source: EmbedPlusAssetData): this;
|
|
264
268
|
static fromInteraction(interaction: InteractionWithEmbeds, index?: number, data?: EmbedPlusData): EmbedPlusBuilder;
|
|
265
269
|
static fromMessage(message: MessageWithEmbeds, index?: number, data?: EmbedPlusData): EmbedPlusBuilder;
|
|
@@ -272,4 +276,4 @@ interface CreateEmbedOptions<B extends boolean> extends EmbedPlusOptions {
|
|
|
272
276
|
type CreateEmbedReturn<B> = undefined extends B ? EmbedPlusBuilder : false extends B ? EmbedPlusBuilder : EmbedPlusBuilder[];
|
|
273
277
|
declare function createEmbed<B extends boolean>(options: CreateEmbedOptions<B>): CreateEmbedReturn<B>;
|
|
274
278
|
|
|
275
|
-
export { type AnyEmbed, CustomItents, CustomPartials, type EmbedPlusAssetData, EmbedPlusBuilder, type EmbedPlusData, type EmbedPlusFooterData, type EmbedPlusProperty, chars, createComponentsManager, createEmbed, createEmbedAsset, createEmbedAuthor, createEmbedFooter, createLinkButton, createModalFields, createModalInput, createRow, extractMentionId, findChannel, findCommand, findEmoji, findMember, findMessage, findRole, formatedMention, getChannelUrlInfo, getMessageUrlInfo, setMobileStatus };
|
|
279
|
+
export { type AnyEmbed, CustomItents, CustomPartials, type EmbedPlusAssetData, EmbedPlusBuilder, type EmbedPlusData, type EmbedPlusFooterData, type EmbedPlusProperty, chars, createComponentsManager, createEmbed, createEmbedAsset, createEmbedAuthor, createEmbedFooter, createLinkButton, createModalFields, createModalInput, createRow, extractMentionId, findChannel, findCommand, findEmoji, findMember, findMessage, findRole, formatedMention, getChannelUrlInfo, getMessageUrlInfo, modalFieldsToRecord, setMobileStatus };
|
package/dist/index.d.mts
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, ButtonBuilder, ActionRow, MessageActionRowComponent, LinkButtonComponentData, ButtonComponent, StringSelectMenuComponent, UserSelectMenuComponent, ChannelSelectMenuComponent, RoleSelectMenuComponent, MentionableSelectMenuComponent, TextInputBuilder, TextInputComponentData, GuildEmoji, GuildBasedChannel, Role, User, GuildMember, GuildTextBasedChannel, Message, Attachment, AttachmentBuilder, EmbedAssetData, EmbedAuthorData, ImageURLOptions, EmbedFooterData, APIEmbed, Embed, EmbedBuilder, EmbedData, ColorResolvable } from 'discord.js';
|
|
2
|
+
import { GatewayIntentBits, Partials, ChannelType, Guild, CommandInteractionOption, Client, ApplicationCommand, AnyComponentBuilder, ActionRowBuilder, ButtonBuilder, ActionRow, MessageActionRowComponent, LinkButtonComponentData, ButtonComponent, StringSelectMenuComponent, UserSelectMenuComponent, ChannelSelectMenuComponent, RoleSelectMenuComponent, MentionableSelectMenuComponent, TextInputBuilder, ModalSubmitFields, Collection, TextInputComponent, TextInputComponentData, GuildEmoji, GuildBasedChannel, Role, User, GuildMember, GuildTextBasedChannel, Message, Attachment, AttachmentBuilder, EmbedAssetData, EmbedAuthorData, ImageURLOptions, EmbedFooterData, APIEmbed, Embed, EmbedBuilder, EmbedData, ColorResolvable } from 'discord.js';
|
|
3
3
|
export * from '@magicyan/core';
|
|
4
4
|
|
|
5
5
|
declare const chars: {
|
|
@@ -90,6 +90,8 @@ type CreateModalInputData = TextInputData;
|
|
|
90
90
|
declare function createModalInput(data: CreateModalInputData): ActionRowBuilder<TextInputBuilder>;
|
|
91
91
|
type ModalFieldsData = Record<string, Omit<TextInputData, "customId">>;
|
|
92
92
|
declare function createModalFields(data: ModalFieldsData): ActionRowBuilder<TextInputBuilder>[];
|
|
93
|
+
type ModalFieldsRecord = Record<string, string>;
|
|
94
|
+
declare function modalFieldsToRecord(fields: ModalSubmitFields | Collection<string, TextInputComponent>): ModalFieldsRecord;
|
|
93
95
|
|
|
94
96
|
type FindEmojiFilter = (emoji: GuildEmoji) => boolean;
|
|
95
97
|
declare function findEmoji(guildOrClient: Guild | Client): {
|
|
@@ -196,7 +198,7 @@ type EmbedPlusFieldData = {
|
|
|
196
198
|
inline?: boolean;
|
|
197
199
|
};
|
|
198
200
|
type FieldPredicate = (field: EmbedPlusFieldData, index: number, obj: EmbedPlusFieldData[]) => boolean;
|
|
199
|
-
declare class
|
|
201
|
+
declare class EmbedPlusFields {
|
|
200
202
|
private embed;
|
|
201
203
|
private set fields(value);
|
|
202
204
|
private get fields();
|
|
@@ -205,7 +207,7 @@ declare class EmbedPlusField {
|
|
|
205
207
|
next(): IteratorResult<EmbedPlusFieldData>;
|
|
206
208
|
};
|
|
207
209
|
get length(): number;
|
|
208
|
-
get record(): Record<string, string>;
|
|
210
|
+
get record(): Record<string, string | undefined>;
|
|
209
211
|
/**
|
|
210
212
|
* Get a filed by index
|
|
211
213
|
* @param name Field name
|
|
@@ -220,7 +222,7 @@ declare class EmbedPlusField {
|
|
|
220
222
|
push(...fields: EmbedPlusFieldData[]): void;
|
|
221
223
|
set(...fields: EmbedPlusFieldData[]): void;
|
|
222
224
|
update(predicate: string | number | FieldPredicate, field: Partial<EmbedPlusFieldData>): boolean;
|
|
223
|
-
delete(predicate: number | FieldPredicate): boolean;
|
|
225
|
+
delete(predicate: string | number | FieldPredicate): boolean;
|
|
224
226
|
toArray(): EmbedPlusFieldData[];
|
|
225
227
|
private getPredicateIndex;
|
|
226
228
|
}
|
|
@@ -255,11 +257,13 @@ interface EmbedPlusOptions extends EmbedPlusData {
|
|
|
255
257
|
mergeFields?: boolean;
|
|
256
258
|
}
|
|
257
259
|
declare class EmbedPlusBuilder extends EmbedBuilder {
|
|
258
|
-
fields:
|
|
260
|
+
fields: EmbedPlusFields;
|
|
259
261
|
constructor(data: EmbedPlusOptions);
|
|
262
|
+
update(data: EmbedPlusData): this;
|
|
260
263
|
has(property: keyof Omit<EmbedPlusData, keyof EmbedPlusOptions>): boolean;
|
|
261
264
|
toArray(): EmbedPlusBuilder[];
|
|
262
265
|
toString(space?: number): string;
|
|
266
|
+
setBorderColor(color: EmbedPlusColorData | null): this;
|
|
263
267
|
setAsset(asset: "thumbnail" | "image", source: EmbedPlusAssetData): this;
|
|
264
268
|
static fromInteraction(interaction: InteractionWithEmbeds, index?: number, data?: EmbedPlusData): EmbedPlusBuilder;
|
|
265
269
|
static fromMessage(message: MessageWithEmbeds, index?: number, data?: EmbedPlusData): EmbedPlusBuilder;
|
|
@@ -272,4 +276,4 @@ interface CreateEmbedOptions<B extends boolean> extends EmbedPlusOptions {
|
|
|
272
276
|
type CreateEmbedReturn<B> = undefined extends B ? EmbedPlusBuilder : false extends B ? EmbedPlusBuilder : EmbedPlusBuilder[];
|
|
273
277
|
declare function createEmbed<B extends boolean>(options: CreateEmbedOptions<B>): CreateEmbedReturn<B>;
|
|
274
278
|
|
|
275
|
-
export { type AnyEmbed, CustomItents, CustomPartials, type EmbedPlusAssetData, EmbedPlusBuilder, type EmbedPlusData, type EmbedPlusFooterData, type EmbedPlusProperty, chars, createComponentsManager, createEmbed, createEmbedAsset, createEmbedAuthor, createEmbedFooter, createLinkButton, createModalFields, createModalInput, createRow, extractMentionId, findChannel, findCommand, findEmoji, findMember, findMessage, findRole, formatedMention, getChannelUrlInfo, getMessageUrlInfo, setMobileStatus };
|
|
279
|
+
export { type AnyEmbed, CustomItents, CustomPartials, type EmbedPlusAssetData, EmbedPlusBuilder, type EmbedPlusData, type EmbedPlusFooterData, type EmbedPlusProperty, chars, createComponentsManager, createEmbed, createEmbedAsset, createEmbedAuthor, createEmbedFooter, createLinkButton, createModalFields, createModalInput, createRow, extractMentionId, findChannel, findCommand, findEmoji, findMember, findMessage, findRole, formatedMention, getChannelUrlInfo, getMessageUrlInfo, modalFieldsToRecord, setMobileStatus };
|
package/dist/index.d.ts
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, ButtonBuilder, ActionRow, MessageActionRowComponent, LinkButtonComponentData, ButtonComponent, StringSelectMenuComponent, UserSelectMenuComponent, ChannelSelectMenuComponent, RoleSelectMenuComponent, MentionableSelectMenuComponent, TextInputBuilder, TextInputComponentData, GuildEmoji, GuildBasedChannel, Role, User, GuildMember, GuildTextBasedChannel, Message, Attachment, AttachmentBuilder, EmbedAssetData, EmbedAuthorData, ImageURLOptions, EmbedFooterData, APIEmbed, Embed, EmbedBuilder, EmbedData, ColorResolvable } from 'discord.js';
|
|
2
|
+
import { GatewayIntentBits, Partials, ChannelType, Guild, CommandInteractionOption, Client, ApplicationCommand, AnyComponentBuilder, ActionRowBuilder, ButtonBuilder, ActionRow, MessageActionRowComponent, LinkButtonComponentData, ButtonComponent, StringSelectMenuComponent, UserSelectMenuComponent, ChannelSelectMenuComponent, RoleSelectMenuComponent, MentionableSelectMenuComponent, TextInputBuilder, ModalSubmitFields, Collection, TextInputComponent, TextInputComponentData, GuildEmoji, GuildBasedChannel, Role, User, GuildMember, GuildTextBasedChannel, Message, Attachment, AttachmentBuilder, EmbedAssetData, EmbedAuthorData, ImageURLOptions, EmbedFooterData, APIEmbed, Embed, EmbedBuilder, EmbedData, ColorResolvable } from 'discord.js';
|
|
3
3
|
export * from '@magicyan/core';
|
|
4
4
|
|
|
5
5
|
declare const chars: {
|
|
@@ -90,6 +90,8 @@ type CreateModalInputData = TextInputData;
|
|
|
90
90
|
declare function createModalInput(data: CreateModalInputData): ActionRowBuilder<TextInputBuilder>;
|
|
91
91
|
type ModalFieldsData = Record<string, Omit<TextInputData, "customId">>;
|
|
92
92
|
declare function createModalFields(data: ModalFieldsData): ActionRowBuilder<TextInputBuilder>[];
|
|
93
|
+
type ModalFieldsRecord = Record<string, string>;
|
|
94
|
+
declare function modalFieldsToRecord(fields: ModalSubmitFields | Collection<string, TextInputComponent>): ModalFieldsRecord;
|
|
93
95
|
|
|
94
96
|
type FindEmojiFilter = (emoji: GuildEmoji) => boolean;
|
|
95
97
|
declare function findEmoji(guildOrClient: Guild | Client): {
|
|
@@ -196,7 +198,7 @@ type EmbedPlusFieldData = {
|
|
|
196
198
|
inline?: boolean;
|
|
197
199
|
};
|
|
198
200
|
type FieldPredicate = (field: EmbedPlusFieldData, index: number, obj: EmbedPlusFieldData[]) => boolean;
|
|
199
|
-
declare class
|
|
201
|
+
declare class EmbedPlusFields {
|
|
200
202
|
private embed;
|
|
201
203
|
private set fields(value);
|
|
202
204
|
private get fields();
|
|
@@ -205,7 +207,7 @@ declare class EmbedPlusField {
|
|
|
205
207
|
next(): IteratorResult<EmbedPlusFieldData>;
|
|
206
208
|
};
|
|
207
209
|
get length(): number;
|
|
208
|
-
get record(): Record<string, string>;
|
|
210
|
+
get record(): Record<string, string | undefined>;
|
|
209
211
|
/**
|
|
210
212
|
* Get a filed by index
|
|
211
213
|
* @param name Field name
|
|
@@ -220,7 +222,7 @@ declare class EmbedPlusField {
|
|
|
220
222
|
push(...fields: EmbedPlusFieldData[]): void;
|
|
221
223
|
set(...fields: EmbedPlusFieldData[]): void;
|
|
222
224
|
update(predicate: string | number | FieldPredicate, field: Partial<EmbedPlusFieldData>): boolean;
|
|
223
|
-
delete(predicate: number | FieldPredicate): boolean;
|
|
225
|
+
delete(predicate: string | number | FieldPredicate): boolean;
|
|
224
226
|
toArray(): EmbedPlusFieldData[];
|
|
225
227
|
private getPredicateIndex;
|
|
226
228
|
}
|
|
@@ -255,11 +257,13 @@ interface EmbedPlusOptions extends EmbedPlusData {
|
|
|
255
257
|
mergeFields?: boolean;
|
|
256
258
|
}
|
|
257
259
|
declare class EmbedPlusBuilder extends EmbedBuilder {
|
|
258
|
-
fields:
|
|
260
|
+
fields: EmbedPlusFields;
|
|
259
261
|
constructor(data: EmbedPlusOptions);
|
|
262
|
+
update(data: EmbedPlusData): this;
|
|
260
263
|
has(property: keyof Omit<EmbedPlusData, keyof EmbedPlusOptions>): boolean;
|
|
261
264
|
toArray(): EmbedPlusBuilder[];
|
|
262
265
|
toString(space?: number): string;
|
|
266
|
+
setBorderColor(color: EmbedPlusColorData | null): this;
|
|
263
267
|
setAsset(asset: "thumbnail" | "image", source: EmbedPlusAssetData): this;
|
|
264
268
|
static fromInteraction(interaction: InteractionWithEmbeds, index?: number, data?: EmbedPlusData): EmbedPlusBuilder;
|
|
265
269
|
static fromMessage(message: MessageWithEmbeds, index?: number, data?: EmbedPlusData): EmbedPlusBuilder;
|
|
@@ -272,4 +276,4 @@ interface CreateEmbedOptions<B extends boolean> extends EmbedPlusOptions {
|
|
|
272
276
|
type CreateEmbedReturn<B> = undefined extends B ? EmbedPlusBuilder : false extends B ? EmbedPlusBuilder : EmbedPlusBuilder[];
|
|
273
277
|
declare function createEmbed<B extends boolean>(options: CreateEmbedOptions<B>): CreateEmbedReturn<B>;
|
|
274
278
|
|
|
275
|
-
export { type AnyEmbed, CustomItents, CustomPartials, type EmbedPlusAssetData, EmbedPlusBuilder, type EmbedPlusData, type EmbedPlusFooterData, type EmbedPlusProperty, chars, createComponentsManager, createEmbed, createEmbedAsset, createEmbedAuthor, createEmbedFooter, createLinkButton, createModalFields, createModalInput, createRow, extractMentionId, findChannel, findCommand, findEmoji, findMember, findMessage, findRole, formatedMention, getChannelUrlInfo, getMessageUrlInfo, setMobileStatus };
|
|
279
|
+
export { type AnyEmbed, CustomItents, CustomPartials, type EmbedPlusAssetData, EmbedPlusBuilder, type EmbedPlusData, type EmbedPlusFooterData, type EmbedPlusProperty, chars, createComponentsManager, createEmbed, createEmbedAsset, createEmbedAuthor, createEmbedFooter, createLinkButton, createModalFields, createModalInput, createRow, extractMentionId, findChannel, findCommand, findEmoji, findMember, findMessage, findRole, formatedMention, getChannelUrlInfo, getMessageUrlInfo, modalFieldsToRecord, setMobileStatus };
|
package/dist/index.mjs
CHANGED
|
@@ -4,7 +4,7 @@ export { setMobileStatus } from './functions/misc.mjs';
|
|
|
4
4
|
export { findChannel, getChannelUrlInfo } from './functions/channels.mjs';
|
|
5
5
|
export { findCommand } from './functions/commands.mjs';
|
|
6
6
|
export { createComponentsManager, createLinkButton, createRow } from './functions/components.mjs';
|
|
7
|
-
export { createModalFields, createModalInput } from './functions/modals.mjs';
|
|
7
|
+
export { createModalFields, createModalInput, modalFieldsToRecord } from './functions/modals.mjs';
|
|
8
8
|
export { findEmoji } from './functions/emojis.mjs';
|
|
9
9
|
export { formatedMention } from './functions/format.mjs';
|
|
10
10
|
export { findMember } from './functions/members.mjs';
|