@magicyan/discord 1.0.18 → 1.0.20
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/constants/chars.cjs +7 -0
- package/dist/constants/chars.mjs +5 -0
- package/dist/functions/channels.cjs +23 -10
- package/dist/functions/channels.mjs +23 -10
- package/dist/functions/embeds.cjs +101 -17
- package/dist/functions/embeds.mjs +101 -18
- package/dist/index.cjs +3 -0
- package/dist/index.d.cts +58 -28
- package/dist/index.d.mts +58 -28
- package/dist/index.d.ts +58 -28
- package/dist/index.mjs +2 -1
- package/package.json +2 -2
|
@@ -6,9 +6,9 @@ function findChannel(guild, type) {
|
|
|
6
6
|
const channelType = type ?? discord_js.ChannelType.GuildText;
|
|
7
7
|
const cache = guild.channels.cache;
|
|
8
8
|
return {
|
|
9
|
-
byName(name) {
|
|
9
|
+
byName(name, filter = () => true) {
|
|
10
10
|
return cache.find(
|
|
11
|
-
(c) => c.name === name && c.type === channelType
|
|
11
|
+
(c) => c.name === name && c.type === channelType && filter
|
|
12
12
|
);
|
|
13
13
|
},
|
|
14
14
|
byId(id) {
|
|
@@ -16,30 +16,43 @@ function findChannel(guild, type) {
|
|
|
16
16
|
(c) => c.id === id && c.type === channelType
|
|
17
17
|
);
|
|
18
18
|
},
|
|
19
|
+
byFilter(filter) {
|
|
20
|
+
return cache.find((c) => c.type == type && filter);
|
|
21
|
+
},
|
|
19
22
|
inCategoryId(id) {
|
|
20
23
|
return {
|
|
21
|
-
byName(name) {
|
|
24
|
+
byName(name, filter = () => true) {
|
|
25
|
+
return cache.find(
|
|
26
|
+
(c) => c.name === name && c.type === channelType && c.parentId == id && filter
|
|
27
|
+
);
|
|
28
|
+
},
|
|
29
|
+
byId(id2, filter = () => true) {
|
|
22
30
|
return cache.find(
|
|
23
|
-
(c) => c.
|
|
31
|
+
(c) => c.id === id2 && c.type === channelType && c.parentId == id2 && filter
|
|
24
32
|
);
|
|
25
33
|
},
|
|
26
|
-
|
|
34
|
+
byFilter(filter) {
|
|
27
35
|
return cache.find(
|
|
28
|
-
(c) => c.
|
|
36
|
+
(c) => c.type === channelType && c.parent?.id == id && filter
|
|
29
37
|
);
|
|
30
38
|
}
|
|
31
39
|
};
|
|
32
40
|
},
|
|
33
41
|
inCategoryName(name) {
|
|
34
42
|
return {
|
|
35
|
-
byName(name2) {
|
|
43
|
+
byName(name2, filter = () => true) {
|
|
44
|
+
return cache.find(
|
|
45
|
+
(c) => c.name === name2 && c.type === channelType && c.parent?.name == name2 && filter
|
|
46
|
+
);
|
|
47
|
+
},
|
|
48
|
+
byId(id, filter = () => true) {
|
|
36
49
|
return cache.find(
|
|
37
|
-
(c) => c.
|
|
50
|
+
(c) => c.id === id && c.type === channelType && c.parent?.name == name && filter
|
|
38
51
|
);
|
|
39
52
|
},
|
|
40
|
-
|
|
53
|
+
byFilter(filter) {
|
|
41
54
|
return cache.find(
|
|
42
|
-
(c) => c.
|
|
55
|
+
(c) => c.type === channelType && c.parent?.name == name && filter
|
|
43
56
|
);
|
|
44
57
|
}
|
|
45
58
|
};
|
|
@@ -4,9 +4,9 @@ function findChannel(guild, type) {
|
|
|
4
4
|
const channelType = type ?? ChannelType.GuildText;
|
|
5
5
|
const cache = guild.channels.cache;
|
|
6
6
|
return {
|
|
7
|
-
byName(name) {
|
|
7
|
+
byName(name, filter = () => true) {
|
|
8
8
|
return cache.find(
|
|
9
|
-
(c) => c.name === name && c.type === channelType
|
|
9
|
+
(c) => c.name === name && c.type === channelType && filter
|
|
10
10
|
);
|
|
11
11
|
},
|
|
12
12
|
byId(id) {
|
|
@@ -14,30 +14,43 @@ function findChannel(guild, type) {
|
|
|
14
14
|
(c) => c.id === id && c.type === channelType
|
|
15
15
|
);
|
|
16
16
|
},
|
|
17
|
+
byFilter(filter) {
|
|
18
|
+
return cache.find((c) => c.type == type && filter);
|
|
19
|
+
},
|
|
17
20
|
inCategoryId(id) {
|
|
18
21
|
return {
|
|
19
|
-
byName(name) {
|
|
22
|
+
byName(name, filter = () => true) {
|
|
23
|
+
return cache.find(
|
|
24
|
+
(c) => c.name === name && c.type === channelType && c.parentId == id && filter
|
|
25
|
+
);
|
|
26
|
+
},
|
|
27
|
+
byId(id2, filter = () => true) {
|
|
20
28
|
return cache.find(
|
|
21
|
-
(c) => c.
|
|
29
|
+
(c) => c.id === id2 && c.type === channelType && c.parentId == id2 && filter
|
|
22
30
|
);
|
|
23
31
|
},
|
|
24
|
-
|
|
32
|
+
byFilter(filter) {
|
|
25
33
|
return cache.find(
|
|
26
|
-
(c) => c.
|
|
34
|
+
(c) => c.type === channelType && c.parent?.id == id && filter
|
|
27
35
|
);
|
|
28
36
|
}
|
|
29
37
|
};
|
|
30
38
|
},
|
|
31
39
|
inCategoryName(name) {
|
|
32
40
|
return {
|
|
33
|
-
byName(name2) {
|
|
41
|
+
byName(name2, filter = () => true) {
|
|
42
|
+
return cache.find(
|
|
43
|
+
(c) => c.name === name2 && c.type === channelType && c.parent?.name == name2 && filter
|
|
44
|
+
);
|
|
45
|
+
},
|
|
46
|
+
byId(id, filter = () => true) {
|
|
34
47
|
return cache.find(
|
|
35
|
-
(c) => c.
|
|
48
|
+
(c) => c.id === id && c.type === channelType && c.parent?.name == name && filter
|
|
36
49
|
);
|
|
37
50
|
},
|
|
38
|
-
|
|
51
|
+
byFilter(filter) {
|
|
39
52
|
return cache.find(
|
|
40
|
-
(c) => c.
|
|
53
|
+
(c) => c.type === channelType && c.parent?.name == name && filter
|
|
41
54
|
);
|
|
42
55
|
}
|
|
43
56
|
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const core = require('@magicyan/core');
|
|
4
3
|
const discord_js = require('discord.js');
|
|
4
|
+
const chars = require('../constants/chars.cjs');
|
|
5
|
+
const core = require('@magicyan/core');
|
|
5
6
|
|
|
6
7
|
function createEmbedAuthor(options) {
|
|
7
8
|
const {
|
|
@@ -14,7 +15,7 @@ function createEmbedAuthor(options) {
|
|
|
14
15
|
suffix = ""
|
|
15
16
|
} = options;
|
|
16
17
|
return {
|
|
17
|
-
name:
|
|
18
|
+
name: prefix + user[property] + suffix,
|
|
18
19
|
url,
|
|
19
20
|
iconURL: iconURL || user.displayAvatarURL({ size })
|
|
20
21
|
};
|
|
@@ -27,25 +28,108 @@ function createEmbedAsset(source, options) {
|
|
|
27
28
|
if (source instanceof discord_js.Attachment || source instanceof discord_js.AttachmentBuilder) {
|
|
28
29
|
return { url: `attachment://${source.name}`, ...options };
|
|
29
30
|
}
|
|
31
|
+
if (source && typeof source === "object" && "url" in source) {
|
|
32
|
+
return source;
|
|
33
|
+
}
|
|
30
34
|
return source ? { url: source, ...options } : void 0;
|
|
31
35
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
36
|
+
class EmbedBuilderPlus extends discord_js.EmbedBuilder {
|
|
37
|
+
constructor(data) {
|
|
38
|
+
const fields = (data.mergeFields ? [data.extend?.fields ?? [], data.fields ?? []].flat() : data.fields ?? data.extend?.fields ?? []).map(({ name = chars.chars.invisible, value = chars.chars.invisible, inline }) => ({
|
|
39
|
+
name,
|
|
40
|
+
value,
|
|
41
|
+
inline
|
|
42
|
+
}));
|
|
43
|
+
const extend = data.extend ? new EmbedBuilderPlus(
|
|
44
|
+
data.extend instanceof discord_js.Embed ? data.extend.data : data.extend instanceof discord_js.EmbedBuilder ? data.extend.data : data.extend
|
|
45
|
+
).data : {};
|
|
46
|
+
const { fields: _, ...exetendData } = extend;
|
|
47
|
+
const embed = new discord_js.EmbedBuilder({
|
|
48
|
+
...exetendData,
|
|
49
|
+
...data.title ? { title: data.title } : {},
|
|
50
|
+
...data.description ? { description: data.description } : {},
|
|
51
|
+
...data.url ? { url: data.url } : {},
|
|
52
|
+
...data.footer ? { footer: createEmbedFooter(data.footer) } : {},
|
|
53
|
+
...data.author ? { author: data.author } : {},
|
|
54
|
+
...data.image ? { image: createEmbedAsset(data.image) } : {},
|
|
55
|
+
...data.thumbnail ? { thumbnail: createEmbedAsset(data.thumbnail) } : {},
|
|
56
|
+
...fields.length > 0 ? { fields } : {}
|
|
57
|
+
});
|
|
58
|
+
if (data.timestamp)
|
|
59
|
+
embed.setTimestamp(
|
|
60
|
+
typeof data.timestamp === "string" ? new Date(data.timestamp) : data.timestamp
|
|
61
|
+
);
|
|
62
|
+
if (data.color)
|
|
63
|
+
embed.setColor(data.color);
|
|
64
|
+
super(embed.data);
|
|
65
|
+
}
|
|
66
|
+
has(property) {
|
|
67
|
+
return Object.hasOwn(this, property);
|
|
68
|
+
}
|
|
69
|
+
toArray() {
|
|
70
|
+
return [this];
|
|
71
|
+
}
|
|
72
|
+
toString(space = 2) {
|
|
73
|
+
return JSON.stringify(this, null, space);
|
|
74
|
+
}
|
|
75
|
+
updateField(index, field) {
|
|
76
|
+
if (this.fields.at(index)) {
|
|
77
|
+
const fields = Array.from(this.fields);
|
|
78
|
+
if (field.name)
|
|
79
|
+
fields[index].name = field.name;
|
|
80
|
+
if (field.value)
|
|
81
|
+
fields[index].value = field.value;
|
|
82
|
+
if (field.inline)
|
|
83
|
+
fields[index].inline = field.inline;
|
|
84
|
+
this.setFields(fields);
|
|
85
|
+
}
|
|
86
|
+
return this;
|
|
87
|
+
}
|
|
88
|
+
deleteField(index) {
|
|
89
|
+
if (this.fields.at(index)) {
|
|
90
|
+
this.setFields(this.fields.toSpliced(index, 1));
|
|
91
|
+
}
|
|
92
|
+
return this;
|
|
93
|
+
}
|
|
94
|
+
popField() {
|
|
95
|
+
const fields = Array.from(this.fields);
|
|
96
|
+
const field = fields.pop();
|
|
97
|
+
this.setFields(fields);
|
|
98
|
+
return field;
|
|
99
|
+
}
|
|
100
|
+
setAsset(asset, source) {
|
|
101
|
+
let url = void 0;
|
|
102
|
+
if (source instanceof discord_js.Attachment || source instanceof discord_js.AttachmentBuilder) {
|
|
103
|
+
url = `attachment://${source.name}`;
|
|
104
|
+
}
|
|
105
|
+
if (source && typeof source === "object" && "url" in source) {
|
|
106
|
+
url = source.url;
|
|
107
|
+
}
|
|
108
|
+
if (!url)
|
|
109
|
+
return this;
|
|
110
|
+
if (asset === "thumbnail") {
|
|
111
|
+
this.setImage(url);
|
|
112
|
+
} else {
|
|
113
|
+
this.setThumbnail(url);
|
|
114
|
+
}
|
|
115
|
+
return this;
|
|
116
|
+
}
|
|
117
|
+
get fieldsLength() {
|
|
118
|
+
return this.data.fields?.length ?? 0;
|
|
119
|
+
}
|
|
120
|
+
get fields() {
|
|
121
|
+
return this.data.fields ?? [];
|
|
122
|
+
}
|
|
123
|
+
createFromThis(data = {}) {
|
|
124
|
+
data.extend = this;
|
|
125
|
+
return new EmbedBuilderPlus(data);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
function createEmbed(data) {
|
|
129
|
+
return new EmbedBuilderPlus(data);
|
|
47
130
|
}
|
|
48
131
|
|
|
132
|
+
exports.EmbedBuilderPlus = EmbedBuilderPlus;
|
|
49
133
|
exports.createEmbed = createEmbed;
|
|
50
134
|
exports.createEmbedAsset = createEmbedAsset;
|
|
51
135
|
exports.createEmbedAuthor = createEmbedAuthor;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { Attachment, AttachmentBuilder, EmbedBuilder, Embed } from 'discord.js';
|
|
2
|
+
import { chars } from '../constants/chars.mjs';
|
|
1
3
|
import { notFound } from '@magicyan/core';
|
|
2
|
-
import { Attachment, AttachmentBuilder, EmbedBuilder } from 'discord.js';
|
|
3
4
|
|
|
4
5
|
function createEmbedAuthor(options) {
|
|
5
6
|
const {
|
|
@@ -12,7 +13,7 @@ function createEmbedAuthor(options) {
|
|
|
12
13
|
suffix = ""
|
|
13
14
|
} = options;
|
|
14
15
|
return {
|
|
15
|
-
name:
|
|
16
|
+
name: prefix + user[property] + suffix,
|
|
16
17
|
url,
|
|
17
18
|
iconURL: iconURL || user.displayAvatarURL({ size })
|
|
18
19
|
};
|
|
@@ -25,23 +26,105 @@ function createEmbedAsset(source, options) {
|
|
|
25
26
|
if (source instanceof Attachment || source instanceof AttachmentBuilder) {
|
|
26
27
|
return { url: `attachment://${source.name}`, ...options };
|
|
27
28
|
}
|
|
29
|
+
if (source && typeof source === "object" && "url" in source) {
|
|
30
|
+
return source;
|
|
31
|
+
}
|
|
28
32
|
return source ? { url: source, ...options } : void 0;
|
|
29
33
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
34
|
+
class EmbedBuilderPlus extends EmbedBuilder {
|
|
35
|
+
constructor(data) {
|
|
36
|
+
const fields = (data.mergeFields ? [data.extend?.fields ?? [], data.fields ?? []].flat() : data.fields ?? data.extend?.fields ?? []).map(({ name = chars.invisible, value = chars.invisible, inline }) => ({
|
|
37
|
+
name,
|
|
38
|
+
value,
|
|
39
|
+
inline
|
|
40
|
+
}));
|
|
41
|
+
const extend = data.extend ? new EmbedBuilderPlus(
|
|
42
|
+
data.extend instanceof Embed ? data.extend.data : data.extend instanceof EmbedBuilder ? data.extend.data : data.extend
|
|
43
|
+
).data : {};
|
|
44
|
+
const { fields: _, ...exetendData } = extend;
|
|
45
|
+
const embed = new EmbedBuilder({
|
|
46
|
+
...exetendData,
|
|
47
|
+
...data.title ? { title: data.title } : {},
|
|
48
|
+
...data.description ? { description: data.description } : {},
|
|
49
|
+
...data.url ? { url: data.url } : {},
|
|
50
|
+
...data.footer ? { footer: createEmbedFooter(data.footer) } : {},
|
|
51
|
+
...data.author ? { author: data.author } : {},
|
|
52
|
+
...data.image ? { image: createEmbedAsset(data.image) } : {},
|
|
53
|
+
...data.thumbnail ? { thumbnail: createEmbedAsset(data.thumbnail) } : {},
|
|
54
|
+
...fields.length > 0 ? { fields } : {}
|
|
55
|
+
});
|
|
56
|
+
if (data.timestamp)
|
|
57
|
+
embed.setTimestamp(
|
|
58
|
+
typeof data.timestamp === "string" ? new Date(data.timestamp) : data.timestamp
|
|
59
|
+
);
|
|
60
|
+
if (data.color)
|
|
61
|
+
embed.setColor(data.color);
|
|
62
|
+
super(embed.data);
|
|
63
|
+
}
|
|
64
|
+
has(property) {
|
|
65
|
+
return Object.hasOwn(this, property);
|
|
66
|
+
}
|
|
67
|
+
toArray() {
|
|
68
|
+
return [this];
|
|
69
|
+
}
|
|
70
|
+
toString(space = 2) {
|
|
71
|
+
return JSON.stringify(this, null, space);
|
|
72
|
+
}
|
|
73
|
+
updateField(index, field) {
|
|
74
|
+
if (this.fields.at(index)) {
|
|
75
|
+
const fields = Array.from(this.fields);
|
|
76
|
+
if (field.name)
|
|
77
|
+
fields[index].name = field.name;
|
|
78
|
+
if (field.value)
|
|
79
|
+
fields[index].value = field.value;
|
|
80
|
+
if (field.inline)
|
|
81
|
+
fields[index].inline = field.inline;
|
|
82
|
+
this.setFields(fields);
|
|
83
|
+
}
|
|
84
|
+
return this;
|
|
85
|
+
}
|
|
86
|
+
deleteField(index) {
|
|
87
|
+
if (this.fields.at(index)) {
|
|
88
|
+
this.setFields(this.fields.toSpliced(index, 1));
|
|
89
|
+
}
|
|
90
|
+
return this;
|
|
91
|
+
}
|
|
92
|
+
popField() {
|
|
93
|
+
const fields = Array.from(this.fields);
|
|
94
|
+
const field = fields.pop();
|
|
95
|
+
this.setFields(fields);
|
|
96
|
+
return field;
|
|
97
|
+
}
|
|
98
|
+
setAsset(asset, source) {
|
|
99
|
+
let url = void 0;
|
|
100
|
+
if (source instanceof Attachment || source instanceof AttachmentBuilder) {
|
|
101
|
+
url = `attachment://${source.name}`;
|
|
102
|
+
}
|
|
103
|
+
if (source && typeof source === "object" && "url" in source) {
|
|
104
|
+
url = source.url;
|
|
105
|
+
}
|
|
106
|
+
if (!url)
|
|
107
|
+
return this;
|
|
108
|
+
if (asset === "thumbnail") {
|
|
109
|
+
this.setImage(url);
|
|
110
|
+
} else {
|
|
111
|
+
this.setThumbnail(url);
|
|
112
|
+
}
|
|
113
|
+
return this;
|
|
114
|
+
}
|
|
115
|
+
get fieldsLength() {
|
|
116
|
+
return this.data.fields?.length ?? 0;
|
|
117
|
+
}
|
|
118
|
+
get fields() {
|
|
119
|
+
return this.data.fields ?? [];
|
|
120
|
+
}
|
|
121
|
+
createFromThis(data = {}) {
|
|
122
|
+
data.extend = this;
|
|
123
|
+
return new EmbedBuilderPlus(data);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
function createEmbed(data) {
|
|
127
|
+
return new EmbedBuilderPlus(data);
|
|
45
128
|
}
|
|
46
129
|
|
|
47
|
-
export { createEmbed, createEmbedAsset, createEmbedAuthor, createEmbedFooter };
|
|
130
|
+
export { EmbedBuilderPlus, createEmbed, createEmbedAsset, createEmbedAuthor, createEmbedFooter };
|
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
const chars = require('./constants/chars.cjs');
|
|
3
4
|
const client = require('./constants/client.cjs');
|
|
4
5
|
const channels = require('./functions/channels.cjs');
|
|
5
6
|
const commands = require('./functions/commands.cjs');
|
|
@@ -14,6 +15,7 @@ const core = require('@magicyan/core');
|
|
|
14
15
|
|
|
15
16
|
|
|
16
17
|
|
|
18
|
+
exports.chars = chars.chars;
|
|
17
19
|
exports.CustomItents = client.CustomItents;
|
|
18
20
|
exports.CustomPartials = client.CustomPartials;
|
|
19
21
|
exports.findChannel = channels.findChannel;
|
|
@@ -22,6 +24,7 @@ exports.createComponentsManager = components.createComponentsManager;
|
|
|
22
24
|
exports.createLinkButton = components.createLinkButton;
|
|
23
25
|
exports.createModalInput = components.createModalInput;
|
|
24
26
|
exports.createRow = components.createRow;
|
|
27
|
+
exports.EmbedBuilderPlus = embeds.EmbedBuilderPlus;
|
|
25
28
|
exports.createEmbed = embeds.createEmbed;
|
|
26
29
|
exports.createEmbedAsset = embeds.createEmbedAsset;
|
|
27
30
|
exports.createEmbedAuthor = embeds.createEmbedAuthor;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import * as discord_js from 'discord.js';
|
|
2
|
-
import { GatewayIntentBits, Partials, ChannelType, Guild, CommandInteractionOption, Client, ApplicationCommand, AnyComponentBuilder, ActionRowBuilder, TextInputBuilder, ButtonBuilder, ActionRow, MessageActionRowComponent, TextInputComponentData, LinkButtonComponentData, ButtonComponent, StringSelectMenuComponent, UserSelectMenuComponent, ChannelSelectMenuComponent, RoleSelectMenuComponent, MentionableSelectMenuComponent, EmbedAuthorData, EmbedFooterData, EmbedAssetData, EmbedBuilder, User, ImageURLOptions, Attachment, AttachmentBuilder, ColorResolvable, GuildEmoji, GuildBasedChannel, Role, GuildMember, GuildTextBasedChannel, Message } from 'discord.js';
|
|
2
|
+
import { GatewayIntentBits, Partials, ChannelType, Guild, CommandInteractionOption, Client, ApplicationCommand, AnyComponentBuilder, ActionRowBuilder, TextInputBuilder, ButtonBuilder, ActionRow, MessageActionRowComponent, TextInputComponentData, LinkButtonComponentData, ButtonComponent, StringSelectMenuComponent, UserSelectMenuComponent, ChannelSelectMenuComponent, RoleSelectMenuComponent, MentionableSelectMenuComponent, EmbedAuthorData, EmbedFooterData, EmbedAssetData, EmbedBuilder, User, ImageURLOptions, Attachment, AttachmentBuilder, EmbedData, APIEmbed, Embed, ColorResolvable, GuildEmoji, GuildBasedChannel, Role, GuildMember, GuildTextBasedChannel, Message } from 'discord.js';
|
|
3
3
|
export * from '@magicyan/core';
|
|
4
4
|
|
|
5
|
+
declare const chars: {
|
|
6
|
+
invisible: string;
|
|
7
|
+
};
|
|
8
|
+
|
|
5
9
|
declare const CustomItents: {
|
|
6
10
|
Messages: GatewayIntentBits[];
|
|
7
11
|
Guild: GatewayIntentBits[];
|
|
@@ -12,19 +16,23 @@ declare const CustomPartials: {
|
|
|
12
16
|
All: Partials[];
|
|
13
17
|
};
|
|
14
18
|
|
|
19
|
+
type FindChannelFilter<T extends ChannelType> = (channel: GetChannelType<T>) => boolean;
|
|
15
20
|
type GetChannelType<Type extends ChannelType> = Extract<NonNullable<CommandInteractionOption<"cached">["channel"]>, {
|
|
16
21
|
type: Type extends ChannelType.PublicThread | ChannelType.AnnouncementThread ? ChannelType.PublicThread | ChannelType.AnnouncementThread : Type;
|
|
17
22
|
}>;
|
|
18
23
|
declare function findChannel<Type extends Exclude<ChannelType, ChannelType.DM> = ChannelType.GuildText>(guild: Guild, type?: Type): {
|
|
19
|
-
byName(name: string): GetChannelType<Type> | undefined;
|
|
24
|
+
byName(name: string, filter?: FindChannelFilter<Type>): GetChannelType<Type> | undefined;
|
|
20
25
|
byId(id: string): GetChannelType<Type> | undefined;
|
|
26
|
+
byFilter(filter: FindChannelFilter<Type>): discord_js.GuildBasedChannel | undefined;
|
|
21
27
|
inCategoryId(id: string): {
|
|
22
|
-
byName(name: string): GetChannelType<Type> | undefined;
|
|
23
|
-
byId(id: string): GetChannelType<Type> | undefined;
|
|
28
|
+
byName(name: string, filter?: FindChannelFilter<Type>): GetChannelType<Type> | undefined;
|
|
29
|
+
byId(id: string, filter?: FindChannelFilter<Type>): GetChannelType<Type> | undefined;
|
|
30
|
+
byFilter(filter: FindChannelFilter<Type>): discord_js.GuildBasedChannel | undefined;
|
|
24
31
|
};
|
|
25
32
|
inCategoryName(name: string): {
|
|
26
|
-
byName(name: string): GetChannelType<Type> | undefined;
|
|
27
|
-
byId(id: string): GetChannelType<Type> | undefined;
|
|
33
|
+
byName(name: string, filter?: FindChannelFilter<Type>): GetChannelType<Type> | undefined;
|
|
34
|
+
byId(id: string, filter?: FindChannelFilter<Type>): GetChannelType<Type> | undefined;
|
|
35
|
+
byFilter(filter: FindChannelFilter<Type>): discord_js.GuildBasedChannel | undefined;
|
|
28
36
|
};
|
|
29
37
|
};
|
|
30
38
|
|
|
@@ -88,33 +96,55 @@ interface CreateEmbedFooterOptions {
|
|
|
88
96
|
}
|
|
89
97
|
declare function createEmbedFooter(options: CreateEmbedFooterOptions): EmbedFooterData | undefined;
|
|
90
98
|
type EmbedAssetOptions = Omit<EmbedAssetData, "url">;
|
|
91
|
-
type AssetSource = string |
|
|
92
|
-
declare function createEmbedAsset(source
|
|
93
|
-
type
|
|
94
|
-
|
|
99
|
+
type AssetSource = string | Attachment | AttachmentBuilder | EmbedAssetData | undefined | null;
|
|
100
|
+
declare function createEmbedAsset(source: AssetSource, options?: EmbedAssetOptions): EmbedAssetData | undefined;
|
|
101
|
+
type EmbedBuilderPlusAssetData = AssetSource;
|
|
102
|
+
type EmbedBuilderPlusColorData = string & {} | ColorResolvable | null;
|
|
103
|
+
type EmbedBuilderPlusFieldData = {
|
|
95
104
|
name: string;
|
|
96
105
|
value: string;
|
|
97
106
|
inline?: boolean;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
107
|
+
};
|
|
108
|
+
type EmbedBuilderPlusFooterData = {
|
|
109
|
+
text?: string | null;
|
|
110
|
+
iconURL?: string | null;
|
|
111
|
+
};
|
|
112
|
+
type EmbedBuilderPlusAuthorData = {
|
|
113
|
+
name: string;
|
|
103
114
|
url?: string;
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
fields?: BaseEmbedField[];
|
|
115
|
+
iconURL?: string;
|
|
116
|
+
};
|
|
117
|
+
interface EmbedBuilderPlusOptions {
|
|
118
|
+
extend?: Omit<EmbedBuilderPlusData, keyof EmbedBuilderPlusOptions> | EmbedData | APIEmbed | Embed;
|
|
119
|
+
mergeFields?: boolean;
|
|
110
120
|
}
|
|
111
|
-
interface
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
121
|
+
interface EmbedBuilderPlusData extends EmbedBuilderPlusOptions {
|
|
122
|
+
title?: string | null;
|
|
123
|
+
color?: EmbedBuilderPlusColorData | null;
|
|
124
|
+
description?: string | null;
|
|
125
|
+
url?: string | null;
|
|
126
|
+
thumbnail?: EmbedBuilderPlusAssetData | null;
|
|
127
|
+
image?: EmbedBuilderPlusAssetData | null;
|
|
128
|
+
fields?: Partial<EmbedBuilderPlusFieldData>[] | null;
|
|
129
|
+
timestamp?: string | number | Date | null;
|
|
130
|
+
footer?: EmbedBuilderPlusFooterData;
|
|
131
|
+
author?: EmbedBuilderPlusAuthorData;
|
|
132
|
+
}
|
|
133
|
+
declare class EmbedBuilderPlus extends EmbedBuilder {
|
|
134
|
+
constructor(data: EmbedBuilderPlusData);
|
|
135
|
+
has(property: keyof Omit<EmbedBuilderPlusData, keyof EmbedBuilderPlusOptions>): boolean;
|
|
136
|
+
toArray(): this[];
|
|
137
|
+
toString(space?: number): string;
|
|
138
|
+
updateField(index: number, field: Partial<EmbedBuilderPlusFieldData>): this;
|
|
139
|
+
deleteField(index: number): this;
|
|
140
|
+
popField(): discord_js.APIEmbedField | undefined;
|
|
141
|
+
setAsset(asset: "thumbnail" | "image", source: EmbedBuilderPlusAssetData): this;
|
|
142
|
+
get fieldsLength(): number;
|
|
143
|
+
get fields(): discord_js.APIEmbedField[];
|
|
144
|
+
createFromThis(data?: EmbedBuilderPlusData): EmbedBuilderPlus;
|
|
116
145
|
}
|
|
117
|
-
|
|
146
|
+
type EmbedPropery<T extends keyof EmbedBuilderPlusData> = EmbedBuilderPlusData[T];
|
|
147
|
+
declare function createEmbed(data: EmbedBuilderPlusData): EmbedBuilderPlus;
|
|
118
148
|
|
|
119
149
|
type FindEmojiFilter = (emoji: GuildEmoji) => boolean;
|
|
120
150
|
declare function findEmoji(guildOrClient: Guild | Client): {
|
|
@@ -154,4 +184,4 @@ declare function findRole(guild: Guild): {
|
|
|
154
184
|
byFilter(filter: FindRoleFilter): Role | undefined;
|
|
155
185
|
};
|
|
156
186
|
|
|
157
|
-
export {
|
|
187
|
+
export { CustomItents, CustomPartials, EmbedBuilderPlus, type EmbedPropery, chars, createComponentsManager, createEmbed, createEmbedAsset, createEmbedAuthor, createEmbedFooter, createLinkButton, createModalInput, createRow, findChannel, findCommand, findEmoji, findMember, findMessage, findRole, formatedMention };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import * as discord_js from 'discord.js';
|
|
2
|
-
import { GatewayIntentBits, Partials, ChannelType, Guild, CommandInteractionOption, Client, ApplicationCommand, AnyComponentBuilder, ActionRowBuilder, TextInputBuilder, ButtonBuilder, ActionRow, MessageActionRowComponent, TextInputComponentData, LinkButtonComponentData, ButtonComponent, StringSelectMenuComponent, UserSelectMenuComponent, ChannelSelectMenuComponent, RoleSelectMenuComponent, MentionableSelectMenuComponent, EmbedAuthorData, EmbedFooterData, EmbedAssetData, EmbedBuilder, User, ImageURLOptions, Attachment, AttachmentBuilder, ColorResolvable, GuildEmoji, GuildBasedChannel, Role, GuildMember, GuildTextBasedChannel, Message } from 'discord.js';
|
|
2
|
+
import { GatewayIntentBits, Partials, ChannelType, Guild, CommandInteractionOption, Client, ApplicationCommand, AnyComponentBuilder, ActionRowBuilder, TextInputBuilder, ButtonBuilder, ActionRow, MessageActionRowComponent, TextInputComponentData, LinkButtonComponentData, ButtonComponent, StringSelectMenuComponent, UserSelectMenuComponent, ChannelSelectMenuComponent, RoleSelectMenuComponent, MentionableSelectMenuComponent, EmbedAuthorData, EmbedFooterData, EmbedAssetData, EmbedBuilder, User, ImageURLOptions, Attachment, AttachmentBuilder, EmbedData, APIEmbed, Embed, ColorResolvable, GuildEmoji, GuildBasedChannel, Role, GuildMember, GuildTextBasedChannel, Message } from 'discord.js';
|
|
3
3
|
export * from '@magicyan/core';
|
|
4
4
|
|
|
5
|
+
declare const chars: {
|
|
6
|
+
invisible: string;
|
|
7
|
+
};
|
|
8
|
+
|
|
5
9
|
declare const CustomItents: {
|
|
6
10
|
Messages: GatewayIntentBits[];
|
|
7
11
|
Guild: GatewayIntentBits[];
|
|
@@ -12,19 +16,23 @@ declare const CustomPartials: {
|
|
|
12
16
|
All: Partials[];
|
|
13
17
|
};
|
|
14
18
|
|
|
19
|
+
type FindChannelFilter<T extends ChannelType> = (channel: GetChannelType<T>) => boolean;
|
|
15
20
|
type GetChannelType<Type extends ChannelType> = Extract<NonNullable<CommandInteractionOption<"cached">["channel"]>, {
|
|
16
21
|
type: Type extends ChannelType.PublicThread | ChannelType.AnnouncementThread ? ChannelType.PublicThread | ChannelType.AnnouncementThread : Type;
|
|
17
22
|
}>;
|
|
18
23
|
declare function findChannel<Type extends Exclude<ChannelType, ChannelType.DM> = ChannelType.GuildText>(guild: Guild, type?: Type): {
|
|
19
|
-
byName(name: string): GetChannelType<Type> | undefined;
|
|
24
|
+
byName(name: string, filter?: FindChannelFilter<Type>): GetChannelType<Type> | undefined;
|
|
20
25
|
byId(id: string): GetChannelType<Type> | undefined;
|
|
26
|
+
byFilter(filter: FindChannelFilter<Type>): discord_js.GuildBasedChannel | undefined;
|
|
21
27
|
inCategoryId(id: string): {
|
|
22
|
-
byName(name: string): GetChannelType<Type> | undefined;
|
|
23
|
-
byId(id: string): GetChannelType<Type> | undefined;
|
|
28
|
+
byName(name: string, filter?: FindChannelFilter<Type>): GetChannelType<Type> | undefined;
|
|
29
|
+
byId(id: string, filter?: FindChannelFilter<Type>): GetChannelType<Type> | undefined;
|
|
30
|
+
byFilter(filter: FindChannelFilter<Type>): discord_js.GuildBasedChannel | undefined;
|
|
24
31
|
};
|
|
25
32
|
inCategoryName(name: string): {
|
|
26
|
-
byName(name: string): GetChannelType<Type> | undefined;
|
|
27
|
-
byId(id: string): GetChannelType<Type> | undefined;
|
|
33
|
+
byName(name: string, filter?: FindChannelFilter<Type>): GetChannelType<Type> | undefined;
|
|
34
|
+
byId(id: string, filter?: FindChannelFilter<Type>): GetChannelType<Type> | undefined;
|
|
35
|
+
byFilter(filter: FindChannelFilter<Type>): discord_js.GuildBasedChannel | undefined;
|
|
28
36
|
};
|
|
29
37
|
};
|
|
30
38
|
|
|
@@ -88,33 +96,55 @@ interface CreateEmbedFooterOptions {
|
|
|
88
96
|
}
|
|
89
97
|
declare function createEmbedFooter(options: CreateEmbedFooterOptions): EmbedFooterData | undefined;
|
|
90
98
|
type EmbedAssetOptions = Omit<EmbedAssetData, "url">;
|
|
91
|
-
type AssetSource = string |
|
|
92
|
-
declare function createEmbedAsset(source
|
|
93
|
-
type
|
|
94
|
-
|
|
99
|
+
type AssetSource = string | Attachment | AttachmentBuilder | EmbedAssetData | undefined | null;
|
|
100
|
+
declare function createEmbedAsset(source: AssetSource, options?: EmbedAssetOptions): EmbedAssetData | undefined;
|
|
101
|
+
type EmbedBuilderPlusAssetData = AssetSource;
|
|
102
|
+
type EmbedBuilderPlusColorData = string & {} | ColorResolvable | null;
|
|
103
|
+
type EmbedBuilderPlusFieldData = {
|
|
95
104
|
name: string;
|
|
96
105
|
value: string;
|
|
97
106
|
inline?: boolean;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
107
|
+
};
|
|
108
|
+
type EmbedBuilderPlusFooterData = {
|
|
109
|
+
text?: string | null;
|
|
110
|
+
iconURL?: string | null;
|
|
111
|
+
};
|
|
112
|
+
type EmbedBuilderPlusAuthorData = {
|
|
113
|
+
name: string;
|
|
103
114
|
url?: string;
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
fields?: BaseEmbedField[];
|
|
115
|
+
iconURL?: string;
|
|
116
|
+
};
|
|
117
|
+
interface EmbedBuilderPlusOptions {
|
|
118
|
+
extend?: Omit<EmbedBuilderPlusData, keyof EmbedBuilderPlusOptions> | EmbedData | APIEmbed | Embed;
|
|
119
|
+
mergeFields?: boolean;
|
|
110
120
|
}
|
|
111
|
-
interface
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
121
|
+
interface EmbedBuilderPlusData extends EmbedBuilderPlusOptions {
|
|
122
|
+
title?: string | null;
|
|
123
|
+
color?: EmbedBuilderPlusColorData | null;
|
|
124
|
+
description?: string | null;
|
|
125
|
+
url?: string | null;
|
|
126
|
+
thumbnail?: EmbedBuilderPlusAssetData | null;
|
|
127
|
+
image?: EmbedBuilderPlusAssetData | null;
|
|
128
|
+
fields?: Partial<EmbedBuilderPlusFieldData>[] | null;
|
|
129
|
+
timestamp?: string | number | Date | null;
|
|
130
|
+
footer?: EmbedBuilderPlusFooterData;
|
|
131
|
+
author?: EmbedBuilderPlusAuthorData;
|
|
132
|
+
}
|
|
133
|
+
declare class EmbedBuilderPlus extends EmbedBuilder {
|
|
134
|
+
constructor(data: EmbedBuilderPlusData);
|
|
135
|
+
has(property: keyof Omit<EmbedBuilderPlusData, keyof EmbedBuilderPlusOptions>): boolean;
|
|
136
|
+
toArray(): this[];
|
|
137
|
+
toString(space?: number): string;
|
|
138
|
+
updateField(index: number, field: Partial<EmbedBuilderPlusFieldData>): this;
|
|
139
|
+
deleteField(index: number): this;
|
|
140
|
+
popField(): discord_js.APIEmbedField | undefined;
|
|
141
|
+
setAsset(asset: "thumbnail" | "image", source: EmbedBuilderPlusAssetData): this;
|
|
142
|
+
get fieldsLength(): number;
|
|
143
|
+
get fields(): discord_js.APIEmbedField[];
|
|
144
|
+
createFromThis(data?: EmbedBuilderPlusData): EmbedBuilderPlus;
|
|
116
145
|
}
|
|
117
|
-
|
|
146
|
+
type EmbedPropery<T extends keyof EmbedBuilderPlusData> = EmbedBuilderPlusData[T];
|
|
147
|
+
declare function createEmbed(data: EmbedBuilderPlusData): EmbedBuilderPlus;
|
|
118
148
|
|
|
119
149
|
type FindEmojiFilter = (emoji: GuildEmoji) => boolean;
|
|
120
150
|
declare function findEmoji(guildOrClient: Guild | Client): {
|
|
@@ -154,4 +184,4 @@ declare function findRole(guild: Guild): {
|
|
|
154
184
|
byFilter(filter: FindRoleFilter): Role | undefined;
|
|
155
185
|
};
|
|
156
186
|
|
|
157
|
-
export {
|
|
187
|
+
export { CustomItents, CustomPartials, EmbedBuilderPlus, type EmbedPropery, chars, createComponentsManager, createEmbed, createEmbedAsset, createEmbedAuthor, createEmbedFooter, createLinkButton, createModalInput, createRow, findChannel, findCommand, findEmoji, findMember, findMessage, findRole, formatedMention };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import * as discord_js from 'discord.js';
|
|
2
|
-
import { GatewayIntentBits, Partials, ChannelType, Guild, CommandInteractionOption, Client, ApplicationCommand, AnyComponentBuilder, ActionRowBuilder, TextInputBuilder, ButtonBuilder, ActionRow, MessageActionRowComponent, TextInputComponentData, LinkButtonComponentData, ButtonComponent, StringSelectMenuComponent, UserSelectMenuComponent, ChannelSelectMenuComponent, RoleSelectMenuComponent, MentionableSelectMenuComponent, EmbedAuthorData, EmbedFooterData, EmbedAssetData, EmbedBuilder, User, ImageURLOptions, Attachment, AttachmentBuilder, ColorResolvable, GuildEmoji, GuildBasedChannel, Role, GuildMember, GuildTextBasedChannel, Message } from 'discord.js';
|
|
2
|
+
import { GatewayIntentBits, Partials, ChannelType, Guild, CommandInteractionOption, Client, ApplicationCommand, AnyComponentBuilder, ActionRowBuilder, TextInputBuilder, ButtonBuilder, ActionRow, MessageActionRowComponent, TextInputComponentData, LinkButtonComponentData, ButtonComponent, StringSelectMenuComponent, UserSelectMenuComponent, ChannelSelectMenuComponent, RoleSelectMenuComponent, MentionableSelectMenuComponent, EmbedAuthorData, EmbedFooterData, EmbedAssetData, EmbedBuilder, User, ImageURLOptions, Attachment, AttachmentBuilder, EmbedData, APIEmbed, Embed, ColorResolvable, GuildEmoji, GuildBasedChannel, Role, GuildMember, GuildTextBasedChannel, Message } from 'discord.js';
|
|
3
3
|
export * from '@magicyan/core';
|
|
4
4
|
|
|
5
|
+
declare const chars: {
|
|
6
|
+
invisible: string;
|
|
7
|
+
};
|
|
8
|
+
|
|
5
9
|
declare const CustomItents: {
|
|
6
10
|
Messages: GatewayIntentBits[];
|
|
7
11
|
Guild: GatewayIntentBits[];
|
|
@@ -12,19 +16,23 @@ declare const CustomPartials: {
|
|
|
12
16
|
All: Partials[];
|
|
13
17
|
};
|
|
14
18
|
|
|
19
|
+
type FindChannelFilter<T extends ChannelType> = (channel: GetChannelType<T>) => boolean;
|
|
15
20
|
type GetChannelType<Type extends ChannelType> = Extract<NonNullable<CommandInteractionOption<"cached">["channel"]>, {
|
|
16
21
|
type: Type extends ChannelType.PublicThread | ChannelType.AnnouncementThread ? ChannelType.PublicThread | ChannelType.AnnouncementThread : Type;
|
|
17
22
|
}>;
|
|
18
23
|
declare function findChannel<Type extends Exclude<ChannelType, ChannelType.DM> = ChannelType.GuildText>(guild: Guild, type?: Type): {
|
|
19
|
-
byName(name: string): GetChannelType<Type> | undefined;
|
|
24
|
+
byName(name: string, filter?: FindChannelFilter<Type>): GetChannelType<Type> | undefined;
|
|
20
25
|
byId(id: string): GetChannelType<Type> | undefined;
|
|
26
|
+
byFilter(filter: FindChannelFilter<Type>): discord_js.GuildBasedChannel | undefined;
|
|
21
27
|
inCategoryId(id: string): {
|
|
22
|
-
byName(name: string): GetChannelType<Type> | undefined;
|
|
23
|
-
byId(id: string): GetChannelType<Type> | undefined;
|
|
28
|
+
byName(name: string, filter?: FindChannelFilter<Type>): GetChannelType<Type> | undefined;
|
|
29
|
+
byId(id: string, filter?: FindChannelFilter<Type>): GetChannelType<Type> | undefined;
|
|
30
|
+
byFilter(filter: FindChannelFilter<Type>): discord_js.GuildBasedChannel | undefined;
|
|
24
31
|
};
|
|
25
32
|
inCategoryName(name: string): {
|
|
26
|
-
byName(name: string): GetChannelType<Type> | undefined;
|
|
27
|
-
byId(id: string): GetChannelType<Type> | undefined;
|
|
33
|
+
byName(name: string, filter?: FindChannelFilter<Type>): GetChannelType<Type> | undefined;
|
|
34
|
+
byId(id: string, filter?: FindChannelFilter<Type>): GetChannelType<Type> | undefined;
|
|
35
|
+
byFilter(filter: FindChannelFilter<Type>): discord_js.GuildBasedChannel | undefined;
|
|
28
36
|
};
|
|
29
37
|
};
|
|
30
38
|
|
|
@@ -88,33 +96,55 @@ interface CreateEmbedFooterOptions {
|
|
|
88
96
|
}
|
|
89
97
|
declare function createEmbedFooter(options: CreateEmbedFooterOptions): EmbedFooterData | undefined;
|
|
90
98
|
type EmbedAssetOptions = Omit<EmbedAssetData, "url">;
|
|
91
|
-
type AssetSource = string |
|
|
92
|
-
declare function createEmbedAsset(source
|
|
93
|
-
type
|
|
94
|
-
|
|
99
|
+
type AssetSource = string | Attachment | AttachmentBuilder | EmbedAssetData | undefined | null;
|
|
100
|
+
declare function createEmbedAsset(source: AssetSource, options?: EmbedAssetOptions): EmbedAssetData | undefined;
|
|
101
|
+
type EmbedBuilderPlusAssetData = AssetSource;
|
|
102
|
+
type EmbedBuilderPlusColorData = string & {} | ColorResolvable | null;
|
|
103
|
+
type EmbedBuilderPlusFieldData = {
|
|
95
104
|
name: string;
|
|
96
105
|
value: string;
|
|
97
106
|
inline?: boolean;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
107
|
+
};
|
|
108
|
+
type EmbedBuilderPlusFooterData = {
|
|
109
|
+
text?: string | null;
|
|
110
|
+
iconURL?: string | null;
|
|
111
|
+
};
|
|
112
|
+
type EmbedBuilderPlusAuthorData = {
|
|
113
|
+
name: string;
|
|
103
114
|
url?: string;
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
fields?: BaseEmbedField[];
|
|
115
|
+
iconURL?: string;
|
|
116
|
+
};
|
|
117
|
+
interface EmbedBuilderPlusOptions {
|
|
118
|
+
extend?: Omit<EmbedBuilderPlusData, keyof EmbedBuilderPlusOptions> | EmbedData | APIEmbed | Embed;
|
|
119
|
+
mergeFields?: boolean;
|
|
110
120
|
}
|
|
111
|
-
interface
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
121
|
+
interface EmbedBuilderPlusData extends EmbedBuilderPlusOptions {
|
|
122
|
+
title?: string | null;
|
|
123
|
+
color?: EmbedBuilderPlusColorData | null;
|
|
124
|
+
description?: string | null;
|
|
125
|
+
url?: string | null;
|
|
126
|
+
thumbnail?: EmbedBuilderPlusAssetData | null;
|
|
127
|
+
image?: EmbedBuilderPlusAssetData | null;
|
|
128
|
+
fields?: Partial<EmbedBuilderPlusFieldData>[] | null;
|
|
129
|
+
timestamp?: string | number | Date | null;
|
|
130
|
+
footer?: EmbedBuilderPlusFooterData;
|
|
131
|
+
author?: EmbedBuilderPlusAuthorData;
|
|
132
|
+
}
|
|
133
|
+
declare class EmbedBuilderPlus extends EmbedBuilder {
|
|
134
|
+
constructor(data: EmbedBuilderPlusData);
|
|
135
|
+
has(property: keyof Omit<EmbedBuilderPlusData, keyof EmbedBuilderPlusOptions>): boolean;
|
|
136
|
+
toArray(): this[];
|
|
137
|
+
toString(space?: number): string;
|
|
138
|
+
updateField(index: number, field: Partial<EmbedBuilderPlusFieldData>): this;
|
|
139
|
+
deleteField(index: number): this;
|
|
140
|
+
popField(): discord_js.APIEmbedField | undefined;
|
|
141
|
+
setAsset(asset: "thumbnail" | "image", source: EmbedBuilderPlusAssetData): this;
|
|
142
|
+
get fieldsLength(): number;
|
|
143
|
+
get fields(): discord_js.APIEmbedField[];
|
|
144
|
+
createFromThis(data?: EmbedBuilderPlusData): EmbedBuilderPlus;
|
|
116
145
|
}
|
|
117
|
-
|
|
146
|
+
type EmbedPropery<T extends keyof EmbedBuilderPlusData> = EmbedBuilderPlusData[T];
|
|
147
|
+
declare function createEmbed(data: EmbedBuilderPlusData): EmbedBuilderPlus;
|
|
118
148
|
|
|
119
149
|
type FindEmojiFilter = (emoji: GuildEmoji) => boolean;
|
|
120
150
|
declare function findEmoji(guildOrClient: Guild | Client): {
|
|
@@ -154,4 +184,4 @@ declare function findRole(guild: Guild): {
|
|
|
154
184
|
byFilter(filter: FindRoleFilter): Role | undefined;
|
|
155
185
|
};
|
|
156
186
|
|
|
157
|
-
export {
|
|
187
|
+
export { CustomItents, CustomPartials, EmbedBuilderPlus, type EmbedPropery, chars, createComponentsManager, createEmbed, createEmbedAsset, createEmbedAuthor, createEmbedFooter, createLinkButton, createModalInput, createRow, findChannel, findCommand, findEmoji, findMember, findMessage, findRole, formatedMention };
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
export { chars } from './constants/chars.mjs';
|
|
1
2
|
export { CustomItents, CustomPartials } from './constants/client.mjs';
|
|
2
3
|
export { findChannel } from './functions/channels.mjs';
|
|
3
4
|
export { findCommand } from './functions/commands.mjs';
|
|
4
5
|
export { createComponentsManager, createLinkButton, createModalInput, createRow } from './functions/components.mjs';
|
|
5
|
-
export { createEmbed, createEmbedAsset, createEmbedAuthor, createEmbedFooter } from './functions/embeds.mjs';
|
|
6
|
+
export { EmbedBuilderPlus, createEmbed, createEmbedAsset, createEmbedAuthor, createEmbedFooter } from './functions/embeds.mjs';
|
|
6
7
|
export { findEmoji } from './functions/emojis.mjs';
|
|
7
8
|
export { formatedMention } from './functions/format.mjs';
|
|
8
9
|
export { findMember } from './functions/members.mjs';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@magicyan/discord",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.20",
|
|
4
4
|
"description": "Simple functions to facilitate discord bot development",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"unbuild": "^2.0.0"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@magicyan/core": "^1.0.
|
|
42
|
+
"@magicyan/core": "^1.0.17"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"discord.js": "^14.14.1"
|