@magicyan/discord 1.0.32 → 1.0.34
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 +2 -0
- package/dist/functions/embeds/embedplus.mjs +2 -0
- package/dist/functions/embeds/fields.cjs +10 -2
- package/dist/functions/embeds/fields.mjs +10 -2
- package/dist/functions/embeds/files.cjs +4 -4
- package/dist/functions/embeds/files.mjs +4 -4
- package/dist/functions/modals.cjs +1 -0
- package/dist/functions/modals.mjs +2 -1
- package/dist/index.d.cts +16 -9
- package/dist/index.d.mts +16 -9
- package/dist/index.d.ts +16 -9
- package/package.json +2 -2
|
@@ -22,6 +22,8 @@ class EmbedPlusBuilder extends discord_js.EmbedBuilder {
|
|
|
22
22
|
field.inline !== void 0 ? { inline: field.inline } : {}
|
|
23
23
|
));
|
|
24
24
|
const builderData = Object.assign({}, extendsData, embedData, { fields: fields$1 });
|
|
25
|
+
if (builderData.url)
|
|
26
|
+
builderData.url = builderData.url.toString();
|
|
25
27
|
const { color, footer: footer$1, image, thumbnail, timestamp } = embedData;
|
|
26
28
|
if (footer$1)
|
|
27
29
|
Object.assign(builderData, { footer: footer.createEmbedFooter(footer$1) });
|
|
@@ -20,6 +20,8 @@ class EmbedPlusBuilder extends EmbedBuilder {
|
|
|
20
20
|
field.inline !== void 0 ? { inline: field.inline } : {}
|
|
21
21
|
));
|
|
22
22
|
const builderData = Object.assign({}, extendsData, embedData, { fields });
|
|
23
|
+
if (builderData.url)
|
|
24
|
+
builderData.url = builderData.url.toString();
|
|
23
25
|
const { color, footer, image, thumbnail, timestamp } = embedData;
|
|
24
26
|
if (footer)
|
|
25
27
|
Object.assign(builderData, { footer: createEmbedFooter(footer) });
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
const chars = require('../../constants/chars.cjs');
|
|
4
|
+
|
|
3
5
|
var __defProp = Object.defineProperty;
|
|
4
6
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
5
7
|
var __publicField = (obj, key, value) => {
|
|
@@ -48,10 +50,10 @@ class EmbedPlusFields {
|
|
|
48
50
|
return this.fields.find(predicate);
|
|
49
51
|
}
|
|
50
52
|
push(...fields) {
|
|
51
|
-
this.embed.addFields(fields);
|
|
53
|
+
this.embed.addFields(fields.map(this.fieldFormat));
|
|
52
54
|
}
|
|
53
55
|
set(...fields) {
|
|
54
|
-
this.embed.setFields(fields);
|
|
56
|
+
this.embed.setFields(fields.map(this.fieldFormat));
|
|
55
57
|
}
|
|
56
58
|
map(callback) {
|
|
57
59
|
return this.toArray().map(callback);
|
|
@@ -98,6 +100,12 @@ class EmbedPlusFields {
|
|
|
98
100
|
return -1;
|
|
99
101
|
}
|
|
100
102
|
}
|
|
103
|
+
fieldFormat(field) {
|
|
104
|
+
return Object.assign(
|
|
105
|
+
{ name: field.name ?? chars.chars.invisible, value: field.value ?? chars.chars.invisible },
|
|
106
|
+
field.inline !== void 0 ? { inline: field.inline } : {}
|
|
107
|
+
);
|
|
108
|
+
}
|
|
101
109
|
}
|
|
102
110
|
|
|
103
111
|
exports.EmbedPlusFields = EmbedPlusFields;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { chars } from '../../constants/chars.mjs';
|
|
2
|
+
|
|
1
3
|
var __defProp = Object.defineProperty;
|
|
2
4
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
5
|
var __publicField = (obj, key, value) => {
|
|
@@ -46,10 +48,10 @@ class EmbedPlusFields {
|
|
|
46
48
|
return this.fields.find(predicate);
|
|
47
49
|
}
|
|
48
50
|
push(...fields) {
|
|
49
|
-
this.embed.addFields(fields);
|
|
51
|
+
this.embed.addFields(fields.map(this.fieldFormat));
|
|
50
52
|
}
|
|
51
53
|
set(...fields) {
|
|
52
|
-
this.embed.setFields(fields);
|
|
54
|
+
this.embed.setFields(fields.map(this.fieldFormat));
|
|
53
55
|
}
|
|
54
56
|
map(callback) {
|
|
55
57
|
return this.toArray().map(callback);
|
|
@@ -96,6 +98,12 @@ class EmbedPlusFields {
|
|
|
96
98
|
return -1;
|
|
97
99
|
}
|
|
98
100
|
}
|
|
101
|
+
fieldFormat(field) {
|
|
102
|
+
return Object.assign(
|
|
103
|
+
{ name: field.name ?? chars.invisible, value: field.value ?? chars.invisible },
|
|
104
|
+
field.inline !== void 0 ? { inline: field.inline } : {}
|
|
105
|
+
);
|
|
106
|
+
}
|
|
99
107
|
}
|
|
100
108
|
|
|
101
109
|
export { EmbedPlusFields };
|
|
@@ -9,19 +9,19 @@ function createEmbedFiles(embed, options) {
|
|
|
9
9
|
files.push(new discord_js.AttachmentBuilder(url, { name: `${name}.${ext}` }));
|
|
10
10
|
return `attachment://${name}.${ext}`;
|
|
11
11
|
};
|
|
12
|
-
if (thumbnail?.url) {
|
|
12
|
+
if (thumbnail?.url && !options?.ignore?.includes("thumbnail")) {
|
|
13
13
|
const url = handle(thumbnail.url, "thumbnail", options?.extentions?.thumbnail);
|
|
14
14
|
embed.setThumbnail(url);
|
|
15
15
|
}
|
|
16
|
-
if (image?.url) {
|
|
16
|
+
if (image?.url && !options?.ignore?.includes("image")) {
|
|
17
17
|
const url = handle(image.url, "image", options?.extentions?.image);
|
|
18
18
|
embed.setImage(url);
|
|
19
19
|
}
|
|
20
|
-
if (author?.icon_url) {
|
|
20
|
+
if (author?.icon_url && !options?.ignore?.includes("author")) {
|
|
21
21
|
const url = handle(author?.icon_url, "author", options?.extentions?.author);
|
|
22
22
|
embed.setAuthor({ name: author.name, iconURL: url, url: author.url });
|
|
23
23
|
}
|
|
24
|
-
if (footer?.icon_url) {
|
|
24
|
+
if (footer?.icon_url && !options?.ignore?.includes("footer")) {
|
|
25
25
|
const url = handle(footer.icon_url, "footer", options?.extentions?.footer);
|
|
26
26
|
embed.setFooter({ text: footer.text, iconURL: url });
|
|
27
27
|
}
|
|
@@ -7,19 +7,19 @@ function createEmbedFiles(embed, options) {
|
|
|
7
7
|
files.push(new AttachmentBuilder(url, { name: `${name}.${ext}` }));
|
|
8
8
|
return `attachment://${name}.${ext}`;
|
|
9
9
|
};
|
|
10
|
-
if (thumbnail?.url) {
|
|
10
|
+
if (thumbnail?.url && !options?.ignore?.includes("thumbnail")) {
|
|
11
11
|
const url = handle(thumbnail.url, "thumbnail", options?.extentions?.thumbnail);
|
|
12
12
|
embed.setThumbnail(url);
|
|
13
13
|
}
|
|
14
|
-
if (image?.url) {
|
|
14
|
+
if (image?.url && !options?.ignore?.includes("image")) {
|
|
15
15
|
const url = handle(image.url, "image", options?.extentions?.image);
|
|
16
16
|
embed.setImage(url);
|
|
17
17
|
}
|
|
18
|
-
if (author?.icon_url) {
|
|
18
|
+
if (author?.icon_url && !options?.ignore?.includes("author")) {
|
|
19
19
|
const url = handle(author?.icon_url, "author", options?.extentions?.author);
|
|
20
20
|
embed.setAuthor({ name: author.name, iconURL: url, url: author.url });
|
|
21
21
|
}
|
|
22
|
-
if (footer?.icon_url) {
|
|
22
|
+
if (footer?.icon_url && !options?.ignore?.includes("footer")) {
|
|
23
23
|
const url = handle(footer.icon_url, "footer", options?.extentions?.footer);
|
|
24
24
|
embed.setFooter({ text: footer.text, iconURL: url });
|
|
25
25
|
}
|
|
@@ -4,6 +4,7 @@ const discord_js = require('discord.js');
|
|
|
4
4
|
const components = require('./components.cjs');
|
|
5
5
|
|
|
6
6
|
function createModalInput(data) {
|
|
7
|
+
data.style ?? (data.style = discord_js.TextInputStyle.Short);
|
|
7
8
|
return components.createRow(new discord_js.TextInputBuilder(data));
|
|
8
9
|
}
|
|
9
10
|
function createModalFields(data) {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { TextInputBuilder } from 'discord.js';
|
|
1
|
+
import { TextInputStyle, TextInputBuilder } from 'discord.js';
|
|
2
2
|
import { createRow } from './components.mjs';
|
|
3
3
|
|
|
4
4
|
function createModalInput(data) {
|
|
5
|
+
data.style ?? (data.style = TextInputStyle.Short);
|
|
5
6
|
return createRow(new TextInputBuilder(data));
|
|
6
7
|
}
|
|
7
8
|
function createModalFields(data) {
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as discord_js from 'discord.js';
|
|
2
|
-
import { GatewayIntentBits, Partials, Attachment, AttachmentBuilder, EmbedAssetData, Guild, GuildMember, User, ClientUser, ImageURLOptions, EmbedFooterData, ColorResolvable, APIEmbed, Embed, EmbedData, EmbedBuilder, AttachmentData, AnyComponentBuilder, ActionRowBuilder, ButtonBuilder, LinkButtonComponentData, ChannelType, CommandInteractionOption, Client, ApplicationCommand, ApplicationCommandOptionData, ApplicationCommandSubCommandData, ApplicationCommandSubGroupData, TextInputBuilder, ModalSubmitFields, Collection, TextInputComponent, TextInputComponentData, GuildEmoji, GuildTextBasedChannel, Message, Role } from 'discord.js';
|
|
2
|
+
import { GatewayIntentBits, Partials, Attachment, AttachmentBuilder, EmbedAssetData, Guild, GuildMember, User, ClientUser, ImageURLOptions, EmbedFooterData, ColorResolvable, APIEmbed, Embed, EmbedData, EmbedBuilder, AttachmentData, AnyComponentBuilder, ActionRowBuilder, ButtonBuilder, LinkButtonComponentData, ChannelType, CommandInteractionOption, Client, ApplicationCommand, ApplicationCommandOptionData, ApplicationCommandSubCommandData, ApplicationCommandSubGroupData, TextInputBuilder, ModalSubmitFields, Collection, TextInputComponent, TextInputStyle, TextInputComponentData, GuildEmoji, GuildTextBasedChannel, Message, Role } from 'discord.js';
|
|
3
3
|
export * from '@magicyan/core';
|
|
4
4
|
|
|
5
5
|
declare const chars: {
|
|
@@ -77,8 +77,8 @@ declare class EmbedPlusFields {
|
|
|
77
77
|
*/
|
|
78
78
|
get(index: number): EmbedPlusFieldData | undefined;
|
|
79
79
|
find(predicate: FieldPredicate): EmbedPlusFieldData | undefined;
|
|
80
|
-
push(...fields: EmbedPlusFieldData[]): void;
|
|
81
|
-
set(...fields: EmbedPlusFieldData[]): void;
|
|
80
|
+
push(...fields: Partial<EmbedPlusFieldData>[]): void;
|
|
81
|
+
set(...fields: Partial<EmbedPlusFieldData>[]): void;
|
|
82
82
|
map<U>(callback: (value: EmbedPlusFieldData, index: number, array: EmbedPlusFieldData[]) => U): U[];
|
|
83
83
|
update(predicate: string | number | FieldPredicate, field: Partial<EmbedPlusFieldData>): boolean;
|
|
84
84
|
delete(predicate: string | number | FieldPredicate): boolean;
|
|
@@ -88,6 +88,7 @@ declare class EmbedPlusFields {
|
|
|
88
88
|
clear(): this;
|
|
89
89
|
toArray(): EmbedPlusFieldData[];
|
|
90
90
|
private getPredicateIndex;
|
|
91
|
+
private fieldFormat;
|
|
91
92
|
}
|
|
92
93
|
|
|
93
94
|
type EmbedPlusFooterData = {
|
|
@@ -106,7 +107,9 @@ interface EmbedPlusData {
|
|
|
106
107
|
title?: string | null;
|
|
107
108
|
color?: EmbedPlusColorData | null;
|
|
108
109
|
description?: string | null;
|
|
109
|
-
url?: string | null
|
|
110
|
+
url?: string | null | {
|
|
111
|
+
toString(): string;
|
|
112
|
+
};
|
|
110
113
|
thumbnail?: EmbedPlusAssetData;
|
|
111
114
|
image?: EmbedPlusAssetData;
|
|
112
115
|
fields?: Partial<EmbedPlusFieldData>[] | null;
|
|
@@ -151,13 +154,13 @@ declare function createEmbed<B extends boolean>(options: CreateEmbedOptions<B>):
|
|
|
151
154
|
type ImageFileExtention = "png" | "jpg" | "gif" | "webp";
|
|
152
155
|
type ImageElementProperty = "author" | "thumbnail" | "image" | "footer";
|
|
153
156
|
interface CreateEmbedFilesOptions {
|
|
157
|
+
ignore?: ImageElementProperty[];
|
|
154
158
|
extentions?: Record<ImageElementProperty, ImageFileExtention>;
|
|
155
159
|
}
|
|
156
160
|
/**
|
|
157
|
-
*
|
|
158
161
|
* Turns any embed image url into an attachment and returns an attachment array
|
|
159
162
|
*/
|
|
160
|
-
declare function createEmbedFiles(embed:
|
|
163
|
+
declare function createEmbedFiles(embed: EmbedBuilder, options?: CreateEmbedFilesOptions): AttachmentBuilder[];
|
|
161
164
|
|
|
162
165
|
declare function createRow<Component extends AnyComponentBuilder>(...components: Component[]): ActionRowBuilder<Component>;
|
|
163
166
|
interface CreateLinkButtonData extends Omit<LinkButtonComponentData, "style" | "type"> {
|
|
@@ -233,9 +236,13 @@ type SubCommandGroups = Record<string, SubCommandGroup>;
|
|
|
233
236
|
declare function createSubCommandsGroups(groups: SubCommandGroups): ApplicationCommandSubGroupData[];
|
|
234
237
|
|
|
235
238
|
type TextInputData = Omit<TextInputComponentData, "type">;
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
+
interface ModalFieldData extends Omit<TextInputData, "customId" | "style"> {
|
|
240
|
+
style?: TextInputStyle;
|
|
241
|
+
}
|
|
242
|
+
declare function createModalInput(data: ModalFieldData & {
|
|
243
|
+
customId: string;
|
|
244
|
+
}): ActionRowBuilder<TextInputBuilder>;
|
|
245
|
+
type ModalFieldsData = Record<string, ModalFieldData>;
|
|
239
246
|
declare function createModalFields(data: ModalFieldsData): ActionRowBuilder<TextInputBuilder>[];
|
|
240
247
|
type ModalFieldsRecord<K extends string> = Record<K, string>;
|
|
241
248
|
declare function modalFieldsToRecord<K extends string = string>(fields: ModalSubmitFields | Collection<string, TextInputComponent>): ModalFieldsRecord<K>;
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as discord_js from 'discord.js';
|
|
2
|
-
import { GatewayIntentBits, Partials, Attachment, AttachmentBuilder, EmbedAssetData, Guild, GuildMember, User, ClientUser, ImageURLOptions, EmbedFooterData, ColorResolvable, APIEmbed, Embed, EmbedData, EmbedBuilder, AttachmentData, AnyComponentBuilder, ActionRowBuilder, ButtonBuilder, LinkButtonComponentData, ChannelType, CommandInteractionOption, Client, ApplicationCommand, ApplicationCommandOptionData, ApplicationCommandSubCommandData, ApplicationCommandSubGroupData, TextInputBuilder, ModalSubmitFields, Collection, TextInputComponent, TextInputComponentData, GuildEmoji, GuildTextBasedChannel, Message, Role } from 'discord.js';
|
|
2
|
+
import { GatewayIntentBits, Partials, Attachment, AttachmentBuilder, EmbedAssetData, Guild, GuildMember, User, ClientUser, ImageURLOptions, EmbedFooterData, ColorResolvable, APIEmbed, Embed, EmbedData, EmbedBuilder, AttachmentData, AnyComponentBuilder, ActionRowBuilder, ButtonBuilder, LinkButtonComponentData, ChannelType, CommandInteractionOption, Client, ApplicationCommand, ApplicationCommandOptionData, ApplicationCommandSubCommandData, ApplicationCommandSubGroupData, TextInputBuilder, ModalSubmitFields, Collection, TextInputComponent, TextInputStyle, TextInputComponentData, GuildEmoji, GuildTextBasedChannel, Message, Role } from 'discord.js';
|
|
3
3
|
export * from '@magicyan/core';
|
|
4
4
|
|
|
5
5
|
declare const chars: {
|
|
@@ -77,8 +77,8 @@ declare class EmbedPlusFields {
|
|
|
77
77
|
*/
|
|
78
78
|
get(index: number): EmbedPlusFieldData | undefined;
|
|
79
79
|
find(predicate: FieldPredicate): EmbedPlusFieldData | undefined;
|
|
80
|
-
push(...fields: EmbedPlusFieldData[]): void;
|
|
81
|
-
set(...fields: EmbedPlusFieldData[]): void;
|
|
80
|
+
push(...fields: Partial<EmbedPlusFieldData>[]): void;
|
|
81
|
+
set(...fields: Partial<EmbedPlusFieldData>[]): void;
|
|
82
82
|
map<U>(callback: (value: EmbedPlusFieldData, index: number, array: EmbedPlusFieldData[]) => U): U[];
|
|
83
83
|
update(predicate: string | number | FieldPredicate, field: Partial<EmbedPlusFieldData>): boolean;
|
|
84
84
|
delete(predicate: string | number | FieldPredicate): boolean;
|
|
@@ -88,6 +88,7 @@ declare class EmbedPlusFields {
|
|
|
88
88
|
clear(): this;
|
|
89
89
|
toArray(): EmbedPlusFieldData[];
|
|
90
90
|
private getPredicateIndex;
|
|
91
|
+
private fieldFormat;
|
|
91
92
|
}
|
|
92
93
|
|
|
93
94
|
type EmbedPlusFooterData = {
|
|
@@ -106,7 +107,9 @@ interface EmbedPlusData {
|
|
|
106
107
|
title?: string | null;
|
|
107
108
|
color?: EmbedPlusColorData | null;
|
|
108
109
|
description?: string | null;
|
|
109
|
-
url?: string | null
|
|
110
|
+
url?: string | null | {
|
|
111
|
+
toString(): string;
|
|
112
|
+
};
|
|
110
113
|
thumbnail?: EmbedPlusAssetData;
|
|
111
114
|
image?: EmbedPlusAssetData;
|
|
112
115
|
fields?: Partial<EmbedPlusFieldData>[] | null;
|
|
@@ -151,13 +154,13 @@ declare function createEmbed<B extends boolean>(options: CreateEmbedOptions<B>):
|
|
|
151
154
|
type ImageFileExtention = "png" | "jpg" | "gif" | "webp";
|
|
152
155
|
type ImageElementProperty = "author" | "thumbnail" | "image" | "footer";
|
|
153
156
|
interface CreateEmbedFilesOptions {
|
|
157
|
+
ignore?: ImageElementProperty[];
|
|
154
158
|
extentions?: Record<ImageElementProperty, ImageFileExtention>;
|
|
155
159
|
}
|
|
156
160
|
/**
|
|
157
|
-
*
|
|
158
161
|
* Turns any embed image url into an attachment and returns an attachment array
|
|
159
162
|
*/
|
|
160
|
-
declare function createEmbedFiles(embed:
|
|
163
|
+
declare function createEmbedFiles(embed: EmbedBuilder, options?: CreateEmbedFilesOptions): AttachmentBuilder[];
|
|
161
164
|
|
|
162
165
|
declare function createRow<Component extends AnyComponentBuilder>(...components: Component[]): ActionRowBuilder<Component>;
|
|
163
166
|
interface CreateLinkButtonData extends Omit<LinkButtonComponentData, "style" | "type"> {
|
|
@@ -233,9 +236,13 @@ type SubCommandGroups = Record<string, SubCommandGroup>;
|
|
|
233
236
|
declare function createSubCommandsGroups(groups: SubCommandGroups): ApplicationCommandSubGroupData[];
|
|
234
237
|
|
|
235
238
|
type TextInputData = Omit<TextInputComponentData, "type">;
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
+
interface ModalFieldData extends Omit<TextInputData, "customId" | "style"> {
|
|
240
|
+
style?: TextInputStyle;
|
|
241
|
+
}
|
|
242
|
+
declare function createModalInput(data: ModalFieldData & {
|
|
243
|
+
customId: string;
|
|
244
|
+
}): ActionRowBuilder<TextInputBuilder>;
|
|
245
|
+
type ModalFieldsData = Record<string, ModalFieldData>;
|
|
239
246
|
declare function createModalFields(data: ModalFieldsData): ActionRowBuilder<TextInputBuilder>[];
|
|
240
247
|
type ModalFieldsRecord<K extends string> = Record<K, string>;
|
|
241
248
|
declare function modalFieldsToRecord<K extends string = string>(fields: ModalSubmitFields | Collection<string, TextInputComponent>): ModalFieldsRecord<K>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as discord_js from 'discord.js';
|
|
2
|
-
import { GatewayIntentBits, Partials, Attachment, AttachmentBuilder, EmbedAssetData, Guild, GuildMember, User, ClientUser, ImageURLOptions, EmbedFooterData, ColorResolvable, APIEmbed, Embed, EmbedData, EmbedBuilder, AttachmentData, AnyComponentBuilder, ActionRowBuilder, ButtonBuilder, LinkButtonComponentData, ChannelType, CommandInteractionOption, Client, ApplicationCommand, ApplicationCommandOptionData, ApplicationCommandSubCommandData, ApplicationCommandSubGroupData, TextInputBuilder, ModalSubmitFields, Collection, TextInputComponent, TextInputComponentData, GuildEmoji, GuildTextBasedChannel, Message, Role } from 'discord.js';
|
|
2
|
+
import { GatewayIntentBits, Partials, Attachment, AttachmentBuilder, EmbedAssetData, Guild, GuildMember, User, ClientUser, ImageURLOptions, EmbedFooterData, ColorResolvable, APIEmbed, Embed, EmbedData, EmbedBuilder, AttachmentData, AnyComponentBuilder, ActionRowBuilder, ButtonBuilder, LinkButtonComponentData, ChannelType, CommandInteractionOption, Client, ApplicationCommand, ApplicationCommandOptionData, ApplicationCommandSubCommandData, ApplicationCommandSubGroupData, TextInputBuilder, ModalSubmitFields, Collection, TextInputComponent, TextInputStyle, TextInputComponentData, GuildEmoji, GuildTextBasedChannel, Message, Role } from 'discord.js';
|
|
3
3
|
export * from '@magicyan/core';
|
|
4
4
|
|
|
5
5
|
declare const chars: {
|
|
@@ -77,8 +77,8 @@ declare class EmbedPlusFields {
|
|
|
77
77
|
*/
|
|
78
78
|
get(index: number): EmbedPlusFieldData | undefined;
|
|
79
79
|
find(predicate: FieldPredicate): EmbedPlusFieldData | undefined;
|
|
80
|
-
push(...fields: EmbedPlusFieldData[]): void;
|
|
81
|
-
set(...fields: EmbedPlusFieldData[]): void;
|
|
80
|
+
push(...fields: Partial<EmbedPlusFieldData>[]): void;
|
|
81
|
+
set(...fields: Partial<EmbedPlusFieldData>[]): void;
|
|
82
82
|
map<U>(callback: (value: EmbedPlusFieldData, index: number, array: EmbedPlusFieldData[]) => U): U[];
|
|
83
83
|
update(predicate: string | number | FieldPredicate, field: Partial<EmbedPlusFieldData>): boolean;
|
|
84
84
|
delete(predicate: string | number | FieldPredicate): boolean;
|
|
@@ -88,6 +88,7 @@ declare class EmbedPlusFields {
|
|
|
88
88
|
clear(): this;
|
|
89
89
|
toArray(): EmbedPlusFieldData[];
|
|
90
90
|
private getPredicateIndex;
|
|
91
|
+
private fieldFormat;
|
|
91
92
|
}
|
|
92
93
|
|
|
93
94
|
type EmbedPlusFooterData = {
|
|
@@ -106,7 +107,9 @@ interface EmbedPlusData {
|
|
|
106
107
|
title?: string | null;
|
|
107
108
|
color?: EmbedPlusColorData | null;
|
|
108
109
|
description?: string | null;
|
|
109
|
-
url?: string | null
|
|
110
|
+
url?: string | null | {
|
|
111
|
+
toString(): string;
|
|
112
|
+
};
|
|
110
113
|
thumbnail?: EmbedPlusAssetData;
|
|
111
114
|
image?: EmbedPlusAssetData;
|
|
112
115
|
fields?: Partial<EmbedPlusFieldData>[] | null;
|
|
@@ -151,13 +154,13 @@ declare function createEmbed<B extends boolean>(options: CreateEmbedOptions<B>):
|
|
|
151
154
|
type ImageFileExtention = "png" | "jpg" | "gif" | "webp";
|
|
152
155
|
type ImageElementProperty = "author" | "thumbnail" | "image" | "footer";
|
|
153
156
|
interface CreateEmbedFilesOptions {
|
|
157
|
+
ignore?: ImageElementProperty[];
|
|
154
158
|
extentions?: Record<ImageElementProperty, ImageFileExtention>;
|
|
155
159
|
}
|
|
156
160
|
/**
|
|
157
|
-
*
|
|
158
161
|
* Turns any embed image url into an attachment and returns an attachment array
|
|
159
162
|
*/
|
|
160
|
-
declare function createEmbedFiles(embed:
|
|
163
|
+
declare function createEmbedFiles(embed: EmbedBuilder, options?: CreateEmbedFilesOptions): AttachmentBuilder[];
|
|
161
164
|
|
|
162
165
|
declare function createRow<Component extends AnyComponentBuilder>(...components: Component[]): ActionRowBuilder<Component>;
|
|
163
166
|
interface CreateLinkButtonData extends Omit<LinkButtonComponentData, "style" | "type"> {
|
|
@@ -233,9 +236,13 @@ type SubCommandGroups = Record<string, SubCommandGroup>;
|
|
|
233
236
|
declare function createSubCommandsGroups(groups: SubCommandGroups): ApplicationCommandSubGroupData[];
|
|
234
237
|
|
|
235
238
|
type TextInputData = Omit<TextInputComponentData, "type">;
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
+
interface ModalFieldData extends Omit<TextInputData, "customId" | "style"> {
|
|
240
|
+
style?: TextInputStyle;
|
|
241
|
+
}
|
|
242
|
+
declare function createModalInput(data: ModalFieldData & {
|
|
243
|
+
customId: string;
|
|
244
|
+
}): ActionRowBuilder<TextInputBuilder>;
|
|
245
|
+
type ModalFieldsData = Record<string, ModalFieldData>;
|
|
239
246
|
declare function createModalFields(data: ModalFieldsData): ActionRowBuilder<TextInputBuilder>[];
|
|
240
247
|
type ModalFieldsRecord<K extends string> = Record<K, string>;
|
|
241
248
|
declare function modalFieldsToRecord<K extends string = string>(fields: ModalSubmitFields | Collection<string, TextInputComponent>): ModalFieldsRecord<K>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@magicyan/discord",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.34",
|
|
4
4
|
"description": "Simple functions to facilitate discord bot development",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -44,4 +44,4 @@
|
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"discord.js": "^14.15.2"
|
|
46
46
|
}
|
|
47
|
-
}
|
|
47
|
+
}
|