@magicyan/discord 1.0.16 → 1.0.18
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.cjs +68 -0
- package/dist/functions/components.mjs +63 -0
- package/dist/functions/embeds.cjs +2 -2
- package/dist/functions/embeds.mjs +2 -2
- package/dist/functions/format.cjs +4 -11
- package/dist/functions/format.mjs +5 -12
- package/dist/functions/message.cjs +27 -0
- package/dist/functions/message.mjs +25 -0
- package/dist/index.cjs +8 -5
- package/dist/index.d.cts +52 -25
- package/dist/index.d.mts +52 -25
- package/dist/index.d.ts +52 -25
- package/dist/index.mjs +3 -2
- package/package.json +3 -3
- package/dist/functions/utils.cjs +0 -19
- package/dist/functions/utils.mjs +0 -15
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const discord_js = require('discord.js');
|
|
4
|
+
|
|
5
|
+
function createRow(...components) {
|
|
6
|
+
return new discord_js.ActionRowBuilder({ components });
|
|
7
|
+
}
|
|
8
|
+
function createModalInput(data) {
|
|
9
|
+
return createRow(new discord_js.TextInputBuilder(data));
|
|
10
|
+
}
|
|
11
|
+
function createLinkButton(data) {
|
|
12
|
+
if (!data.label)
|
|
13
|
+
data.label = data.url;
|
|
14
|
+
return new discord_js.ButtonBuilder({ style: discord_js.ButtonStyle.Link, ...data });
|
|
15
|
+
}
|
|
16
|
+
function createComponentsManager(components) {
|
|
17
|
+
const buttons = components.flatMap(
|
|
18
|
+
(row) => row.components.filter((c) => c.type === discord_js.ComponentType.Button)
|
|
19
|
+
);
|
|
20
|
+
const stringSelects = components.flatMap(
|
|
21
|
+
(row) => row.components.filter((c) => c.type === discord_js.ComponentType.StringSelect)
|
|
22
|
+
);
|
|
23
|
+
const userSelects = components.flatMap(
|
|
24
|
+
(row) => row.components.filter((c) => c.type === discord_js.ComponentType.UserSelect)
|
|
25
|
+
);
|
|
26
|
+
const channelSelects = components.flatMap(
|
|
27
|
+
(row) => row.components.filter((c) => c.type === discord_js.ComponentType.ChannelSelect)
|
|
28
|
+
);
|
|
29
|
+
const roleSelects = components.flatMap(
|
|
30
|
+
(row) => row.components.filter((c) => c.type === discord_js.ComponentType.RoleSelect)
|
|
31
|
+
);
|
|
32
|
+
const mentionableSelects = components.flatMap(
|
|
33
|
+
(row) => row.components.filter((c) => c.type === discord_js.ComponentType.Button)
|
|
34
|
+
);
|
|
35
|
+
return {
|
|
36
|
+
getButton(customId) {
|
|
37
|
+
return buttons.find((b) => b.customId === customId);
|
|
38
|
+
},
|
|
39
|
+
getStringSelect(customId) {
|
|
40
|
+
return stringSelects.find((b) => b.customId === customId);
|
|
41
|
+
},
|
|
42
|
+
getUserSelect(customId) {
|
|
43
|
+
return userSelects.find((b) => b.customId === customId);
|
|
44
|
+
},
|
|
45
|
+
getChannelSelect(customId) {
|
|
46
|
+
return channelSelects.find((b) => b.customId === customId);
|
|
47
|
+
},
|
|
48
|
+
getRoleSelect(customId) {
|
|
49
|
+
return roleSelects.find((b) => b.customId === customId);
|
|
50
|
+
},
|
|
51
|
+
getMentionableSelect(customId) {
|
|
52
|
+
return mentionableSelects.find((b) => b.customId === customId);
|
|
53
|
+
},
|
|
54
|
+
resolved: {
|
|
55
|
+
buttons,
|
|
56
|
+
stringSelects,
|
|
57
|
+
userSelects,
|
|
58
|
+
channelSelects,
|
|
59
|
+
roleSelects,
|
|
60
|
+
mentionableSelects
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
exports.createComponentsManager = createComponentsManager;
|
|
66
|
+
exports.createLinkButton = createLinkButton;
|
|
67
|
+
exports.createModalInput = createModalInput;
|
|
68
|
+
exports.createRow = createRow;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { ActionRowBuilder, TextInputBuilder, ButtonBuilder, ButtonStyle, ComponentType } from 'discord.js';
|
|
2
|
+
|
|
3
|
+
function createRow(...components) {
|
|
4
|
+
return new ActionRowBuilder({ components });
|
|
5
|
+
}
|
|
6
|
+
function createModalInput(data) {
|
|
7
|
+
return createRow(new TextInputBuilder(data));
|
|
8
|
+
}
|
|
9
|
+
function createLinkButton(data) {
|
|
10
|
+
if (!data.label)
|
|
11
|
+
data.label = data.url;
|
|
12
|
+
return new ButtonBuilder({ style: ButtonStyle.Link, ...data });
|
|
13
|
+
}
|
|
14
|
+
function createComponentsManager(components) {
|
|
15
|
+
const buttons = components.flatMap(
|
|
16
|
+
(row) => row.components.filter((c) => c.type === ComponentType.Button)
|
|
17
|
+
);
|
|
18
|
+
const stringSelects = components.flatMap(
|
|
19
|
+
(row) => row.components.filter((c) => c.type === ComponentType.StringSelect)
|
|
20
|
+
);
|
|
21
|
+
const userSelects = components.flatMap(
|
|
22
|
+
(row) => row.components.filter((c) => c.type === ComponentType.UserSelect)
|
|
23
|
+
);
|
|
24
|
+
const channelSelects = components.flatMap(
|
|
25
|
+
(row) => row.components.filter((c) => c.type === ComponentType.ChannelSelect)
|
|
26
|
+
);
|
|
27
|
+
const roleSelects = components.flatMap(
|
|
28
|
+
(row) => row.components.filter((c) => c.type === ComponentType.RoleSelect)
|
|
29
|
+
);
|
|
30
|
+
const mentionableSelects = components.flatMap(
|
|
31
|
+
(row) => row.components.filter((c) => c.type === ComponentType.Button)
|
|
32
|
+
);
|
|
33
|
+
return {
|
|
34
|
+
getButton(customId) {
|
|
35
|
+
return buttons.find((b) => b.customId === customId);
|
|
36
|
+
},
|
|
37
|
+
getStringSelect(customId) {
|
|
38
|
+
return stringSelects.find((b) => b.customId === customId);
|
|
39
|
+
},
|
|
40
|
+
getUserSelect(customId) {
|
|
41
|
+
return userSelects.find((b) => b.customId === customId);
|
|
42
|
+
},
|
|
43
|
+
getChannelSelect(customId) {
|
|
44
|
+
return channelSelects.find((b) => b.customId === customId);
|
|
45
|
+
},
|
|
46
|
+
getRoleSelect(customId) {
|
|
47
|
+
return roleSelects.find((b) => b.customId === customId);
|
|
48
|
+
},
|
|
49
|
+
getMentionableSelect(customId) {
|
|
50
|
+
return mentionableSelects.find((b) => b.customId === customId);
|
|
51
|
+
},
|
|
52
|
+
resolved: {
|
|
53
|
+
buttons,
|
|
54
|
+
stringSelects,
|
|
55
|
+
userSelects,
|
|
56
|
+
channelSelects,
|
|
57
|
+
roleSelects,
|
|
58
|
+
mentionableSelects
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export { createComponentsManager, createLinkButton, createModalInput, createRow };
|
|
@@ -21,7 +21,7 @@ function createEmbedAuthor(options) {
|
|
|
21
21
|
}
|
|
22
22
|
function createEmbedFooter(options) {
|
|
23
23
|
const { text, iconURL } = options;
|
|
24
|
-
return { text: text ?? "\u200B", iconURL: core.notFound(iconURL) };
|
|
24
|
+
return !text && !iconURL ? void 0 : { text: text ?? "\u200B", iconURL: core.notFound(iconURL) };
|
|
25
25
|
}
|
|
26
26
|
function createEmbedAsset(source, options) {
|
|
27
27
|
if (source instanceof discord_js.Attachment || source instanceof discord_js.AttachmentBuilder) {
|
|
@@ -39,7 +39,7 @@ function createEmbed(options) {
|
|
|
39
39
|
builder.setColor(extendColor);
|
|
40
40
|
if (embedColor)
|
|
41
41
|
builder.setColor(embedColor);
|
|
42
|
-
if (modify?.fields && typeof modify.fields
|
|
42
|
+
if (modify?.fields && typeof modify.fields === "function") {
|
|
43
43
|
const fields = modify.fields(builder.data.fields || []);
|
|
44
44
|
builder.setFields(fields);
|
|
45
45
|
}
|
|
@@ -19,7 +19,7 @@ function createEmbedAuthor(options) {
|
|
|
19
19
|
}
|
|
20
20
|
function createEmbedFooter(options) {
|
|
21
21
|
const { text, iconURL } = options;
|
|
22
|
-
return { text: text ?? "\u200B", iconURL: notFound(iconURL) };
|
|
22
|
+
return !text && !iconURL ? void 0 : { text: text ?? "\u200B", iconURL: notFound(iconURL) };
|
|
23
23
|
}
|
|
24
24
|
function createEmbedAsset(source, options) {
|
|
25
25
|
if (source instanceof Attachment || source instanceof AttachmentBuilder) {
|
|
@@ -37,7 +37,7 @@ function createEmbed(options) {
|
|
|
37
37
|
builder.setColor(extendColor);
|
|
38
38
|
if (embedColor)
|
|
39
39
|
builder.setColor(embedColor);
|
|
40
|
-
if (modify?.fields && typeof modify.fields
|
|
40
|
+
if (modify?.fields && typeof modify.fields === "function") {
|
|
41
41
|
const fields = modify.fields(builder.data.fields || []);
|
|
42
42
|
builder.setFields(fields);
|
|
43
43
|
}
|
|
@@ -2,15 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
const discord_js = require('discord.js');
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
return {
|
|
9
|
-
channel: id ? discord_js.channelMention(id) : alt,
|
|
10
|
-
user: id ? discord_js.userMention(id) : alt,
|
|
11
|
-
role: id ? discord_js.roleMention(id) : alt
|
|
12
|
-
}[type];
|
|
13
|
-
}
|
|
14
|
-
};
|
|
5
|
+
function formatedMention(ref, alt = "") {
|
|
6
|
+
return ref instanceof discord_js.Role ? discord_js.roleMention(ref.id) : ref instanceof discord_js.User ? discord_js.userMention(ref.id) : ref ? discord_js.channelMention(ref.id) : alt;
|
|
7
|
+
}
|
|
15
8
|
|
|
16
|
-
exports.
|
|
9
|
+
exports.formatedMention = formatedMention;
|
|
@@ -1,14 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Role, roleMention, User, userMention, channelMention } from 'discord.js';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
return {
|
|
7
|
-
channel: id ? channelMention(id) : alt,
|
|
8
|
-
user: id ? userMention(id) : alt,
|
|
9
|
-
role: id ? roleMention(id) : alt
|
|
10
|
-
}[type];
|
|
11
|
-
}
|
|
12
|
-
};
|
|
3
|
+
function formatedMention(ref, alt = "") {
|
|
4
|
+
return ref instanceof Role ? roleMention(ref.id) : ref instanceof User ? userMention(ref.id) : ref ? channelMention(ref.id) : alt;
|
|
5
|
+
}
|
|
13
6
|
|
|
14
|
-
export {
|
|
7
|
+
export { formatedMention };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const core = require('@magicyan/core');
|
|
4
|
+
|
|
5
|
+
function findMessage(channel) {
|
|
6
|
+
const messages = channel.messages.cache;
|
|
7
|
+
return {
|
|
8
|
+
byId(id) {
|
|
9
|
+
return messages.get(id);
|
|
10
|
+
},
|
|
11
|
+
byContent() {
|
|
12
|
+
return {
|
|
13
|
+
equals(content, ignoreCase = false) {
|
|
14
|
+
return ignoreCase ? messages.find((m) => m.content === content) : messages.find((m) => core.equalsIgnoreCase(m.content, content));
|
|
15
|
+
},
|
|
16
|
+
include(content, ignoreCase = false) {
|
|
17
|
+
return ignoreCase ? messages.find((m) => m.content.includes(content)) : messages.find((m) => core.includesIgnoreCase(m.content, content));
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
},
|
|
21
|
+
byFilter(filter) {
|
|
22
|
+
return messages.find(filter);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
exports.findMessage = findMessage;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { equalsIgnoreCase, includesIgnoreCase } from '@magicyan/core';
|
|
2
|
+
|
|
3
|
+
function findMessage(channel) {
|
|
4
|
+
const messages = channel.messages.cache;
|
|
5
|
+
return {
|
|
6
|
+
byId(id) {
|
|
7
|
+
return messages.get(id);
|
|
8
|
+
},
|
|
9
|
+
byContent() {
|
|
10
|
+
return {
|
|
11
|
+
equals(content, ignoreCase = false) {
|
|
12
|
+
return ignoreCase ? messages.find((m) => m.content === content) : messages.find((m) => equalsIgnoreCase(m.content, content));
|
|
13
|
+
},
|
|
14
|
+
include(content, ignoreCase = false) {
|
|
15
|
+
return ignoreCase ? messages.find((m) => m.content.includes(content)) : messages.find((m) => includesIgnoreCase(m.content, content));
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
},
|
|
19
|
+
byFilter(filter) {
|
|
20
|
+
return messages.find(filter);
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export { findMessage };
|
package/dist/index.cjs
CHANGED
|
@@ -3,12 +3,13 @@
|
|
|
3
3
|
const client = require('./constants/client.cjs');
|
|
4
4
|
const channels = require('./functions/channels.cjs');
|
|
5
5
|
const commands = require('./functions/commands.cjs');
|
|
6
|
+
const components = require('./functions/components.cjs');
|
|
6
7
|
const embeds = require('./functions/embeds.cjs');
|
|
7
8
|
const emojis = require('./functions/emojis.cjs');
|
|
8
9
|
const format = require('./functions/format.cjs');
|
|
9
10
|
const members = require('./functions/members.cjs');
|
|
11
|
+
const message = require('./functions/message.cjs');
|
|
10
12
|
const roles = require('./functions/roles.cjs');
|
|
11
|
-
const utils = require('./functions/utils.cjs');
|
|
12
13
|
const core = require('@magicyan/core');
|
|
13
14
|
|
|
14
15
|
|
|
@@ -17,17 +18,19 @@ exports.CustomItents = client.CustomItents;
|
|
|
17
18
|
exports.CustomPartials = client.CustomPartials;
|
|
18
19
|
exports.findChannel = channels.findChannel;
|
|
19
20
|
exports.findCommand = commands.findCommand;
|
|
21
|
+
exports.createComponentsManager = components.createComponentsManager;
|
|
22
|
+
exports.createLinkButton = components.createLinkButton;
|
|
23
|
+
exports.createModalInput = components.createModalInput;
|
|
24
|
+
exports.createRow = components.createRow;
|
|
20
25
|
exports.createEmbed = embeds.createEmbed;
|
|
21
26
|
exports.createEmbedAsset = embeds.createEmbedAsset;
|
|
22
27
|
exports.createEmbedAuthor = embeds.createEmbedAuthor;
|
|
23
28
|
exports.createEmbedFooter = embeds.createEmbedFooter;
|
|
24
29
|
exports.findEmoji = emojis.findEmoji;
|
|
25
|
-
exports.
|
|
30
|
+
exports.formatedMention = format.formatedMention;
|
|
26
31
|
exports.findMember = members.findMember;
|
|
32
|
+
exports.findMessage = message.findMessage;
|
|
27
33
|
exports.findRole = roles.findRole;
|
|
28
|
-
exports.createLinkButton = utils.createLinkButton;
|
|
29
|
-
exports.createModalInput = utils.createModalInput;
|
|
30
|
-
exports.createRow = utils.createRow;
|
|
31
34
|
Object.keys(core).forEach(function (k) {
|
|
32
35
|
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) exports[k] = core[k];
|
|
33
36
|
});
|
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, EmbedAuthorData, EmbedFooterData, EmbedAssetData, EmbedBuilder, User, ImageURLOptions, Attachment, AttachmentBuilder, ColorResolvable, GuildEmoji, GuildBasedChannel, Role, GuildMember,
|
|
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';
|
|
3
3
|
export * from '@magicyan/core';
|
|
4
4
|
|
|
5
5
|
declare const CustomItents: {
|
|
@@ -41,6 +41,37 @@ declare function findCommand(guildOrClient: Guild | Client<true>): {
|
|
|
41
41
|
}> | undefined;
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
+
declare function createRow<Component extends AnyComponentBuilder>(...components: Component[]): ActionRowBuilder<Component>;
|
|
45
|
+
interface CreateModalInputData extends Omit<TextInputComponentData, "type"> {
|
|
46
|
+
}
|
|
47
|
+
declare function createModalInput(data: CreateModalInputData): ActionRowBuilder<TextInputBuilder>;
|
|
48
|
+
interface CreateLinkButtonData extends Omit<LinkButtonComponentData, "style" | "type"> {
|
|
49
|
+
}
|
|
50
|
+
declare function createLinkButton(data: CreateLinkButtonData): ButtonBuilder;
|
|
51
|
+
interface MessageComponentsManager {
|
|
52
|
+
getButton(customId: string): ButtonComponent | undefined;
|
|
53
|
+
getButton(customId: string, required: true): ButtonComponent;
|
|
54
|
+
getStringSelect(customId: string): StringSelectMenuComponent | undefined;
|
|
55
|
+
getStringSelect(customId: string, required: true): StringSelectMenuComponent;
|
|
56
|
+
getUserSelect(customId: string): UserSelectMenuComponent | undefined;
|
|
57
|
+
getUserSelect(customId: string, required: true): UserSelectMenuComponent;
|
|
58
|
+
getChannelSelect(customId: string): ChannelSelectMenuComponent | undefined;
|
|
59
|
+
getChannelSelect(customId: string, required: true): ChannelSelectMenuComponent;
|
|
60
|
+
getRoleSelect(customId: string): RoleSelectMenuComponent | undefined;
|
|
61
|
+
getRoleSelect(customId: string, required: true): RoleSelectMenuComponent;
|
|
62
|
+
getMentionableSelect(customId: string): MentionableSelectMenuComponent | undefined;
|
|
63
|
+
getMentionableSelect(customId: string, required: true): MentionableSelectMenuComponent;
|
|
64
|
+
resolved: {
|
|
65
|
+
buttons: ButtonComponent[];
|
|
66
|
+
stringSelects: StringSelectMenuComponent[];
|
|
67
|
+
userSelects: UserSelectMenuComponent[];
|
|
68
|
+
channelSelects: ChannelSelectMenuComponent[];
|
|
69
|
+
roleSelects: RoleSelectMenuComponent[];
|
|
70
|
+
mentionableSelects: MentionableSelectMenuComponent[];
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
declare function createComponentsManager(components: ActionRow<MessageActionRowComponent>[]): MessageComponentsManager;
|
|
74
|
+
|
|
44
75
|
interface CreateEmbedAuthorOptions {
|
|
45
76
|
user: User;
|
|
46
77
|
property?: "username" | "displayName" | "id" | "globalName";
|
|
@@ -55,17 +86,17 @@ interface CreateEmbedFooterOptions {
|
|
|
55
86
|
text?: string | null;
|
|
56
87
|
iconURL?: string | null;
|
|
57
88
|
}
|
|
58
|
-
declare function createEmbedFooter(options: CreateEmbedFooterOptions): EmbedFooterData;
|
|
89
|
+
declare function createEmbedFooter(options: CreateEmbedFooterOptions): EmbedFooterData | undefined;
|
|
59
90
|
type EmbedAssetOptions = Omit<EmbedAssetData, "url">;
|
|
60
91
|
type AssetSource = string | null | Attachment | AttachmentBuilder;
|
|
61
92
|
declare function createEmbedAsset(source?: AssetSource, options?: EmbedAssetOptions): EmbedAssetData | undefined;
|
|
62
93
|
type EmbedColor = ColorResolvable | (string & {});
|
|
63
|
-
|
|
94
|
+
interface BaseEmbedField {
|
|
64
95
|
name: string;
|
|
65
96
|
value: string;
|
|
66
97
|
inline?: boolean;
|
|
67
|
-
}
|
|
68
|
-
|
|
98
|
+
}
|
|
99
|
+
interface BaseEmbedData {
|
|
69
100
|
title?: string;
|
|
70
101
|
color?: EmbedColor;
|
|
71
102
|
description?: string;
|
|
@@ -76,13 +107,13 @@ type BaseEmbedData = {
|
|
|
76
107
|
thumbnail?: EmbedAssetData;
|
|
77
108
|
author?: EmbedAuthorData;
|
|
78
109
|
fields?: BaseEmbedField[];
|
|
79
|
-
}
|
|
80
|
-
|
|
110
|
+
}
|
|
111
|
+
interface CreateEmbedOptions extends BaseEmbedData {
|
|
81
112
|
extend?: BaseEmbedData;
|
|
82
113
|
modify?: {
|
|
83
114
|
fields?(fields: BaseEmbedField[]): BaseEmbedField[];
|
|
84
115
|
};
|
|
85
|
-
}
|
|
116
|
+
}
|
|
86
117
|
declare function createEmbed(options: CreateEmbedOptions): EmbedBuilder;
|
|
87
118
|
|
|
88
119
|
type FindEmojiFilter = (emoji: GuildEmoji) => boolean;
|
|
@@ -92,15 +123,7 @@ declare function findEmoji(guildOrClient: Guild | Client): {
|
|
|
92
123
|
byFilter(filter: FindEmojiFilter): GuildEmoji | undefined;
|
|
93
124
|
};
|
|
94
125
|
|
|
95
|
-
|
|
96
|
-
type GetMentionType<T extends MentionType> = string | null | undefined | (T extends "channel" ? GuildBasedChannel : T extends "role" ? Role : T extends "user" ? User : never);
|
|
97
|
-
declare const formated: {
|
|
98
|
-
mention<T extends MentionType>(type: T, ref: GetMentionType<T>, alt?: string): {
|
|
99
|
-
channel: string;
|
|
100
|
-
user: string;
|
|
101
|
-
role: string;
|
|
102
|
-
}[T];
|
|
103
|
-
};
|
|
126
|
+
declare function formatedMention(ref: GuildBasedChannel | Role | User | undefined | null, alt?: string): string;
|
|
104
127
|
|
|
105
128
|
type FindMemberFilter = (member: GuildMember) => boolean;
|
|
106
129
|
declare function findMember(guild: Guild): {
|
|
@@ -112,19 +135,23 @@ declare function findMember(guild: Guild): {
|
|
|
112
135
|
byFilter(filter: FindMemberFilter): GuildMember | undefined;
|
|
113
136
|
};
|
|
114
137
|
|
|
138
|
+
type FindMessageFilter = (role: Message<true>) => boolean;
|
|
139
|
+
declare function findMessage(channel: GuildTextBasedChannel): {
|
|
140
|
+
byId(id: string): Message<true> | undefined;
|
|
141
|
+
byContent(): {
|
|
142
|
+
equals(content: string, ignoreCase?: boolean): Message<true> | undefined;
|
|
143
|
+
include(content: string, ignoreCase?: boolean): Message<true> | undefined;
|
|
144
|
+
};
|
|
145
|
+
byFilter(filter: FindMessageFilter): Message<true> | undefined;
|
|
146
|
+
};
|
|
147
|
+
|
|
115
148
|
type FindRoleFilter = (role: Role) => boolean;
|
|
116
149
|
declare function findRole(guild: Guild): {
|
|
117
150
|
byColor(color: number, and?: FindRoleFilter): Role | undefined;
|
|
118
151
|
byHexColor(hexColor: string, and?: FindRoleFilter): Role | undefined;
|
|
119
152
|
byName(name: string, and?: FindRoleFilter): Role | undefined;
|
|
120
153
|
byId(id: string): Role | undefined;
|
|
121
|
-
byFilter(filter:
|
|
154
|
+
byFilter(filter: FindRoleFilter): Role | undefined;
|
|
122
155
|
};
|
|
123
156
|
|
|
124
|
-
|
|
125
|
-
type CreateModalInputData = Omit<TextInputComponentData, "type">;
|
|
126
|
-
declare function createModalInput(data: CreateModalInputData): ActionRowBuilder<TextInputBuilder>;
|
|
127
|
-
type CreateLinkButtonData = Omit<LinkButtonComponentData, "style" | "type">;
|
|
128
|
-
declare function createLinkButton(data: CreateLinkButtonData): ButtonBuilder;
|
|
129
|
-
|
|
130
|
-
export { CustomItents, CustomPartials, createEmbed, createEmbedAsset, createEmbedAuthor, createEmbedFooter, createLinkButton, createModalInput, createRow, findChannel, findCommand, findEmoji, findMember, findRole, formated };
|
|
157
|
+
export { type BaseEmbedData, CustomItents, CustomPartials, createComponentsManager, createEmbed, createEmbedAsset, createEmbedAuthor, createEmbedFooter, createLinkButton, createModalInput, createRow, findChannel, findCommand, findEmoji, findMember, findMessage, findRole, formatedMention };
|
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, EmbedAuthorData, EmbedFooterData, EmbedAssetData, EmbedBuilder, User, ImageURLOptions, Attachment, AttachmentBuilder, ColorResolvable, GuildEmoji, GuildBasedChannel, Role, GuildMember,
|
|
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';
|
|
3
3
|
export * from '@magicyan/core';
|
|
4
4
|
|
|
5
5
|
declare const CustomItents: {
|
|
@@ -41,6 +41,37 @@ declare function findCommand(guildOrClient: Guild | Client<true>): {
|
|
|
41
41
|
}> | undefined;
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
+
declare function createRow<Component extends AnyComponentBuilder>(...components: Component[]): ActionRowBuilder<Component>;
|
|
45
|
+
interface CreateModalInputData extends Omit<TextInputComponentData, "type"> {
|
|
46
|
+
}
|
|
47
|
+
declare function createModalInput(data: CreateModalInputData): ActionRowBuilder<TextInputBuilder>;
|
|
48
|
+
interface CreateLinkButtonData extends Omit<LinkButtonComponentData, "style" | "type"> {
|
|
49
|
+
}
|
|
50
|
+
declare function createLinkButton(data: CreateLinkButtonData): ButtonBuilder;
|
|
51
|
+
interface MessageComponentsManager {
|
|
52
|
+
getButton(customId: string): ButtonComponent | undefined;
|
|
53
|
+
getButton(customId: string, required: true): ButtonComponent;
|
|
54
|
+
getStringSelect(customId: string): StringSelectMenuComponent | undefined;
|
|
55
|
+
getStringSelect(customId: string, required: true): StringSelectMenuComponent;
|
|
56
|
+
getUserSelect(customId: string): UserSelectMenuComponent | undefined;
|
|
57
|
+
getUserSelect(customId: string, required: true): UserSelectMenuComponent;
|
|
58
|
+
getChannelSelect(customId: string): ChannelSelectMenuComponent | undefined;
|
|
59
|
+
getChannelSelect(customId: string, required: true): ChannelSelectMenuComponent;
|
|
60
|
+
getRoleSelect(customId: string): RoleSelectMenuComponent | undefined;
|
|
61
|
+
getRoleSelect(customId: string, required: true): RoleSelectMenuComponent;
|
|
62
|
+
getMentionableSelect(customId: string): MentionableSelectMenuComponent | undefined;
|
|
63
|
+
getMentionableSelect(customId: string, required: true): MentionableSelectMenuComponent;
|
|
64
|
+
resolved: {
|
|
65
|
+
buttons: ButtonComponent[];
|
|
66
|
+
stringSelects: StringSelectMenuComponent[];
|
|
67
|
+
userSelects: UserSelectMenuComponent[];
|
|
68
|
+
channelSelects: ChannelSelectMenuComponent[];
|
|
69
|
+
roleSelects: RoleSelectMenuComponent[];
|
|
70
|
+
mentionableSelects: MentionableSelectMenuComponent[];
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
declare function createComponentsManager(components: ActionRow<MessageActionRowComponent>[]): MessageComponentsManager;
|
|
74
|
+
|
|
44
75
|
interface CreateEmbedAuthorOptions {
|
|
45
76
|
user: User;
|
|
46
77
|
property?: "username" | "displayName" | "id" | "globalName";
|
|
@@ -55,17 +86,17 @@ interface CreateEmbedFooterOptions {
|
|
|
55
86
|
text?: string | null;
|
|
56
87
|
iconURL?: string | null;
|
|
57
88
|
}
|
|
58
|
-
declare function createEmbedFooter(options: CreateEmbedFooterOptions): EmbedFooterData;
|
|
89
|
+
declare function createEmbedFooter(options: CreateEmbedFooterOptions): EmbedFooterData | undefined;
|
|
59
90
|
type EmbedAssetOptions = Omit<EmbedAssetData, "url">;
|
|
60
91
|
type AssetSource = string | null | Attachment | AttachmentBuilder;
|
|
61
92
|
declare function createEmbedAsset(source?: AssetSource, options?: EmbedAssetOptions): EmbedAssetData | undefined;
|
|
62
93
|
type EmbedColor = ColorResolvable | (string & {});
|
|
63
|
-
|
|
94
|
+
interface BaseEmbedField {
|
|
64
95
|
name: string;
|
|
65
96
|
value: string;
|
|
66
97
|
inline?: boolean;
|
|
67
|
-
}
|
|
68
|
-
|
|
98
|
+
}
|
|
99
|
+
interface BaseEmbedData {
|
|
69
100
|
title?: string;
|
|
70
101
|
color?: EmbedColor;
|
|
71
102
|
description?: string;
|
|
@@ -76,13 +107,13 @@ type BaseEmbedData = {
|
|
|
76
107
|
thumbnail?: EmbedAssetData;
|
|
77
108
|
author?: EmbedAuthorData;
|
|
78
109
|
fields?: BaseEmbedField[];
|
|
79
|
-
}
|
|
80
|
-
|
|
110
|
+
}
|
|
111
|
+
interface CreateEmbedOptions extends BaseEmbedData {
|
|
81
112
|
extend?: BaseEmbedData;
|
|
82
113
|
modify?: {
|
|
83
114
|
fields?(fields: BaseEmbedField[]): BaseEmbedField[];
|
|
84
115
|
};
|
|
85
|
-
}
|
|
116
|
+
}
|
|
86
117
|
declare function createEmbed(options: CreateEmbedOptions): EmbedBuilder;
|
|
87
118
|
|
|
88
119
|
type FindEmojiFilter = (emoji: GuildEmoji) => boolean;
|
|
@@ -92,15 +123,7 @@ declare function findEmoji(guildOrClient: Guild | Client): {
|
|
|
92
123
|
byFilter(filter: FindEmojiFilter): GuildEmoji | undefined;
|
|
93
124
|
};
|
|
94
125
|
|
|
95
|
-
|
|
96
|
-
type GetMentionType<T extends MentionType> = string | null | undefined | (T extends "channel" ? GuildBasedChannel : T extends "role" ? Role : T extends "user" ? User : never);
|
|
97
|
-
declare const formated: {
|
|
98
|
-
mention<T extends MentionType>(type: T, ref: GetMentionType<T>, alt?: string): {
|
|
99
|
-
channel: string;
|
|
100
|
-
user: string;
|
|
101
|
-
role: string;
|
|
102
|
-
}[T];
|
|
103
|
-
};
|
|
126
|
+
declare function formatedMention(ref: GuildBasedChannel | Role | User | undefined | null, alt?: string): string;
|
|
104
127
|
|
|
105
128
|
type FindMemberFilter = (member: GuildMember) => boolean;
|
|
106
129
|
declare function findMember(guild: Guild): {
|
|
@@ -112,19 +135,23 @@ declare function findMember(guild: Guild): {
|
|
|
112
135
|
byFilter(filter: FindMemberFilter): GuildMember | undefined;
|
|
113
136
|
};
|
|
114
137
|
|
|
138
|
+
type FindMessageFilter = (role: Message<true>) => boolean;
|
|
139
|
+
declare function findMessage(channel: GuildTextBasedChannel): {
|
|
140
|
+
byId(id: string): Message<true> | undefined;
|
|
141
|
+
byContent(): {
|
|
142
|
+
equals(content: string, ignoreCase?: boolean): Message<true> | undefined;
|
|
143
|
+
include(content: string, ignoreCase?: boolean): Message<true> | undefined;
|
|
144
|
+
};
|
|
145
|
+
byFilter(filter: FindMessageFilter): Message<true> | undefined;
|
|
146
|
+
};
|
|
147
|
+
|
|
115
148
|
type FindRoleFilter = (role: Role) => boolean;
|
|
116
149
|
declare function findRole(guild: Guild): {
|
|
117
150
|
byColor(color: number, and?: FindRoleFilter): Role | undefined;
|
|
118
151
|
byHexColor(hexColor: string, and?: FindRoleFilter): Role | undefined;
|
|
119
152
|
byName(name: string, and?: FindRoleFilter): Role | undefined;
|
|
120
153
|
byId(id: string): Role | undefined;
|
|
121
|
-
byFilter(filter:
|
|
154
|
+
byFilter(filter: FindRoleFilter): Role | undefined;
|
|
122
155
|
};
|
|
123
156
|
|
|
124
|
-
|
|
125
|
-
type CreateModalInputData = Omit<TextInputComponentData, "type">;
|
|
126
|
-
declare function createModalInput(data: CreateModalInputData): ActionRowBuilder<TextInputBuilder>;
|
|
127
|
-
type CreateLinkButtonData = Omit<LinkButtonComponentData, "style" | "type">;
|
|
128
|
-
declare function createLinkButton(data: CreateLinkButtonData): ButtonBuilder;
|
|
129
|
-
|
|
130
|
-
export { CustomItents, CustomPartials, createEmbed, createEmbedAsset, createEmbedAuthor, createEmbedFooter, createLinkButton, createModalInput, createRow, findChannel, findCommand, findEmoji, findMember, findRole, formated };
|
|
157
|
+
export { type BaseEmbedData, CustomItents, CustomPartials, createComponentsManager, createEmbed, createEmbedAsset, createEmbedAuthor, createEmbedFooter, createLinkButton, createModalInput, createRow, findChannel, findCommand, findEmoji, findMember, findMessage, findRole, formatedMention };
|
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, EmbedAuthorData, EmbedFooterData, EmbedAssetData, EmbedBuilder, User, ImageURLOptions, Attachment, AttachmentBuilder, ColorResolvable, GuildEmoji, GuildBasedChannel, Role, GuildMember,
|
|
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';
|
|
3
3
|
export * from '@magicyan/core';
|
|
4
4
|
|
|
5
5
|
declare const CustomItents: {
|
|
@@ -41,6 +41,37 @@ declare function findCommand(guildOrClient: Guild | Client<true>): {
|
|
|
41
41
|
}> | undefined;
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
+
declare function createRow<Component extends AnyComponentBuilder>(...components: Component[]): ActionRowBuilder<Component>;
|
|
45
|
+
interface CreateModalInputData extends Omit<TextInputComponentData, "type"> {
|
|
46
|
+
}
|
|
47
|
+
declare function createModalInput(data: CreateModalInputData): ActionRowBuilder<TextInputBuilder>;
|
|
48
|
+
interface CreateLinkButtonData extends Omit<LinkButtonComponentData, "style" | "type"> {
|
|
49
|
+
}
|
|
50
|
+
declare function createLinkButton(data: CreateLinkButtonData): ButtonBuilder;
|
|
51
|
+
interface MessageComponentsManager {
|
|
52
|
+
getButton(customId: string): ButtonComponent | undefined;
|
|
53
|
+
getButton(customId: string, required: true): ButtonComponent;
|
|
54
|
+
getStringSelect(customId: string): StringSelectMenuComponent | undefined;
|
|
55
|
+
getStringSelect(customId: string, required: true): StringSelectMenuComponent;
|
|
56
|
+
getUserSelect(customId: string): UserSelectMenuComponent | undefined;
|
|
57
|
+
getUserSelect(customId: string, required: true): UserSelectMenuComponent;
|
|
58
|
+
getChannelSelect(customId: string): ChannelSelectMenuComponent | undefined;
|
|
59
|
+
getChannelSelect(customId: string, required: true): ChannelSelectMenuComponent;
|
|
60
|
+
getRoleSelect(customId: string): RoleSelectMenuComponent | undefined;
|
|
61
|
+
getRoleSelect(customId: string, required: true): RoleSelectMenuComponent;
|
|
62
|
+
getMentionableSelect(customId: string): MentionableSelectMenuComponent | undefined;
|
|
63
|
+
getMentionableSelect(customId: string, required: true): MentionableSelectMenuComponent;
|
|
64
|
+
resolved: {
|
|
65
|
+
buttons: ButtonComponent[];
|
|
66
|
+
stringSelects: StringSelectMenuComponent[];
|
|
67
|
+
userSelects: UserSelectMenuComponent[];
|
|
68
|
+
channelSelects: ChannelSelectMenuComponent[];
|
|
69
|
+
roleSelects: RoleSelectMenuComponent[];
|
|
70
|
+
mentionableSelects: MentionableSelectMenuComponent[];
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
declare function createComponentsManager(components: ActionRow<MessageActionRowComponent>[]): MessageComponentsManager;
|
|
74
|
+
|
|
44
75
|
interface CreateEmbedAuthorOptions {
|
|
45
76
|
user: User;
|
|
46
77
|
property?: "username" | "displayName" | "id" | "globalName";
|
|
@@ -55,17 +86,17 @@ interface CreateEmbedFooterOptions {
|
|
|
55
86
|
text?: string | null;
|
|
56
87
|
iconURL?: string | null;
|
|
57
88
|
}
|
|
58
|
-
declare function createEmbedFooter(options: CreateEmbedFooterOptions): EmbedFooterData;
|
|
89
|
+
declare function createEmbedFooter(options: CreateEmbedFooterOptions): EmbedFooterData | undefined;
|
|
59
90
|
type EmbedAssetOptions = Omit<EmbedAssetData, "url">;
|
|
60
91
|
type AssetSource = string | null | Attachment | AttachmentBuilder;
|
|
61
92
|
declare function createEmbedAsset(source?: AssetSource, options?: EmbedAssetOptions): EmbedAssetData | undefined;
|
|
62
93
|
type EmbedColor = ColorResolvable | (string & {});
|
|
63
|
-
|
|
94
|
+
interface BaseEmbedField {
|
|
64
95
|
name: string;
|
|
65
96
|
value: string;
|
|
66
97
|
inline?: boolean;
|
|
67
|
-
}
|
|
68
|
-
|
|
98
|
+
}
|
|
99
|
+
interface BaseEmbedData {
|
|
69
100
|
title?: string;
|
|
70
101
|
color?: EmbedColor;
|
|
71
102
|
description?: string;
|
|
@@ -76,13 +107,13 @@ type BaseEmbedData = {
|
|
|
76
107
|
thumbnail?: EmbedAssetData;
|
|
77
108
|
author?: EmbedAuthorData;
|
|
78
109
|
fields?: BaseEmbedField[];
|
|
79
|
-
}
|
|
80
|
-
|
|
110
|
+
}
|
|
111
|
+
interface CreateEmbedOptions extends BaseEmbedData {
|
|
81
112
|
extend?: BaseEmbedData;
|
|
82
113
|
modify?: {
|
|
83
114
|
fields?(fields: BaseEmbedField[]): BaseEmbedField[];
|
|
84
115
|
};
|
|
85
|
-
}
|
|
116
|
+
}
|
|
86
117
|
declare function createEmbed(options: CreateEmbedOptions): EmbedBuilder;
|
|
87
118
|
|
|
88
119
|
type FindEmojiFilter = (emoji: GuildEmoji) => boolean;
|
|
@@ -92,15 +123,7 @@ declare function findEmoji(guildOrClient: Guild | Client): {
|
|
|
92
123
|
byFilter(filter: FindEmojiFilter): GuildEmoji | undefined;
|
|
93
124
|
};
|
|
94
125
|
|
|
95
|
-
|
|
96
|
-
type GetMentionType<T extends MentionType> = string | null | undefined | (T extends "channel" ? GuildBasedChannel : T extends "role" ? Role : T extends "user" ? User : never);
|
|
97
|
-
declare const formated: {
|
|
98
|
-
mention<T extends MentionType>(type: T, ref: GetMentionType<T>, alt?: string): {
|
|
99
|
-
channel: string;
|
|
100
|
-
user: string;
|
|
101
|
-
role: string;
|
|
102
|
-
}[T];
|
|
103
|
-
};
|
|
126
|
+
declare function formatedMention(ref: GuildBasedChannel | Role | User | undefined | null, alt?: string): string;
|
|
104
127
|
|
|
105
128
|
type FindMemberFilter = (member: GuildMember) => boolean;
|
|
106
129
|
declare function findMember(guild: Guild): {
|
|
@@ -112,19 +135,23 @@ declare function findMember(guild: Guild): {
|
|
|
112
135
|
byFilter(filter: FindMemberFilter): GuildMember | undefined;
|
|
113
136
|
};
|
|
114
137
|
|
|
138
|
+
type FindMessageFilter = (role: Message<true>) => boolean;
|
|
139
|
+
declare function findMessage(channel: GuildTextBasedChannel): {
|
|
140
|
+
byId(id: string): Message<true> | undefined;
|
|
141
|
+
byContent(): {
|
|
142
|
+
equals(content: string, ignoreCase?: boolean): Message<true> | undefined;
|
|
143
|
+
include(content: string, ignoreCase?: boolean): Message<true> | undefined;
|
|
144
|
+
};
|
|
145
|
+
byFilter(filter: FindMessageFilter): Message<true> | undefined;
|
|
146
|
+
};
|
|
147
|
+
|
|
115
148
|
type FindRoleFilter = (role: Role) => boolean;
|
|
116
149
|
declare function findRole(guild: Guild): {
|
|
117
150
|
byColor(color: number, and?: FindRoleFilter): Role | undefined;
|
|
118
151
|
byHexColor(hexColor: string, and?: FindRoleFilter): Role | undefined;
|
|
119
152
|
byName(name: string, and?: FindRoleFilter): Role | undefined;
|
|
120
153
|
byId(id: string): Role | undefined;
|
|
121
|
-
byFilter(filter:
|
|
154
|
+
byFilter(filter: FindRoleFilter): Role | undefined;
|
|
122
155
|
};
|
|
123
156
|
|
|
124
|
-
|
|
125
|
-
type CreateModalInputData = Omit<TextInputComponentData, "type">;
|
|
126
|
-
declare function createModalInput(data: CreateModalInputData): ActionRowBuilder<TextInputBuilder>;
|
|
127
|
-
type CreateLinkButtonData = Omit<LinkButtonComponentData, "style" | "type">;
|
|
128
|
-
declare function createLinkButton(data: CreateLinkButtonData): ButtonBuilder;
|
|
129
|
-
|
|
130
|
-
export { CustomItents, CustomPartials, createEmbed, createEmbedAsset, createEmbedAuthor, createEmbedFooter, createLinkButton, createModalInput, createRow, findChannel, findCommand, findEmoji, findMember, findRole, formated };
|
|
157
|
+
export { type BaseEmbedData, CustomItents, CustomPartials, createComponentsManager, createEmbed, createEmbedAsset, createEmbedAuthor, createEmbedFooter, createLinkButton, createModalInput, createRow, findChannel, findCommand, findEmoji, findMember, findMessage, findRole, formatedMention };
|
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
export { CustomItents, CustomPartials } from './constants/client.mjs';
|
|
2
2
|
export { findChannel } from './functions/channels.mjs';
|
|
3
3
|
export { findCommand } from './functions/commands.mjs';
|
|
4
|
+
export { createComponentsManager, createLinkButton, createModalInput, createRow } from './functions/components.mjs';
|
|
4
5
|
export { createEmbed, createEmbedAsset, createEmbedAuthor, createEmbedFooter } from './functions/embeds.mjs';
|
|
5
6
|
export { findEmoji } from './functions/emojis.mjs';
|
|
6
|
-
export {
|
|
7
|
+
export { formatedMention } from './functions/format.mjs';
|
|
7
8
|
export { findMember } from './functions/members.mjs';
|
|
9
|
+
export { findMessage } from './functions/message.mjs';
|
|
8
10
|
export { findRole } from './functions/roles.mjs';
|
|
9
|
-
export { createLinkButton, createModalInput, createRow } from './functions/utils.mjs';
|
|
10
11
|
export * from '@magicyan/core';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@magicyan/discord",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.18",
|
|
4
4
|
"description": "Simple functions to facilitate discord bot development",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -39,9 +39,9 @@
|
|
|
39
39
|
"unbuild": "^2.0.0"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@magicyan/core": "^1.0.
|
|
42
|
+
"@magicyan/core": "^1.0.16"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"discord.js": "^14.14.1"
|
|
46
46
|
}
|
|
47
|
-
}
|
|
47
|
+
}
|
package/dist/functions/utils.cjs
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const discord_js = require('discord.js');
|
|
4
|
-
|
|
5
|
-
function createRow(...components) {
|
|
6
|
-
return new discord_js.ActionRowBuilder({ components });
|
|
7
|
-
}
|
|
8
|
-
function createModalInput(data) {
|
|
9
|
-
return createRow(new discord_js.TextInputBuilder(data));
|
|
10
|
-
}
|
|
11
|
-
function createLinkButton(data) {
|
|
12
|
-
if (!data.label)
|
|
13
|
-
data.label = data.url;
|
|
14
|
-
return new discord_js.ButtonBuilder({ style: discord_js.ButtonStyle.Link, ...data });
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
exports.createLinkButton = createLinkButton;
|
|
18
|
-
exports.createModalInput = createModalInput;
|
|
19
|
-
exports.createRow = createRow;
|
package/dist/functions/utils.mjs
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { ActionRowBuilder, TextInputBuilder, ButtonBuilder, ButtonStyle } from 'discord.js';
|
|
2
|
-
|
|
3
|
-
function createRow(...components) {
|
|
4
|
-
return new ActionRowBuilder({ components });
|
|
5
|
-
}
|
|
6
|
-
function createModalInput(data) {
|
|
7
|
-
return createRow(new TextInputBuilder(data));
|
|
8
|
-
}
|
|
9
|
-
function createLinkButton(data) {
|
|
10
|
-
if (!data.label)
|
|
11
|
-
data.label = data.url;
|
|
12
|
-
return new ButtonBuilder({ style: ButtonStyle.Link, ...data });
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export { createLinkButton, createModalInput, createRow };
|