@magicyan/discord 1.6.4 → 1.7.1
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/components/container.cjs +54 -1
- package/dist/functions/components/container.mjs +54 -1
- package/dist/functions/components/gallery.cjs +1 -1
- package/dist/functions/components/gallery.mjs +1 -1
- package/dist/functions/components/label.cjs +21 -14
- package/dist/functions/components/label.mjs +22 -15
- package/dist/functions/components/modal.cjs +15 -0
- package/dist/functions/components/modal.mjs +16 -2
- package/dist/functions/components/row.cjs +2 -1
- package/dist/functions/components/row.mjs +2 -1
- package/dist/guards/components/file.cjs +10 -0
- package/dist/guards/components/file.mjs +8 -0
- package/dist/guards/components/row.cjs +1 -2
- package/dist/guards/components/row.mjs +1 -2
- package/dist/index.cjs +3 -0
- package/dist/index.d.cts +86 -11
- package/dist/index.d.mts +86 -11
- package/dist/index.d.ts +86 -11
- package/dist/index.mjs +2 -1
- package/package.json +2 -2
|
@@ -4,6 +4,13 @@ const core = require('@magicyan/core');
|
|
|
4
4
|
const discord_js = require('discord.js');
|
|
5
5
|
const components = require('./components.cjs');
|
|
6
6
|
const message = require('../../guards/message.cjs');
|
|
7
|
+
const row = require('../../guards/components/row.cjs');
|
|
8
|
+
const section = require('../../guards/components/section.cjs');
|
|
9
|
+
const button = require('../../guards/components/button.cjs');
|
|
10
|
+
const textdisplay = require('../../guards/components/textdisplay.cjs');
|
|
11
|
+
const gallery = require('../../guards/components/gallery.cjs');
|
|
12
|
+
const file = require('../../guards/components/file.cjs');
|
|
13
|
+
const separator = require('../../guards/components/separator.cjs');
|
|
7
14
|
|
|
8
15
|
class ContainerPlusBuilder extends discord_js.ContainerBuilder {
|
|
9
16
|
constructor(data) {
|
|
@@ -54,7 +61,16 @@ class ContainerPlusBuilder extends discord_js.ContainerBuilder {
|
|
|
54
61
|
* container.setComponent(1, null); // Removes the component at index 1.
|
|
55
62
|
*/
|
|
56
63
|
setComponent(index, data) {
|
|
57
|
-
|
|
64
|
+
return this._spliceComponents(index, 1, data);
|
|
65
|
+
}
|
|
66
|
+
insertComponent(argA, argB) {
|
|
67
|
+
if (typeof argA === "number") {
|
|
68
|
+
return this._spliceComponents(argA, 0, argB);
|
|
69
|
+
}
|
|
70
|
+
return this._spliceComponents(this.components.length, 0, argA);
|
|
71
|
+
}
|
|
72
|
+
_spliceComponents(index, deleteCount, data) {
|
|
73
|
+
const args = [index, deleteCount];
|
|
58
74
|
if (core.isDefined(data))
|
|
59
75
|
args.push(...components.createComponents(data));
|
|
60
76
|
return this.spliceComponents(...args);
|
|
@@ -62,6 +78,43 @@ class ContainerPlusBuilder extends discord_js.ContainerBuilder {
|
|
|
62
78
|
componentAt(index, type) {
|
|
63
79
|
return core.isDefined(type) ? this.components.filter((builder) => builder.data.type === type).at(index) : this.components.at(index);
|
|
64
80
|
}
|
|
81
|
+
get buttonComponents() {
|
|
82
|
+
return this.components.filter(
|
|
83
|
+
(comp) => row.isActionRowBuilder(comp, "buttons") || section.isSectionBuilder(comp)
|
|
84
|
+
).flatMap((comp) => {
|
|
85
|
+
if (section.isSectionBuilder(comp)) {
|
|
86
|
+
if (!comp.accessory || !button.isButtonBuilder(comp.accessory))
|
|
87
|
+
return [];
|
|
88
|
+
return [comp.accessory];
|
|
89
|
+
}
|
|
90
|
+
return comp.components;
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
get sectionComponents() {
|
|
94
|
+
return this.components.filter(section.isSectionBuilder);
|
|
95
|
+
}
|
|
96
|
+
get selectMenuComponents() {
|
|
97
|
+
return this.components.filter(
|
|
98
|
+
(comp) => row.isActionRowBuilder(comp, "selects")
|
|
99
|
+
).flatMap((comp) => comp.components);
|
|
100
|
+
}
|
|
101
|
+
get textDisplayComponents() {
|
|
102
|
+
return this.components.filter(textdisplay.isTextDisplayBuilder);
|
|
103
|
+
}
|
|
104
|
+
get actionRowComponents() {
|
|
105
|
+
return this.components.filter(
|
|
106
|
+
(row$1) => row.isActionRowBuilder(row$1, "buttons") || row.isActionRowBuilder(row$1, "selects")
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
get mediaGalleryComponents() {
|
|
110
|
+
return this.components.filter(gallery.isMediaGalleryBuilder);
|
|
111
|
+
}
|
|
112
|
+
get fileComponents() {
|
|
113
|
+
return this.components.filter(file.isFileBuilder);
|
|
114
|
+
}
|
|
115
|
+
get separatorComponents() {
|
|
116
|
+
return this.components.filter(separator.isSeparatorBuilder);
|
|
117
|
+
}
|
|
65
118
|
}
|
|
66
119
|
function createContainer(data, ...items) {
|
|
67
120
|
const isContainerData = (value) => typeof value === "object" && core.isDefined(value) && !Array.isArray(value);
|
|
@@ -2,6 +2,13 @@ import { isDefined } from '@magicyan/core';
|
|
|
2
2
|
import { ContainerBuilder, resolveColor, ComponentType } from 'discord.js';
|
|
3
3
|
import { createComponents } from './components.mjs';
|
|
4
4
|
import { isMessage } from '../../guards/message.mjs';
|
|
5
|
+
import { isActionRowBuilder } from '../../guards/components/row.mjs';
|
|
6
|
+
import { isSectionBuilder } from '../../guards/components/section.mjs';
|
|
7
|
+
import { isButtonBuilder } from '../../guards/components/button.mjs';
|
|
8
|
+
import { isTextDisplayBuilder } from '../../guards/components/textdisplay.mjs';
|
|
9
|
+
import { isMediaGalleryBuilder } from '../../guards/components/gallery.mjs';
|
|
10
|
+
import { isFileBuilder } from '../../guards/components/file.mjs';
|
|
11
|
+
import { isSeparatorBuilder } from '../../guards/components/separator.mjs';
|
|
5
12
|
|
|
6
13
|
class ContainerPlusBuilder extends ContainerBuilder {
|
|
7
14
|
constructor(data) {
|
|
@@ -52,7 +59,16 @@ class ContainerPlusBuilder extends ContainerBuilder {
|
|
|
52
59
|
* container.setComponent(1, null); // Removes the component at index 1.
|
|
53
60
|
*/
|
|
54
61
|
setComponent(index, data) {
|
|
55
|
-
|
|
62
|
+
return this._spliceComponents(index, 1, data);
|
|
63
|
+
}
|
|
64
|
+
insertComponent(argA, argB) {
|
|
65
|
+
if (typeof argA === "number") {
|
|
66
|
+
return this._spliceComponents(argA, 0, argB);
|
|
67
|
+
}
|
|
68
|
+
return this._spliceComponents(this.components.length, 0, argA);
|
|
69
|
+
}
|
|
70
|
+
_spliceComponents(index, deleteCount, data) {
|
|
71
|
+
const args = [index, deleteCount];
|
|
56
72
|
if (isDefined(data))
|
|
57
73
|
args.push(...createComponents(data));
|
|
58
74
|
return this.spliceComponents(...args);
|
|
@@ -60,6 +76,43 @@ class ContainerPlusBuilder extends ContainerBuilder {
|
|
|
60
76
|
componentAt(index, type) {
|
|
61
77
|
return isDefined(type) ? this.components.filter((builder) => builder.data.type === type).at(index) : this.components.at(index);
|
|
62
78
|
}
|
|
79
|
+
get buttonComponents() {
|
|
80
|
+
return this.components.filter(
|
|
81
|
+
(comp) => isActionRowBuilder(comp, "buttons") || isSectionBuilder(comp)
|
|
82
|
+
).flatMap((comp) => {
|
|
83
|
+
if (isSectionBuilder(comp)) {
|
|
84
|
+
if (!comp.accessory || !isButtonBuilder(comp.accessory))
|
|
85
|
+
return [];
|
|
86
|
+
return [comp.accessory];
|
|
87
|
+
}
|
|
88
|
+
return comp.components;
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
get sectionComponents() {
|
|
92
|
+
return this.components.filter(isSectionBuilder);
|
|
93
|
+
}
|
|
94
|
+
get selectMenuComponents() {
|
|
95
|
+
return this.components.filter(
|
|
96
|
+
(comp) => isActionRowBuilder(comp, "selects")
|
|
97
|
+
).flatMap((comp) => comp.components);
|
|
98
|
+
}
|
|
99
|
+
get textDisplayComponents() {
|
|
100
|
+
return this.components.filter(isTextDisplayBuilder);
|
|
101
|
+
}
|
|
102
|
+
get actionRowComponents() {
|
|
103
|
+
return this.components.filter(
|
|
104
|
+
(row) => isActionRowBuilder(row, "buttons") || isActionRowBuilder(row, "selects")
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
get mediaGalleryComponents() {
|
|
108
|
+
return this.components.filter(isMediaGalleryBuilder);
|
|
109
|
+
}
|
|
110
|
+
get fileComponents() {
|
|
111
|
+
return this.components.filter(isFileBuilder);
|
|
112
|
+
}
|
|
113
|
+
get separatorComponents() {
|
|
114
|
+
return this.components.filter(isSeparatorBuilder);
|
|
115
|
+
}
|
|
63
116
|
}
|
|
64
117
|
function createContainer(data, ...items) {
|
|
65
118
|
const isContainerData = (value) => typeof value === "object" && isDefined(value) && !Array.isArray(value);
|
|
@@ -6,7 +6,7 @@ const core = require('@magicyan/core');
|
|
|
6
6
|
|
|
7
7
|
function createMediaGallery(...items) {
|
|
8
8
|
return new discord_js.MediaGalleryBuilder({
|
|
9
|
-
items: items.flat().filter(core.isDefined).map((item) => {
|
|
9
|
+
items: items.flat().filter((item) => typeof item !== "boolean").filter(core.isDefined).map((item) => {
|
|
10
10
|
if (typeof item === "string") {
|
|
11
11
|
return { media: { url: item } };
|
|
12
12
|
}
|
|
@@ -4,7 +4,7 @@ import { isDefined } from '@magicyan/core';
|
|
|
4
4
|
|
|
5
5
|
function createMediaGallery(...items) {
|
|
6
6
|
return new MediaGalleryBuilder({
|
|
7
|
-
items: items.flat().filter(isDefined).map((item) => {
|
|
7
|
+
items: items.flat().filter((item) => typeof item !== "boolean").filter(isDefined).map((item) => {
|
|
8
8
|
if (typeof item === "string") {
|
|
9
9
|
return { media: { url: item } };
|
|
10
10
|
}
|
|
@@ -2,26 +2,33 @@
|
|
|
2
2
|
|
|
3
3
|
const discord_js = require('discord.js');
|
|
4
4
|
|
|
5
|
-
function createLabel(
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
function createLabel(a, b, c, d) {
|
|
6
|
+
const label = new discord_js.LabelBuilder();
|
|
7
|
+
if (typeof a === "object") {
|
|
8
|
+
const { component, ...data } = a;
|
|
9
|
+
Object.assign(label.data, {
|
|
9
10
|
...data,
|
|
10
|
-
component: component
|
|
11
|
+
component: discord_js.isJSONEncodable(component) ? component.toJSON() : component
|
|
11
12
|
});
|
|
13
|
+
return label;
|
|
12
14
|
}
|
|
13
|
-
if (typeof
|
|
14
|
-
|
|
15
|
-
label:
|
|
16
|
-
description:
|
|
17
|
-
...typeof
|
|
15
|
+
if (typeof b === "string") {
|
|
16
|
+
Object.assign(label.data, {
|
|
17
|
+
label: a,
|
|
18
|
+
description: b,
|
|
19
|
+
...typeof c === "number" ? { id: c } : {
|
|
20
|
+
component: discord_js.isJSONEncodable(c) ? c.toJSON() : c,
|
|
21
|
+
id: d
|
|
22
|
+
}
|
|
18
23
|
});
|
|
24
|
+
return label;
|
|
19
25
|
}
|
|
20
|
-
|
|
21
|
-
label:
|
|
22
|
-
component:
|
|
23
|
-
...typeof
|
|
26
|
+
Object.assign(label.data, {
|
|
27
|
+
label: a,
|
|
28
|
+
component: discord_js.isJSONEncodable(b) ? b.toJSON() : b,
|
|
29
|
+
...typeof c === "number" ? { id: c } : {}
|
|
24
30
|
});
|
|
31
|
+
return label;
|
|
25
32
|
}
|
|
26
33
|
|
|
27
34
|
exports.createLabel = createLabel;
|
|
@@ -1,25 +1,32 @@
|
|
|
1
|
-
import { LabelBuilder } from 'discord.js';
|
|
1
|
+
import { LabelBuilder, isJSONEncodable } from 'discord.js';
|
|
2
2
|
|
|
3
|
-
function createLabel(
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
function createLabel(a, b, c, d) {
|
|
4
|
+
const label = new LabelBuilder();
|
|
5
|
+
if (typeof a === "object") {
|
|
6
|
+
const { component, ...data } = a;
|
|
7
|
+
Object.assign(label.data, {
|
|
7
8
|
...data,
|
|
8
|
-
component: component
|
|
9
|
+
component: isJSONEncodable(component) ? component.toJSON() : component
|
|
9
10
|
});
|
|
11
|
+
return label;
|
|
10
12
|
}
|
|
11
|
-
if (typeof
|
|
12
|
-
|
|
13
|
-
label:
|
|
14
|
-
description:
|
|
15
|
-
...typeof
|
|
13
|
+
if (typeof b === "string") {
|
|
14
|
+
Object.assign(label.data, {
|
|
15
|
+
label: a,
|
|
16
|
+
description: b,
|
|
17
|
+
...typeof c === "number" ? { id: c } : {
|
|
18
|
+
component: isJSONEncodable(c) ? c.toJSON() : c,
|
|
19
|
+
id: d
|
|
20
|
+
}
|
|
16
21
|
});
|
|
22
|
+
return label;
|
|
17
23
|
}
|
|
18
|
-
|
|
19
|
-
label:
|
|
20
|
-
component:
|
|
21
|
-
...typeof
|
|
24
|
+
Object.assign(label.data, {
|
|
25
|
+
label: a,
|
|
26
|
+
component: isJSONEncodable(b) ? b.toJSON() : b,
|
|
27
|
+
...typeof c === "number" ? { id: c } : {}
|
|
22
28
|
});
|
|
29
|
+
return label;
|
|
23
30
|
}
|
|
24
31
|
|
|
25
32
|
export { createLabel };
|
|
@@ -30,6 +30,21 @@ function createModalFields(...components) {
|
|
|
30
30
|
return data.data;
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
|
+
function createModal(data, title, ...components) {
|
|
34
|
+
if (typeof data === "string") {
|
|
35
|
+
return new discord_js.ModalBuilder({
|
|
36
|
+
customId: data,
|
|
37
|
+
title,
|
|
38
|
+
components: createModalFields(...components)
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
return new discord_js.ModalBuilder({
|
|
42
|
+
customId: data.title,
|
|
43
|
+
title: data.title,
|
|
44
|
+
components: createModalFields(...data.components ?? [])
|
|
45
|
+
});
|
|
46
|
+
}
|
|
33
47
|
|
|
48
|
+
exports.createModal = createModal;
|
|
34
49
|
exports.createModalFields = createModalFields;
|
|
35
50
|
exports.modalFieldsToRecord = modalFieldsToRecord;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isDefined } from '@magicyan/core';
|
|
2
|
-
import { ComponentType } from 'discord.js';
|
|
2
|
+
import { ComponentType, ModalBuilder } from 'discord.js';
|
|
3
3
|
|
|
4
4
|
function modalFieldsToRecord(data, parse) {
|
|
5
5
|
const collection = "fields" in data ? "fields" in data.fields ? data.fields.fields : data.fields : data;
|
|
@@ -28,5 +28,19 @@ function createModalFields(...components) {
|
|
|
28
28
|
return data.data;
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
|
+
function createModal(data, title, ...components) {
|
|
32
|
+
if (typeof data === "string") {
|
|
33
|
+
return new ModalBuilder({
|
|
34
|
+
customId: data,
|
|
35
|
+
title,
|
|
36
|
+
components: createModalFields(...components)
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
return new ModalBuilder({
|
|
40
|
+
customId: data.title,
|
|
41
|
+
title: data.title,
|
|
42
|
+
components: createModalFields(...data.components ?? [])
|
|
43
|
+
});
|
|
44
|
+
}
|
|
31
45
|
|
|
32
|
-
export { createModalFields, modalFieldsToRecord };
|
|
46
|
+
export { createModal, createModalFields, modalFieldsToRecord };
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
const core = require('@magicyan/core');
|
|
3
4
|
const discord_js = require('discord.js');
|
|
4
5
|
|
|
5
6
|
function createRow(...components) {
|
|
6
7
|
return new discord_js.ActionRowBuilder({
|
|
7
|
-
components: components.flat()
|
|
8
|
+
components: components.flat().filter((c) => typeof c !== "boolean").filter((c) => core.isDefined(c))
|
|
8
9
|
});
|
|
9
10
|
}
|
|
10
11
|
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { isDefined } from '@magicyan/core';
|
|
1
2
|
import { ActionRowBuilder } from 'discord.js';
|
|
2
3
|
|
|
3
4
|
function createRow(...components) {
|
|
4
5
|
return new ActionRowBuilder({
|
|
5
|
-
components: components.flat()
|
|
6
|
+
components: components.flat().filter((c) => typeof c !== "boolean").filter((c) => isDefined(c))
|
|
6
7
|
});
|
|
7
8
|
}
|
|
8
9
|
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const discord_js = require('discord.js');
|
|
4
|
+
const utils = require('../utils.cjs');
|
|
5
|
+
|
|
6
|
+
function isFileBuilder(value) {
|
|
7
|
+
return value instanceof discord_js.FileBuilder || utils.hasConstructor(value) && value.constructor.name === discord_js.FileBuilder.name;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
exports.isFileBuilder = isFileBuilder;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FileBuilder } from 'discord.js';
|
|
2
|
+
import { hasConstructor } from '../utils.mjs';
|
|
3
|
+
|
|
4
|
+
function isFileBuilder(value) {
|
|
5
|
+
return value instanceof FileBuilder || hasConstructor(value) && value.constructor.name === FileBuilder.name;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export { isFileBuilder };
|
|
@@ -4,12 +4,11 @@ const discord_js = require('discord.js');
|
|
|
4
4
|
const selectmenu = require('./selectmenu.cjs');
|
|
5
5
|
const button = require('./button.cjs');
|
|
6
6
|
const utils = require('../utils.cjs');
|
|
7
|
-
const textinput = require('./textinput.cjs');
|
|
8
7
|
|
|
9
8
|
function isActionRowBuilder(value, withComponent) {
|
|
10
9
|
const isActionRow = utils.hasConstructor(value) && value.constructor.name === discord_js.ActionRowBuilder.name && "components" in value && Array.isArray(value.components);
|
|
11
10
|
if (isActionRow && withComponent) {
|
|
12
|
-
const guard = withComponent === "selects" ? selectmenu.isAnySelectMenuBuilder :
|
|
11
|
+
const guard = withComponent === "selects" ? selectmenu.isAnySelectMenuBuilder : button.isButtonBuilder;
|
|
13
12
|
return value.components.some(guard);
|
|
14
13
|
}
|
|
15
14
|
return isActionRow;
|
|
@@ -2,12 +2,11 @@ import { ActionRowBuilder } from 'discord.js';
|
|
|
2
2
|
import { isAnySelectMenuBuilder } from './selectmenu.mjs';
|
|
3
3
|
import { isButtonBuilder } from './button.mjs';
|
|
4
4
|
import { hasConstructor } from '../utils.mjs';
|
|
5
|
-
import { isTextInputBuilder } from './textinput.mjs';
|
|
6
5
|
|
|
7
6
|
function isActionRowBuilder(value, withComponent) {
|
|
8
7
|
const isActionRow = hasConstructor(value) && value.constructor.name === ActionRowBuilder.name && "components" in value && Array.isArray(value.components);
|
|
9
8
|
if (isActionRow && withComponent) {
|
|
10
|
-
const guard = withComponent === "selects" ? isAnySelectMenuBuilder :
|
|
9
|
+
const guard = withComponent === "selects" ? isAnySelectMenuBuilder : isButtonBuilder;
|
|
11
10
|
return value.components.some(guard);
|
|
12
11
|
}
|
|
13
12
|
return isActionRow;
|
package/dist/index.cjs
CHANGED
|
@@ -41,6 +41,7 @@ const modal$1 = require('./guards/components/modal.cjs');
|
|
|
41
41
|
const row$1 = require('./guards/components/row.cjs');
|
|
42
42
|
const section$1 = require('./guards/components/section.cjs');
|
|
43
43
|
const selectmenu = require('./guards/components/selectmenu.cjs');
|
|
44
|
+
const file$1 = require('./guards/components/file.cjs');
|
|
44
45
|
const separator$2 = require('./guards/components/separator.cjs');
|
|
45
46
|
const textdisplay = require('./guards/components/textdisplay.cjs');
|
|
46
47
|
const textinput = require('./guards/components/textinput.cjs');
|
|
@@ -77,6 +78,7 @@ exports.createMediaGallery = gallery.createMediaGallery;
|
|
|
77
78
|
exports.createModalInput = input.createModalInput;
|
|
78
79
|
exports.createTextInput = input.createTextInput;
|
|
79
80
|
exports.createLabel = label.createLabel;
|
|
81
|
+
exports.createModal = modal.createModal;
|
|
80
82
|
exports.createModalFields = modal.createModalFields;
|
|
81
83
|
exports.modalFieldsToRecord = modal.modalFieldsToRecord;
|
|
82
84
|
exports.createRow = row.createRow;
|
|
@@ -106,6 +108,7 @@ exports.isMentionableSelectMenuBuilder = selectmenu.isMentionableSelectMenuBuild
|
|
|
106
108
|
exports.isRoleSelectMenuBuilder = selectmenu.isRoleSelectMenuBuilder;
|
|
107
109
|
exports.isStringSelectMenuBuilder = selectmenu.isStringSelectMenuBuilder;
|
|
108
110
|
exports.isUserSelectMenuBuilder = selectmenu.isUserSelectMenuBuilder;
|
|
111
|
+
exports.isFileBuilder = file$1.isFileBuilder;
|
|
109
112
|
exports.isSeparatorBuilder = separator$2.isSeparatorBuilder;
|
|
110
113
|
exports.isTextDisplayBuilder = textdisplay.isTextDisplayBuilder;
|
|
111
114
|
exports.isTextInputBuilder = textinput.isTextInputBuilder;
|
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, GuildEmoji, GuildMember, GuildTextBasedChannel, Message, Role, WebhookClientOptions, WebhookClient, WebhookClientData, ComponentEmojiResolvable, ButtonBuilder, ActionRowBuilder, LinkButtonComponentData, Attachment, AttachmentBuilder, MessageActionRowComponentBuilder, TextDisplayBuilder, SeparatorBuilder, FileBuilder, SectionBuilder, MediaGalleryBuilder, ContainerBuilder, ContainerComponentBuilder as ContainerComponentBuilder$1, ColorResolvable, ComponentType, ContainerComponentData, ContainerComponent, APIUnfurledMediaItem, MediaGalleryItemData, TextInputBuilder, TextInputComponentData, TextInputStyle, LabelBuilderData,
|
|
2
|
+
import { GatewayIntentBits, Partials, ChannelType, Guild, CommandInteractionOption, Client, ApplicationCommand, GuildEmoji, GuildMember, GuildTextBasedChannel, Message, Role, WebhookClientOptions, WebhookClient, WebhookClientData, ComponentEmojiResolvable, ButtonBuilder, ActionRowBuilder, LinkButtonComponentData, Attachment, AttachmentBuilder, MessageActionRowComponentBuilder, TextDisplayBuilder, SeparatorBuilder, FileBuilder, SectionBuilder, MediaGalleryBuilder, ContainerBuilder, ContainerComponentBuilder as ContainerComponentBuilder$1, ColorResolvable, ComponentType, ContainerComponentData, ContainerComponent, APIUnfurledMediaItem, MediaGalleryItemData, TextInputBuilder, TextInputComponentData, TextInputStyle, LabelBuilder, LabelBuilderData, ComponentInLabelData, ModalBuilder, Collection, ModalData, LabelComponentData, TextDisplayComponentData, AnyComponentBuilder, ThumbnailComponentData, ThumbnailBuilder, ButtonComponentData, FileUploadBuilder, EmbedAssetData, User, ClientUser, ImageURLOptions, EmbedFooterData, APIEmbed, Embed, EmbedData, EmbedBuilder, AttachmentData, MediaGalleryItemBuilder, StringSelectMenuBuilder, UserSelectMenuBuilder, RoleSelectMenuBuilder, ChannelSelectMenuBuilder, MentionableSelectMenuBuilder } from 'discord.js';
|
|
3
3
|
export * from '@magicyan/core';
|
|
4
4
|
|
|
5
5
|
declare const chars: {
|
|
@@ -216,7 +216,7 @@ type CreateComponentData = ComponentData | ContainerBuilder;
|
|
|
216
216
|
type ContainerComponentBuilder = Exclude<ContainerComponentBuilder$1, ActionRowBuilder> | ActionRowBuilder<MessageActionRowComponentBuilder>;
|
|
217
217
|
type CreateComponentsReturn<IsContainer> = IsContainer extends true ? ContainerComponentBuilder[] : (ContainerComponentBuilder | ContainerBuilder)[];
|
|
218
218
|
type CreateComponentsData<IsContainer> = IsContainer extends true ? ComponentData : ComponentData | ContainerBuilder;
|
|
219
|
-
declare function createComponents<IsContainer extends boolean = false, Data extends CreateComponentsData<IsContainer> = CreateComponentsData<IsContainer
|
|
219
|
+
declare function createComponents<IsContainer extends boolean = false, Data extends CreateComponentsData<IsContainer>[] = CreateComponentsData<IsContainer>[]>(...data: (Data | Data[])): CreateComponentsReturn<IsContainer>;
|
|
220
220
|
|
|
221
221
|
type ContainerColor = (string & {}) | ColorResolvable;
|
|
222
222
|
type ContainerInComponentType = ComponentType.TextDisplay | ComponentType.ActionRow | ComponentType.Section | ComponentType.Separator | ComponentType.MediaGallery | ComponentType.File;
|
|
@@ -261,6 +261,9 @@ declare class ContainerPlusBuilder extends ContainerBuilder {
|
|
|
261
261
|
* container.setComponent(1, null); // Removes the component at index 1.
|
|
262
262
|
*/
|
|
263
263
|
setComponent(index: number, data: ComponentData | null): this;
|
|
264
|
+
insertComponent(data: ComponentData): this;
|
|
265
|
+
insertComponent(index: number, data?: ComponentData): this;
|
|
266
|
+
private _spliceComponents;
|
|
264
267
|
/**
|
|
265
268
|
* Retrieves a component from the container at the specified index, optionally filtering by component type.
|
|
266
269
|
*
|
|
@@ -281,6 +284,14 @@ declare class ContainerPlusBuilder extends ContainerBuilder {
|
|
|
281
284
|
componentAt(index: number, type: ComponentType.Separator): SeparatorBuilder | undefined;
|
|
282
285
|
componentAt(index: number, type: ComponentType.MediaGallery): MediaGalleryBuilder | undefined;
|
|
283
286
|
componentAt(index: number, type: ComponentType.File): FileBuilder | undefined;
|
|
287
|
+
get buttonComponents(): ButtonBuilder[];
|
|
288
|
+
get sectionComponents(): SectionBuilder[];
|
|
289
|
+
get selectMenuComponents(): AnySelectMenuBuilder[];
|
|
290
|
+
get textDisplayComponents(): TextDisplayBuilder[];
|
|
291
|
+
get actionRowComponents(): (ActionRowBuilder<ButtonBuilder> | ActionRowBuilder<AnySelectMenuBuilder>)[];
|
|
292
|
+
get mediaGalleryComponents(): MediaGalleryBuilder[];
|
|
293
|
+
get fileComponents(): FileBuilder[];
|
|
294
|
+
get separatorComponents(): SeparatorBuilder[];
|
|
284
295
|
}
|
|
285
296
|
/**
|
|
286
297
|
* Creates one or multiple {@link ContainerPlusBuilder} components with optional accent color and child components.
|
|
@@ -370,7 +381,7 @@ interface CreateFileOptions extends Omit<APIUnfurledMediaItem, "url"> {
|
|
|
370
381
|
*/
|
|
371
382
|
declare function createFile(source: FileSource, options?: CreateFileOptions): FileBuilder;
|
|
372
383
|
|
|
373
|
-
type MediaGallerySource = MediaGalleryItemData |
|
|
384
|
+
type MediaGallerySource = MediaGalleryItemData | Attachment | AttachmentBuilder | string | null | undefined | boolean;
|
|
374
385
|
/**
|
|
375
386
|
* Creates a {@link MediaGalleryBuilder} instance with a collection of media items, which can be images, attachments, or URLs.
|
|
376
387
|
*
|
|
@@ -422,11 +433,46 @@ declare function createModalInput(data: Omit<TextInputComponentData, "type" | "s
|
|
|
422
433
|
style?: TextInputStyle;
|
|
423
434
|
}): ActionRowBuilder<TextInputBuilder>;
|
|
424
435
|
|
|
425
|
-
|
|
426
|
-
type
|
|
436
|
+
interface Unstable_CheckboxData {
|
|
437
|
+
type: ComponentType.Checkbox;
|
|
438
|
+
customId: string;
|
|
439
|
+
default?: boolean;
|
|
440
|
+
id?: number;
|
|
441
|
+
}
|
|
442
|
+
interface Unstable_CheckboxGroupData {
|
|
443
|
+
type: ComponentType.CheckboxGroup;
|
|
444
|
+
id?: number;
|
|
445
|
+
customId: string;
|
|
446
|
+
required?: boolean;
|
|
447
|
+
minValues?: number;
|
|
448
|
+
maxValues?: number;
|
|
449
|
+
options: {
|
|
450
|
+
label: string;
|
|
451
|
+
value: string;
|
|
452
|
+
description?: string;
|
|
453
|
+
default?: boolean;
|
|
454
|
+
}[];
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
interface Unstable_RadioGroupData {
|
|
458
|
+
type: ComponentType.RadioGroup;
|
|
459
|
+
id?: number;
|
|
460
|
+
customId: string;
|
|
461
|
+
required?: boolean;
|
|
462
|
+
options: {
|
|
463
|
+
label: string;
|
|
464
|
+
value: string;
|
|
465
|
+
description?: string;
|
|
466
|
+
default?: boolean;
|
|
467
|
+
}[];
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
interface CreateLabelData extends Omit<LabelBuilderData, "type" | "component"> {
|
|
471
|
+
component?: LabelBuilderData["component"] | ComponentInLabelData | Unstable_CheckboxData | Unstable_CheckboxGroupData | Unstable_RadioGroupData;
|
|
472
|
+
}
|
|
427
473
|
declare function createLabel(data: CreateLabelData): LabelBuilder;
|
|
428
|
-
declare function createLabel(label: string, description?: string, component?:
|
|
429
|
-
declare function createLabel(label: string, component?:
|
|
474
|
+
declare function createLabel(label: string, description?: string, component?: CreateLabelData["component"], id?: number): LabelBuilder;
|
|
475
|
+
declare function createLabel(label: string, component?: CreateLabelData["component"], id?: number): LabelBuilder;
|
|
430
476
|
|
|
431
477
|
type ModalComponents = LabelBuilder | TextDisplayBuilder | string | null | boolean | undefined;
|
|
432
478
|
type ResolveModalData = {
|
|
@@ -471,7 +517,17 @@ declare function modalFieldsToRecord<const T = ModalFieldsRecord>(data: ResolveM
|
|
|
471
517
|
declare function modalFieldsToRecord<const T = ModalFieldsRecord>(data: ResolveModalData, parse: (record: ModalFieldsRecord) => T): T;
|
|
472
518
|
type ModalFields = (LabelComponentData | TextDisplayComponentData)[];
|
|
473
519
|
declare function createModalFields(...components: ModalComponents[]): ModalFields;
|
|
520
|
+
interface CreateModalOptions {
|
|
521
|
+
customId: string;
|
|
522
|
+
title: string;
|
|
523
|
+
components: ModalComponents[];
|
|
524
|
+
}
|
|
525
|
+
declare function createModal(data: Partial<CreateModalOptions>): ModalBuilder;
|
|
526
|
+
declare function createModal(customId: string): ModalBuilder;
|
|
527
|
+
declare function createModal(customId: string, title: string): ModalBuilder;
|
|
528
|
+
declare function createModal(customId: string, title: string, ...components: ModalComponents[]): ModalBuilder;
|
|
474
529
|
|
|
530
|
+
type NullableValues = null | undefined | boolean;
|
|
475
531
|
/**
|
|
476
532
|
* Creates an {@link ActionRowBuilder} containing one or more UI components.
|
|
477
533
|
*
|
|
@@ -511,7 +567,7 @@ declare function createModalFields(...components: ModalComponents[]): ModalField
|
|
|
511
567
|
* })
|
|
512
568
|
* );
|
|
513
569
|
*/
|
|
514
|
-
declare function createRow<Component extends AnyComponentBuilder>(...components: (Component | Component[])[]): ActionRowBuilder<Component>;
|
|
570
|
+
declare function createRow<Component extends AnyComponentBuilder>(...components: (NullableValues | Component | Component[])[]): ActionRowBuilder<Component>;
|
|
515
571
|
|
|
516
572
|
type ThumbnailData = Partial<Omit<ThumbnailComponentData, "type">> | Attachment | AttachmentBuilder | string;
|
|
517
573
|
/**
|
|
@@ -1084,7 +1140,6 @@ declare function isAnySelectMenuBuilder(value: unknown): value is AnySelectMenuB
|
|
|
1084
1140
|
declare function isActionRowBuilder(value: unknown): value is ActionRowBuilder;
|
|
1085
1141
|
declare function isActionRowBuilder(value: unknown, withComponents: "selects"): value is ActionRowBuilder<AnySelectMenuBuilder>;
|
|
1086
1142
|
declare function isActionRowBuilder(value: unknown, withComponents: "buttons"): value is ActionRowBuilder<ButtonBuilder>;
|
|
1087
|
-
declare function isActionRowBuilder(value: unknown, withComponents: "inputs"): value is ActionRowBuilder<TextInputBuilder>;
|
|
1088
1143
|
|
|
1089
1144
|
/**
|
|
1090
1145
|
* Checks whether the given value is a {@link SectionBuilder}.
|
|
@@ -1106,6 +1161,26 @@ declare function isActionRowBuilder(value: unknown, withComponents: "inputs"): v
|
|
|
1106
1161
|
*/
|
|
1107
1162
|
declare function isSectionBuilder(value: unknown): value is SectionBuilder;
|
|
1108
1163
|
|
|
1164
|
+
/**
|
|
1165
|
+
* Checks whether the given value is a {@link FileBuilder}.
|
|
1166
|
+
*
|
|
1167
|
+
* This function returns `true` if the value is an instance of `FileBuilder`,
|
|
1168
|
+
* or if it structurally matches by constructor name.
|
|
1169
|
+
*
|
|
1170
|
+
* @param value - The value to check.
|
|
1171
|
+
* @returns `true` if the value is a `FileBuilder`, otherwise `false`.
|
|
1172
|
+
*
|
|
1173
|
+
* @example
|
|
1174
|
+
* import type { FileBuilder } from "discord.js";
|
|
1175
|
+
*
|
|
1176
|
+
* function handle(input: FileBuilder | unknown) {
|
|
1177
|
+
* if (FileBuilder(input)) {
|
|
1178
|
+
* input.setURL("https://example.com/image.png");
|
|
1179
|
+
* }
|
|
1180
|
+
* }
|
|
1181
|
+
*/
|
|
1182
|
+
declare function isFileBuilder(value: unknown): value is FileBuilder;
|
|
1183
|
+
|
|
1109
1184
|
/**
|
|
1110
1185
|
* Checks whether the given value is a {@link SeparatorBuilder}.
|
|
1111
1186
|
*
|
|
@@ -1187,5 +1262,5 @@ declare function isTextInputBuilder(value: unknown): value is TextInputBuilder;
|
|
|
1187
1262
|
*/
|
|
1188
1263
|
declare function isMessage(value: unknown): value is Message;
|
|
1189
1264
|
|
|
1190
|
-
export { ContainerPlusBuilder, CustomItents, CustomPartials, EmbedLimit, EmbedPlusBuilder, Separator, chars, commandMention, createComponents, createContainer, createEmbed, createEmbedAsset, createEmbedAuthor, createEmbedFiles, createEmbedFooter, createFile, createFileUpload, createLabel, createLinkButton, createMediaGallery, createModalFields, createModalInput, createRow, createSection, createSeparator, createTextDisplay, createTextInput, createThumbArea, createThumbnail, createWebhookClient, extractMentionId, fetchMessageFromURL, findChannel, findCommand, findEmoji, findMember, findMessage, findRole, getChannelUrlInfo, getMessageURLInfo, isActionRowBuilder, isAnySelectMenuBuilder, isAttachment, isButtonBuilder, isChannelSelectMenuBuilder, isContainerBuilder, isMediaGalleryBuilder, isMediaGalleryItemBuilder, isMentionableSelectMenuBuilder, isMessage, isModalBuilder, isRoleSelectMenuBuilder, isSectionBuilder, isSeparatorBuilder, isStringSelectMenuBuilder, isTextDisplayBuilder, isTextInputBuilder, isUserSelectMenuBuilder, modalFieldsToRecord, setMobileStatus, wrapButtons };
|
|
1191
|
-
export type { AnyEmbedData, AnySelectMenuBuilder, ComponentBuildersData, ComponentData,
|
|
1265
|
+
export { ContainerPlusBuilder, CustomItents, CustomPartials, EmbedLimit, EmbedPlusBuilder, Separator, chars, commandMention, createComponents, createContainer, createEmbed, createEmbedAsset, createEmbedAuthor, createEmbedFiles, createEmbedFooter, createFile, createFileUpload, createLabel, createLinkButton, createMediaGallery, createModal, createModalFields, createModalInput, createRow, createSection, createSeparator, createTextDisplay, createTextInput, createThumbArea, createThumbnail, createWebhookClient, extractMentionId, fetchMessageFromURL, findChannel, findCommand, findEmoji, findMember, findMessage, findRole, getChannelUrlInfo, getMessageURLInfo, isActionRowBuilder, isAnySelectMenuBuilder, isAttachment, isButtonBuilder, isChannelSelectMenuBuilder, isContainerBuilder, isFileBuilder, isMediaGalleryBuilder, isMediaGalleryItemBuilder, isMentionableSelectMenuBuilder, isMessage, isModalBuilder, isRoleSelectMenuBuilder, isSectionBuilder, isSeparatorBuilder, isStringSelectMenuBuilder, isTextDisplayBuilder, isTextInputBuilder, isUserSelectMenuBuilder, modalFieldsToRecord, setMobileStatus, wrapButtons };
|
|
1266
|
+
export type { AnyEmbedData, AnySelectMenuBuilder, ComponentBuildersData, ComponentData, ContainerColor, ContainerComponentBuilder, ContainerData, ContainerInComponentType, CreateComponentData, CreateModalOptions, EmbedPlusAssetData, EmbedPlusAuthorData, EmbedPlusColorData, EmbedPlusData, EmbedPlusFooterData, EmbedPlusProperty, FileUploadData, MagicComponentData, MediaGallerySource, SectionAccessory, SectionAccessoryData, SectionButtonAccessory, SectionData, SectionThumbnailAccessory, SeparatorData, ThumbAreaData, ThumbAreaThumbnail, ThumbnailData, Unstable_CheckboxData, Unstable_CheckboxGroupData, Unstable_RadioGroupData };
|
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, GuildEmoji, GuildMember, GuildTextBasedChannel, Message, Role, WebhookClientOptions, WebhookClient, WebhookClientData, ComponentEmojiResolvable, ButtonBuilder, ActionRowBuilder, LinkButtonComponentData, Attachment, AttachmentBuilder, MessageActionRowComponentBuilder, TextDisplayBuilder, SeparatorBuilder, FileBuilder, SectionBuilder, MediaGalleryBuilder, ContainerBuilder, ContainerComponentBuilder as ContainerComponentBuilder$1, ColorResolvable, ComponentType, ContainerComponentData, ContainerComponent, APIUnfurledMediaItem, MediaGalleryItemData, TextInputBuilder, TextInputComponentData, TextInputStyle, LabelBuilderData,
|
|
2
|
+
import { GatewayIntentBits, Partials, ChannelType, Guild, CommandInteractionOption, Client, ApplicationCommand, GuildEmoji, GuildMember, GuildTextBasedChannel, Message, Role, WebhookClientOptions, WebhookClient, WebhookClientData, ComponentEmojiResolvable, ButtonBuilder, ActionRowBuilder, LinkButtonComponentData, Attachment, AttachmentBuilder, MessageActionRowComponentBuilder, TextDisplayBuilder, SeparatorBuilder, FileBuilder, SectionBuilder, MediaGalleryBuilder, ContainerBuilder, ContainerComponentBuilder as ContainerComponentBuilder$1, ColorResolvable, ComponentType, ContainerComponentData, ContainerComponent, APIUnfurledMediaItem, MediaGalleryItemData, TextInputBuilder, TextInputComponentData, TextInputStyle, LabelBuilder, LabelBuilderData, ComponentInLabelData, ModalBuilder, Collection, ModalData, LabelComponentData, TextDisplayComponentData, AnyComponentBuilder, ThumbnailComponentData, ThumbnailBuilder, ButtonComponentData, FileUploadBuilder, EmbedAssetData, User, ClientUser, ImageURLOptions, EmbedFooterData, APIEmbed, Embed, EmbedData, EmbedBuilder, AttachmentData, MediaGalleryItemBuilder, StringSelectMenuBuilder, UserSelectMenuBuilder, RoleSelectMenuBuilder, ChannelSelectMenuBuilder, MentionableSelectMenuBuilder } from 'discord.js';
|
|
3
3
|
export * from '@magicyan/core';
|
|
4
4
|
|
|
5
5
|
declare const chars: {
|
|
@@ -216,7 +216,7 @@ type CreateComponentData = ComponentData | ContainerBuilder;
|
|
|
216
216
|
type ContainerComponentBuilder = Exclude<ContainerComponentBuilder$1, ActionRowBuilder> | ActionRowBuilder<MessageActionRowComponentBuilder>;
|
|
217
217
|
type CreateComponentsReturn<IsContainer> = IsContainer extends true ? ContainerComponentBuilder[] : (ContainerComponentBuilder | ContainerBuilder)[];
|
|
218
218
|
type CreateComponentsData<IsContainer> = IsContainer extends true ? ComponentData : ComponentData | ContainerBuilder;
|
|
219
|
-
declare function createComponents<IsContainer extends boolean = false, Data extends CreateComponentsData<IsContainer> = CreateComponentsData<IsContainer
|
|
219
|
+
declare function createComponents<IsContainer extends boolean = false, Data extends CreateComponentsData<IsContainer>[] = CreateComponentsData<IsContainer>[]>(...data: (Data | Data[])): CreateComponentsReturn<IsContainer>;
|
|
220
220
|
|
|
221
221
|
type ContainerColor = (string & {}) | ColorResolvable;
|
|
222
222
|
type ContainerInComponentType = ComponentType.TextDisplay | ComponentType.ActionRow | ComponentType.Section | ComponentType.Separator | ComponentType.MediaGallery | ComponentType.File;
|
|
@@ -261,6 +261,9 @@ declare class ContainerPlusBuilder extends ContainerBuilder {
|
|
|
261
261
|
* container.setComponent(1, null); // Removes the component at index 1.
|
|
262
262
|
*/
|
|
263
263
|
setComponent(index: number, data: ComponentData | null): this;
|
|
264
|
+
insertComponent(data: ComponentData): this;
|
|
265
|
+
insertComponent(index: number, data?: ComponentData): this;
|
|
266
|
+
private _spliceComponents;
|
|
264
267
|
/**
|
|
265
268
|
* Retrieves a component from the container at the specified index, optionally filtering by component type.
|
|
266
269
|
*
|
|
@@ -281,6 +284,14 @@ declare class ContainerPlusBuilder extends ContainerBuilder {
|
|
|
281
284
|
componentAt(index: number, type: ComponentType.Separator): SeparatorBuilder | undefined;
|
|
282
285
|
componentAt(index: number, type: ComponentType.MediaGallery): MediaGalleryBuilder | undefined;
|
|
283
286
|
componentAt(index: number, type: ComponentType.File): FileBuilder | undefined;
|
|
287
|
+
get buttonComponents(): ButtonBuilder[];
|
|
288
|
+
get sectionComponents(): SectionBuilder[];
|
|
289
|
+
get selectMenuComponents(): AnySelectMenuBuilder[];
|
|
290
|
+
get textDisplayComponents(): TextDisplayBuilder[];
|
|
291
|
+
get actionRowComponents(): (ActionRowBuilder<ButtonBuilder> | ActionRowBuilder<AnySelectMenuBuilder>)[];
|
|
292
|
+
get mediaGalleryComponents(): MediaGalleryBuilder[];
|
|
293
|
+
get fileComponents(): FileBuilder[];
|
|
294
|
+
get separatorComponents(): SeparatorBuilder[];
|
|
284
295
|
}
|
|
285
296
|
/**
|
|
286
297
|
* Creates one or multiple {@link ContainerPlusBuilder} components with optional accent color and child components.
|
|
@@ -370,7 +381,7 @@ interface CreateFileOptions extends Omit<APIUnfurledMediaItem, "url"> {
|
|
|
370
381
|
*/
|
|
371
382
|
declare function createFile(source: FileSource, options?: CreateFileOptions): FileBuilder;
|
|
372
383
|
|
|
373
|
-
type MediaGallerySource = MediaGalleryItemData |
|
|
384
|
+
type MediaGallerySource = MediaGalleryItemData | Attachment | AttachmentBuilder | string | null | undefined | boolean;
|
|
374
385
|
/**
|
|
375
386
|
* Creates a {@link MediaGalleryBuilder} instance with a collection of media items, which can be images, attachments, or URLs.
|
|
376
387
|
*
|
|
@@ -422,11 +433,46 @@ declare function createModalInput(data: Omit<TextInputComponentData, "type" | "s
|
|
|
422
433
|
style?: TextInputStyle;
|
|
423
434
|
}): ActionRowBuilder<TextInputBuilder>;
|
|
424
435
|
|
|
425
|
-
|
|
426
|
-
type
|
|
436
|
+
interface Unstable_CheckboxData {
|
|
437
|
+
type: ComponentType.Checkbox;
|
|
438
|
+
customId: string;
|
|
439
|
+
default?: boolean;
|
|
440
|
+
id?: number;
|
|
441
|
+
}
|
|
442
|
+
interface Unstable_CheckboxGroupData {
|
|
443
|
+
type: ComponentType.CheckboxGroup;
|
|
444
|
+
id?: number;
|
|
445
|
+
customId: string;
|
|
446
|
+
required?: boolean;
|
|
447
|
+
minValues?: number;
|
|
448
|
+
maxValues?: number;
|
|
449
|
+
options: {
|
|
450
|
+
label: string;
|
|
451
|
+
value: string;
|
|
452
|
+
description?: string;
|
|
453
|
+
default?: boolean;
|
|
454
|
+
}[];
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
interface Unstable_RadioGroupData {
|
|
458
|
+
type: ComponentType.RadioGroup;
|
|
459
|
+
id?: number;
|
|
460
|
+
customId: string;
|
|
461
|
+
required?: boolean;
|
|
462
|
+
options: {
|
|
463
|
+
label: string;
|
|
464
|
+
value: string;
|
|
465
|
+
description?: string;
|
|
466
|
+
default?: boolean;
|
|
467
|
+
}[];
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
interface CreateLabelData extends Omit<LabelBuilderData, "type" | "component"> {
|
|
471
|
+
component?: LabelBuilderData["component"] | ComponentInLabelData | Unstable_CheckboxData | Unstable_CheckboxGroupData | Unstable_RadioGroupData;
|
|
472
|
+
}
|
|
427
473
|
declare function createLabel(data: CreateLabelData): LabelBuilder;
|
|
428
|
-
declare function createLabel(label: string, description?: string, component?:
|
|
429
|
-
declare function createLabel(label: string, component?:
|
|
474
|
+
declare function createLabel(label: string, description?: string, component?: CreateLabelData["component"], id?: number): LabelBuilder;
|
|
475
|
+
declare function createLabel(label: string, component?: CreateLabelData["component"], id?: number): LabelBuilder;
|
|
430
476
|
|
|
431
477
|
type ModalComponents = LabelBuilder | TextDisplayBuilder | string | null | boolean | undefined;
|
|
432
478
|
type ResolveModalData = {
|
|
@@ -471,7 +517,17 @@ declare function modalFieldsToRecord<const T = ModalFieldsRecord>(data: ResolveM
|
|
|
471
517
|
declare function modalFieldsToRecord<const T = ModalFieldsRecord>(data: ResolveModalData, parse: (record: ModalFieldsRecord) => T): T;
|
|
472
518
|
type ModalFields = (LabelComponentData | TextDisplayComponentData)[];
|
|
473
519
|
declare function createModalFields(...components: ModalComponents[]): ModalFields;
|
|
520
|
+
interface CreateModalOptions {
|
|
521
|
+
customId: string;
|
|
522
|
+
title: string;
|
|
523
|
+
components: ModalComponents[];
|
|
524
|
+
}
|
|
525
|
+
declare function createModal(data: Partial<CreateModalOptions>): ModalBuilder;
|
|
526
|
+
declare function createModal(customId: string): ModalBuilder;
|
|
527
|
+
declare function createModal(customId: string, title: string): ModalBuilder;
|
|
528
|
+
declare function createModal(customId: string, title: string, ...components: ModalComponents[]): ModalBuilder;
|
|
474
529
|
|
|
530
|
+
type NullableValues = null | undefined | boolean;
|
|
475
531
|
/**
|
|
476
532
|
* Creates an {@link ActionRowBuilder} containing one or more UI components.
|
|
477
533
|
*
|
|
@@ -511,7 +567,7 @@ declare function createModalFields(...components: ModalComponents[]): ModalField
|
|
|
511
567
|
* })
|
|
512
568
|
* );
|
|
513
569
|
*/
|
|
514
|
-
declare function createRow<Component extends AnyComponentBuilder>(...components: (Component | Component[])[]): ActionRowBuilder<Component>;
|
|
570
|
+
declare function createRow<Component extends AnyComponentBuilder>(...components: (NullableValues | Component | Component[])[]): ActionRowBuilder<Component>;
|
|
515
571
|
|
|
516
572
|
type ThumbnailData = Partial<Omit<ThumbnailComponentData, "type">> | Attachment | AttachmentBuilder | string;
|
|
517
573
|
/**
|
|
@@ -1084,7 +1140,6 @@ declare function isAnySelectMenuBuilder(value: unknown): value is AnySelectMenuB
|
|
|
1084
1140
|
declare function isActionRowBuilder(value: unknown): value is ActionRowBuilder;
|
|
1085
1141
|
declare function isActionRowBuilder(value: unknown, withComponents: "selects"): value is ActionRowBuilder<AnySelectMenuBuilder>;
|
|
1086
1142
|
declare function isActionRowBuilder(value: unknown, withComponents: "buttons"): value is ActionRowBuilder<ButtonBuilder>;
|
|
1087
|
-
declare function isActionRowBuilder(value: unknown, withComponents: "inputs"): value is ActionRowBuilder<TextInputBuilder>;
|
|
1088
1143
|
|
|
1089
1144
|
/**
|
|
1090
1145
|
* Checks whether the given value is a {@link SectionBuilder}.
|
|
@@ -1106,6 +1161,26 @@ declare function isActionRowBuilder(value: unknown, withComponents: "inputs"): v
|
|
|
1106
1161
|
*/
|
|
1107
1162
|
declare function isSectionBuilder(value: unknown): value is SectionBuilder;
|
|
1108
1163
|
|
|
1164
|
+
/**
|
|
1165
|
+
* Checks whether the given value is a {@link FileBuilder}.
|
|
1166
|
+
*
|
|
1167
|
+
* This function returns `true` if the value is an instance of `FileBuilder`,
|
|
1168
|
+
* or if it structurally matches by constructor name.
|
|
1169
|
+
*
|
|
1170
|
+
* @param value - The value to check.
|
|
1171
|
+
* @returns `true` if the value is a `FileBuilder`, otherwise `false`.
|
|
1172
|
+
*
|
|
1173
|
+
* @example
|
|
1174
|
+
* import type { FileBuilder } from "discord.js";
|
|
1175
|
+
*
|
|
1176
|
+
* function handle(input: FileBuilder | unknown) {
|
|
1177
|
+
* if (FileBuilder(input)) {
|
|
1178
|
+
* input.setURL("https://example.com/image.png");
|
|
1179
|
+
* }
|
|
1180
|
+
* }
|
|
1181
|
+
*/
|
|
1182
|
+
declare function isFileBuilder(value: unknown): value is FileBuilder;
|
|
1183
|
+
|
|
1109
1184
|
/**
|
|
1110
1185
|
* Checks whether the given value is a {@link SeparatorBuilder}.
|
|
1111
1186
|
*
|
|
@@ -1187,5 +1262,5 @@ declare function isTextInputBuilder(value: unknown): value is TextInputBuilder;
|
|
|
1187
1262
|
*/
|
|
1188
1263
|
declare function isMessage(value: unknown): value is Message;
|
|
1189
1264
|
|
|
1190
|
-
export { ContainerPlusBuilder, CustomItents, CustomPartials, EmbedLimit, EmbedPlusBuilder, Separator, chars, commandMention, createComponents, createContainer, createEmbed, createEmbedAsset, createEmbedAuthor, createEmbedFiles, createEmbedFooter, createFile, createFileUpload, createLabel, createLinkButton, createMediaGallery, createModalFields, createModalInput, createRow, createSection, createSeparator, createTextDisplay, createTextInput, createThumbArea, createThumbnail, createWebhookClient, extractMentionId, fetchMessageFromURL, findChannel, findCommand, findEmoji, findMember, findMessage, findRole, getChannelUrlInfo, getMessageURLInfo, isActionRowBuilder, isAnySelectMenuBuilder, isAttachment, isButtonBuilder, isChannelSelectMenuBuilder, isContainerBuilder, isMediaGalleryBuilder, isMediaGalleryItemBuilder, isMentionableSelectMenuBuilder, isMessage, isModalBuilder, isRoleSelectMenuBuilder, isSectionBuilder, isSeparatorBuilder, isStringSelectMenuBuilder, isTextDisplayBuilder, isTextInputBuilder, isUserSelectMenuBuilder, modalFieldsToRecord, setMobileStatus, wrapButtons };
|
|
1191
|
-
export type { AnyEmbedData, AnySelectMenuBuilder, ComponentBuildersData, ComponentData,
|
|
1265
|
+
export { ContainerPlusBuilder, CustomItents, CustomPartials, EmbedLimit, EmbedPlusBuilder, Separator, chars, commandMention, createComponents, createContainer, createEmbed, createEmbedAsset, createEmbedAuthor, createEmbedFiles, createEmbedFooter, createFile, createFileUpload, createLabel, createLinkButton, createMediaGallery, createModal, createModalFields, createModalInput, createRow, createSection, createSeparator, createTextDisplay, createTextInput, createThumbArea, createThumbnail, createWebhookClient, extractMentionId, fetchMessageFromURL, findChannel, findCommand, findEmoji, findMember, findMessage, findRole, getChannelUrlInfo, getMessageURLInfo, isActionRowBuilder, isAnySelectMenuBuilder, isAttachment, isButtonBuilder, isChannelSelectMenuBuilder, isContainerBuilder, isFileBuilder, isMediaGalleryBuilder, isMediaGalleryItemBuilder, isMentionableSelectMenuBuilder, isMessage, isModalBuilder, isRoleSelectMenuBuilder, isSectionBuilder, isSeparatorBuilder, isStringSelectMenuBuilder, isTextDisplayBuilder, isTextInputBuilder, isUserSelectMenuBuilder, modalFieldsToRecord, setMobileStatus, wrapButtons };
|
|
1266
|
+
export type { AnyEmbedData, AnySelectMenuBuilder, ComponentBuildersData, ComponentData, ContainerColor, ContainerComponentBuilder, ContainerData, ContainerInComponentType, CreateComponentData, CreateModalOptions, EmbedPlusAssetData, EmbedPlusAuthorData, EmbedPlusColorData, EmbedPlusData, EmbedPlusFooterData, EmbedPlusProperty, FileUploadData, MagicComponentData, MediaGallerySource, SectionAccessory, SectionAccessoryData, SectionButtonAccessory, SectionData, SectionThumbnailAccessory, SeparatorData, ThumbAreaData, ThumbAreaThumbnail, ThumbnailData, Unstable_CheckboxData, Unstable_CheckboxGroupData, Unstable_RadioGroupData };
|
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, GuildEmoji, GuildMember, GuildTextBasedChannel, Message, Role, WebhookClientOptions, WebhookClient, WebhookClientData, ComponentEmojiResolvable, ButtonBuilder, ActionRowBuilder, LinkButtonComponentData, Attachment, AttachmentBuilder, MessageActionRowComponentBuilder, TextDisplayBuilder, SeparatorBuilder, FileBuilder, SectionBuilder, MediaGalleryBuilder, ContainerBuilder, ContainerComponentBuilder as ContainerComponentBuilder$1, ColorResolvable, ComponentType, ContainerComponentData, ContainerComponent, APIUnfurledMediaItem, MediaGalleryItemData, TextInputBuilder, TextInputComponentData, TextInputStyle, LabelBuilderData,
|
|
2
|
+
import { GatewayIntentBits, Partials, ChannelType, Guild, CommandInteractionOption, Client, ApplicationCommand, GuildEmoji, GuildMember, GuildTextBasedChannel, Message, Role, WebhookClientOptions, WebhookClient, WebhookClientData, ComponentEmojiResolvable, ButtonBuilder, ActionRowBuilder, LinkButtonComponentData, Attachment, AttachmentBuilder, MessageActionRowComponentBuilder, TextDisplayBuilder, SeparatorBuilder, FileBuilder, SectionBuilder, MediaGalleryBuilder, ContainerBuilder, ContainerComponentBuilder as ContainerComponentBuilder$1, ColorResolvable, ComponentType, ContainerComponentData, ContainerComponent, APIUnfurledMediaItem, MediaGalleryItemData, TextInputBuilder, TextInputComponentData, TextInputStyle, LabelBuilder, LabelBuilderData, ComponentInLabelData, ModalBuilder, Collection, ModalData, LabelComponentData, TextDisplayComponentData, AnyComponentBuilder, ThumbnailComponentData, ThumbnailBuilder, ButtonComponentData, FileUploadBuilder, EmbedAssetData, User, ClientUser, ImageURLOptions, EmbedFooterData, APIEmbed, Embed, EmbedData, EmbedBuilder, AttachmentData, MediaGalleryItemBuilder, StringSelectMenuBuilder, UserSelectMenuBuilder, RoleSelectMenuBuilder, ChannelSelectMenuBuilder, MentionableSelectMenuBuilder } from 'discord.js';
|
|
3
3
|
export * from '@magicyan/core';
|
|
4
4
|
|
|
5
5
|
declare const chars: {
|
|
@@ -216,7 +216,7 @@ type CreateComponentData = ComponentData | ContainerBuilder;
|
|
|
216
216
|
type ContainerComponentBuilder = Exclude<ContainerComponentBuilder$1, ActionRowBuilder> | ActionRowBuilder<MessageActionRowComponentBuilder>;
|
|
217
217
|
type CreateComponentsReturn<IsContainer> = IsContainer extends true ? ContainerComponentBuilder[] : (ContainerComponentBuilder | ContainerBuilder)[];
|
|
218
218
|
type CreateComponentsData<IsContainer> = IsContainer extends true ? ComponentData : ComponentData | ContainerBuilder;
|
|
219
|
-
declare function createComponents<IsContainer extends boolean = false, Data extends CreateComponentsData<IsContainer> = CreateComponentsData<IsContainer
|
|
219
|
+
declare function createComponents<IsContainer extends boolean = false, Data extends CreateComponentsData<IsContainer>[] = CreateComponentsData<IsContainer>[]>(...data: (Data | Data[])): CreateComponentsReturn<IsContainer>;
|
|
220
220
|
|
|
221
221
|
type ContainerColor = (string & {}) | ColorResolvable;
|
|
222
222
|
type ContainerInComponentType = ComponentType.TextDisplay | ComponentType.ActionRow | ComponentType.Section | ComponentType.Separator | ComponentType.MediaGallery | ComponentType.File;
|
|
@@ -261,6 +261,9 @@ declare class ContainerPlusBuilder extends ContainerBuilder {
|
|
|
261
261
|
* container.setComponent(1, null); // Removes the component at index 1.
|
|
262
262
|
*/
|
|
263
263
|
setComponent(index: number, data: ComponentData | null): this;
|
|
264
|
+
insertComponent(data: ComponentData): this;
|
|
265
|
+
insertComponent(index: number, data?: ComponentData): this;
|
|
266
|
+
private _spliceComponents;
|
|
264
267
|
/**
|
|
265
268
|
* Retrieves a component from the container at the specified index, optionally filtering by component type.
|
|
266
269
|
*
|
|
@@ -281,6 +284,14 @@ declare class ContainerPlusBuilder extends ContainerBuilder {
|
|
|
281
284
|
componentAt(index: number, type: ComponentType.Separator): SeparatorBuilder | undefined;
|
|
282
285
|
componentAt(index: number, type: ComponentType.MediaGallery): MediaGalleryBuilder | undefined;
|
|
283
286
|
componentAt(index: number, type: ComponentType.File): FileBuilder | undefined;
|
|
287
|
+
get buttonComponents(): ButtonBuilder[];
|
|
288
|
+
get sectionComponents(): SectionBuilder[];
|
|
289
|
+
get selectMenuComponents(): AnySelectMenuBuilder[];
|
|
290
|
+
get textDisplayComponents(): TextDisplayBuilder[];
|
|
291
|
+
get actionRowComponents(): (ActionRowBuilder<ButtonBuilder> | ActionRowBuilder<AnySelectMenuBuilder>)[];
|
|
292
|
+
get mediaGalleryComponents(): MediaGalleryBuilder[];
|
|
293
|
+
get fileComponents(): FileBuilder[];
|
|
294
|
+
get separatorComponents(): SeparatorBuilder[];
|
|
284
295
|
}
|
|
285
296
|
/**
|
|
286
297
|
* Creates one or multiple {@link ContainerPlusBuilder} components with optional accent color and child components.
|
|
@@ -370,7 +381,7 @@ interface CreateFileOptions extends Omit<APIUnfurledMediaItem, "url"> {
|
|
|
370
381
|
*/
|
|
371
382
|
declare function createFile(source: FileSource, options?: CreateFileOptions): FileBuilder;
|
|
372
383
|
|
|
373
|
-
type MediaGallerySource = MediaGalleryItemData |
|
|
384
|
+
type MediaGallerySource = MediaGalleryItemData | Attachment | AttachmentBuilder | string | null | undefined | boolean;
|
|
374
385
|
/**
|
|
375
386
|
* Creates a {@link MediaGalleryBuilder} instance with a collection of media items, which can be images, attachments, or URLs.
|
|
376
387
|
*
|
|
@@ -422,11 +433,46 @@ declare function createModalInput(data: Omit<TextInputComponentData, "type" | "s
|
|
|
422
433
|
style?: TextInputStyle;
|
|
423
434
|
}): ActionRowBuilder<TextInputBuilder>;
|
|
424
435
|
|
|
425
|
-
|
|
426
|
-
type
|
|
436
|
+
interface Unstable_CheckboxData {
|
|
437
|
+
type: ComponentType.Checkbox;
|
|
438
|
+
customId: string;
|
|
439
|
+
default?: boolean;
|
|
440
|
+
id?: number;
|
|
441
|
+
}
|
|
442
|
+
interface Unstable_CheckboxGroupData {
|
|
443
|
+
type: ComponentType.CheckboxGroup;
|
|
444
|
+
id?: number;
|
|
445
|
+
customId: string;
|
|
446
|
+
required?: boolean;
|
|
447
|
+
minValues?: number;
|
|
448
|
+
maxValues?: number;
|
|
449
|
+
options: {
|
|
450
|
+
label: string;
|
|
451
|
+
value: string;
|
|
452
|
+
description?: string;
|
|
453
|
+
default?: boolean;
|
|
454
|
+
}[];
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
interface Unstable_RadioGroupData {
|
|
458
|
+
type: ComponentType.RadioGroup;
|
|
459
|
+
id?: number;
|
|
460
|
+
customId: string;
|
|
461
|
+
required?: boolean;
|
|
462
|
+
options: {
|
|
463
|
+
label: string;
|
|
464
|
+
value: string;
|
|
465
|
+
description?: string;
|
|
466
|
+
default?: boolean;
|
|
467
|
+
}[];
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
interface CreateLabelData extends Omit<LabelBuilderData, "type" | "component"> {
|
|
471
|
+
component?: LabelBuilderData["component"] | ComponentInLabelData | Unstable_CheckboxData | Unstable_CheckboxGroupData | Unstable_RadioGroupData;
|
|
472
|
+
}
|
|
427
473
|
declare function createLabel(data: CreateLabelData): LabelBuilder;
|
|
428
|
-
declare function createLabel(label: string, description?: string, component?:
|
|
429
|
-
declare function createLabel(label: string, component?:
|
|
474
|
+
declare function createLabel(label: string, description?: string, component?: CreateLabelData["component"], id?: number): LabelBuilder;
|
|
475
|
+
declare function createLabel(label: string, component?: CreateLabelData["component"], id?: number): LabelBuilder;
|
|
430
476
|
|
|
431
477
|
type ModalComponents = LabelBuilder | TextDisplayBuilder | string | null | boolean | undefined;
|
|
432
478
|
type ResolveModalData = {
|
|
@@ -471,7 +517,17 @@ declare function modalFieldsToRecord<const T = ModalFieldsRecord>(data: ResolveM
|
|
|
471
517
|
declare function modalFieldsToRecord<const T = ModalFieldsRecord>(data: ResolveModalData, parse: (record: ModalFieldsRecord) => T): T;
|
|
472
518
|
type ModalFields = (LabelComponentData | TextDisplayComponentData)[];
|
|
473
519
|
declare function createModalFields(...components: ModalComponents[]): ModalFields;
|
|
520
|
+
interface CreateModalOptions {
|
|
521
|
+
customId: string;
|
|
522
|
+
title: string;
|
|
523
|
+
components: ModalComponents[];
|
|
524
|
+
}
|
|
525
|
+
declare function createModal(data: Partial<CreateModalOptions>): ModalBuilder;
|
|
526
|
+
declare function createModal(customId: string): ModalBuilder;
|
|
527
|
+
declare function createModal(customId: string, title: string): ModalBuilder;
|
|
528
|
+
declare function createModal(customId: string, title: string, ...components: ModalComponents[]): ModalBuilder;
|
|
474
529
|
|
|
530
|
+
type NullableValues = null | undefined | boolean;
|
|
475
531
|
/**
|
|
476
532
|
* Creates an {@link ActionRowBuilder} containing one or more UI components.
|
|
477
533
|
*
|
|
@@ -511,7 +567,7 @@ declare function createModalFields(...components: ModalComponents[]): ModalField
|
|
|
511
567
|
* })
|
|
512
568
|
* );
|
|
513
569
|
*/
|
|
514
|
-
declare function createRow<Component extends AnyComponentBuilder>(...components: (Component | Component[])[]): ActionRowBuilder<Component>;
|
|
570
|
+
declare function createRow<Component extends AnyComponentBuilder>(...components: (NullableValues | Component | Component[])[]): ActionRowBuilder<Component>;
|
|
515
571
|
|
|
516
572
|
type ThumbnailData = Partial<Omit<ThumbnailComponentData, "type">> | Attachment | AttachmentBuilder | string;
|
|
517
573
|
/**
|
|
@@ -1084,7 +1140,6 @@ declare function isAnySelectMenuBuilder(value: unknown): value is AnySelectMenuB
|
|
|
1084
1140
|
declare function isActionRowBuilder(value: unknown): value is ActionRowBuilder;
|
|
1085
1141
|
declare function isActionRowBuilder(value: unknown, withComponents: "selects"): value is ActionRowBuilder<AnySelectMenuBuilder>;
|
|
1086
1142
|
declare function isActionRowBuilder(value: unknown, withComponents: "buttons"): value is ActionRowBuilder<ButtonBuilder>;
|
|
1087
|
-
declare function isActionRowBuilder(value: unknown, withComponents: "inputs"): value is ActionRowBuilder<TextInputBuilder>;
|
|
1088
1143
|
|
|
1089
1144
|
/**
|
|
1090
1145
|
* Checks whether the given value is a {@link SectionBuilder}.
|
|
@@ -1106,6 +1161,26 @@ declare function isActionRowBuilder(value: unknown, withComponents: "inputs"): v
|
|
|
1106
1161
|
*/
|
|
1107
1162
|
declare function isSectionBuilder(value: unknown): value is SectionBuilder;
|
|
1108
1163
|
|
|
1164
|
+
/**
|
|
1165
|
+
* Checks whether the given value is a {@link FileBuilder}.
|
|
1166
|
+
*
|
|
1167
|
+
* This function returns `true` if the value is an instance of `FileBuilder`,
|
|
1168
|
+
* or if it structurally matches by constructor name.
|
|
1169
|
+
*
|
|
1170
|
+
* @param value - The value to check.
|
|
1171
|
+
* @returns `true` if the value is a `FileBuilder`, otherwise `false`.
|
|
1172
|
+
*
|
|
1173
|
+
* @example
|
|
1174
|
+
* import type { FileBuilder } from "discord.js";
|
|
1175
|
+
*
|
|
1176
|
+
* function handle(input: FileBuilder | unknown) {
|
|
1177
|
+
* if (FileBuilder(input)) {
|
|
1178
|
+
* input.setURL("https://example.com/image.png");
|
|
1179
|
+
* }
|
|
1180
|
+
* }
|
|
1181
|
+
*/
|
|
1182
|
+
declare function isFileBuilder(value: unknown): value is FileBuilder;
|
|
1183
|
+
|
|
1109
1184
|
/**
|
|
1110
1185
|
* Checks whether the given value is a {@link SeparatorBuilder}.
|
|
1111
1186
|
*
|
|
@@ -1187,5 +1262,5 @@ declare function isTextInputBuilder(value: unknown): value is TextInputBuilder;
|
|
|
1187
1262
|
*/
|
|
1188
1263
|
declare function isMessage(value: unknown): value is Message;
|
|
1189
1264
|
|
|
1190
|
-
export { ContainerPlusBuilder, CustomItents, CustomPartials, EmbedLimit, EmbedPlusBuilder, Separator, chars, commandMention, createComponents, createContainer, createEmbed, createEmbedAsset, createEmbedAuthor, createEmbedFiles, createEmbedFooter, createFile, createFileUpload, createLabel, createLinkButton, createMediaGallery, createModalFields, createModalInput, createRow, createSection, createSeparator, createTextDisplay, createTextInput, createThumbArea, createThumbnail, createWebhookClient, extractMentionId, fetchMessageFromURL, findChannel, findCommand, findEmoji, findMember, findMessage, findRole, getChannelUrlInfo, getMessageURLInfo, isActionRowBuilder, isAnySelectMenuBuilder, isAttachment, isButtonBuilder, isChannelSelectMenuBuilder, isContainerBuilder, isMediaGalleryBuilder, isMediaGalleryItemBuilder, isMentionableSelectMenuBuilder, isMessage, isModalBuilder, isRoleSelectMenuBuilder, isSectionBuilder, isSeparatorBuilder, isStringSelectMenuBuilder, isTextDisplayBuilder, isTextInputBuilder, isUserSelectMenuBuilder, modalFieldsToRecord, setMobileStatus, wrapButtons };
|
|
1191
|
-
export type { AnyEmbedData, AnySelectMenuBuilder, ComponentBuildersData, ComponentData,
|
|
1265
|
+
export { ContainerPlusBuilder, CustomItents, CustomPartials, EmbedLimit, EmbedPlusBuilder, Separator, chars, commandMention, createComponents, createContainer, createEmbed, createEmbedAsset, createEmbedAuthor, createEmbedFiles, createEmbedFooter, createFile, createFileUpload, createLabel, createLinkButton, createMediaGallery, createModal, createModalFields, createModalInput, createRow, createSection, createSeparator, createTextDisplay, createTextInput, createThumbArea, createThumbnail, createWebhookClient, extractMentionId, fetchMessageFromURL, findChannel, findCommand, findEmoji, findMember, findMessage, findRole, getChannelUrlInfo, getMessageURLInfo, isActionRowBuilder, isAnySelectMenuBuilder, isAttachment, isButtonBuilder, isChannelSelectMenuBuilder, isContainerBuilder, isFileBuilder, isMediaGalleryBuilder, isMediaGalleryItemBuilder, isMentionableSelectMenuBuilder, isMessage, isModalBuilder, isRoleSelectMenuBuilder, isSectionBuilder, isSeparatorBuilder, isStringSelectMenuBuilder, isTextDisplayBuilder, isTextInputBuilder, isUserSelectMenuBuilder, modalFieldsToRecord, setMobileStatus, wrapButtons };
|
|
1266
|
+
export type { AnyEmbedData, AnySelectMenuBuilder, ComponentBuildersData, ComponentData, ContainerColor, ContainerComponentBuilder, ContainerData, ContainerInComponentType, CreateComponentData, CreateModalOptions, EmbedPlusAssetData, EmbedPlusAuthorData, EmbedPlusColorData, EmbedPlusData, EmbedPlusFooterData, EmbedPlusProperty, FileUploadData, MagicComponentData, MediaGallerySource, SectionAccessory, SectionAccessoryData, SectionButtonAccessory, SectionData, SectionThumbnailAccessory, SeparatorData, ThumbAreaData, ThumbAreaThumbnail, ThumbnailData, Unstable_CheckboxData, Unstable_CheckboxGroupData, Unstable_RadioGroupData };
|
package/dist/index.mjs
CHANGED
|
@@ -18,7 +18,7 @@ export { createFile } from './functions/components/file.mjs';
|
|
|
18
18
|
export { createMediaGallery } from './functions/components/gallery.mjs';
|
|
19
19
|
export { createModalInput, createTextInput } from './functions/components/input.mjs';
|
|
20
20
|
export { createLabel } from './functions/components/label.mjs';
|
|
21
|
-
export { createModalFields, modalFieldsToRecord } from './functions/components/modal.mjs';
|
|
21
|
+
export { createModal, createModalFields, modalFieldsToRecord } from './functions/components/modal.mjs';
|
|
22
22
|
export { createRow } from './functions/components/row.mjs';
|
|
23
23
|
export { createSection } from './functions/components/section.mjs';
|
|
24
24
|
export { createSeparator } from './functions/components/separator.mjs';
|
|
@@ -39,6 +39,7 @@ export { isModalBuilder } from './guards/components/modal.mjs';
|
|
|
39
39
|
export { isActionRowBuilder } from './guards/components/row.mjs';
|
|
40
40
|
export { isSectionBuilder } from './guards/components/section.mjs';
|
|
41
41
|
export { isAnySelectMenuBuilder, isChannelSelectMenuBuilder, isMentionableSelectMenuBuilder, isRoleSelectMenuBuilder, isStringSelectMenuBuilder, isUserSelectMenuBuilder } from './guards/components/selectmenu.mjs';
|
|
42
|
+
export { isFileBuilder } from './guards/components/file.mjs';
|
|
42
43
|
export { isSeparatorBuilder } from './guards/components/separator.mjs';
|
|
43
44
|
export { isTextDisplayBuilder } from './guards/components/textdisplay.mjs';
|
|
44
45
|
export { isTextInputBuilder } from './guards/components/textinput.mjs';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@magicyan/discord",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.1",
|
|
4
4
|
"description": "Simple functions to facilitate discord bot development",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"test": "vitest"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
|
-
"discord.js": "^14.
|
|
42
|
+
"discord.js": "^14.25.1"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@magicyan/config": "*",
|