@magicyan/discord 1.0.23 → 1.0.24
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 +0 -4
- package/dist/functions/components.mjs +2 -5
- package/dist/functions/modals.cjs +16 -0
- package/dist/functions/modals.mjs +13 -0
- package/dist/index.cjs +3 -1
- package/dist/index.d.cts +19 -6
- package/dist/index.d.mts +19 -6
- package/dist/index.d.ts +19 -6
- package/dist/index.mjs +2 -1
- package/package.json +1 -1
|
@@ -5,9 +5,6 @@ const discord_js = require('discord.js');
|
|
|
5
5
|
function createRow(...components) {
|
|
6
6
|
return new discord_js.ActionRowBuilder({ components });
|
|
7
7
|
}
|
|
8
|
-
function createModalInput(data) {
|
|
9
|
-
return createRow(new discord_js.TextInputBuilder(data));
|
|
10
|
-
}
|
|
11
8
|
function createLinkButton(data) {
|
|
12
9
|
if (!data.label)
|
|
13
10
|
data.label = data.url;
|
|
@@ -64,5 +61,4 @@ function createComponentsManager(components) {
|
|
|
64
61
|
|
|
65
62
|
exports.createComponentsManager = createComponentsManager;
|
|
66
63
|
exports.createLinkButton = createLinkButton;
|
|
67
|
-
exports.createModalInput = createModalInput;
|
|
68
64
|
exports.createRow = createRow;
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import { ActionRowBuilder,
|
|
1
|
+
import { ActionRowBuilder, ButtonBuilder, ButtonStyle, ComponentType } from 'discord.js';
|
|
2
2
|
|
|
3
3
|
function createRow(...components) {
|
|
4
4
|
return new ActionRowBuilder({ components });
|
|
5
5
|
}
|
|
6
|
-
function createModalInput(data) {
|
|
7
|
-
return createRow(new TextInputBuilder(data));
|
|
8
|
-
}
|
|
9
6
|
function createLinkButton(data) {
|
|
10
7
|
if (!data.label)
|
|
11
8
|
data.label = data.url;
|
|
@@ -60,4 +57,4 @@ function createComponentsManager(components) {
|
|
|
60
57
|
};
|
|
61
58
|
}
|
|
62
59
|
|
|
63
|
-
export { createComponentsManager, createLinkButton,
|
|
60
|
+
export { createComponentsManager, createLinkButton, createRow };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const discord_js = require('discord.js');
|
|
4
|
+
const components = require('./components.cjs');
|
|
5
|
+
|
|
6
|
+
function createModalInput(data) {
|
|
7
|
+
return components.createRow(new discord_js.TextInputBuilder(data));
|
|
8
|
+
}
|
|
9
|
+
function createModalFields(data) {
|
|
10
|
+
return Object.entries(data).map(
|
|
11
|
+
([customId, data2]) => createModalInput({ customId, ...data2 })
|
|
12
|
+
);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
exports.createModalFields = createModalFields;
|
|
16
|
+
exports.createModalInput = createModalInput;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { TextInputBuilder } from 'discord.js';
|
|
2
|
+
import { createRow } from './components.mjs';
|
|
3
|
+
|
|
4
|
+
function createModalInput(data) {
|
|
5
|
+
return createRow(new TextInputBuilder(data));
|
|
6
|
+
}
|
|
7
|
+
function createModalFields(data) {
|
|
8
|
+
return Object.entries(data).map(
|
|
9
|
+
([customId, data2]) => createModalInput({ customId, ...data2 })
|
|
10
|
+
);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export { createModalFields, createModalInput };
|
package/dist/index.cjs
CHANGED
|
@@ -6,6 +6,7 @@ const misc = require('./functions/misc.cjs');
|
|
|
6
6
|
const channels = require('./functions/channels.cjs');
|
|
7
7
|
const commands = require('./functions/commands.cjs');
|
|
8
8
|
const components = require('./functions/components.cjs');
|
|
9
|
+
const modals = require('./functions/modals.cjs');
|
|
9
10
|
const emojis = require('./functions/emojis.cjs');
|
|
10
11
|
const format = require('./functions/format.cjs');
|
|
11
12
|
const members = require('./functions/members.cjs');
|
|
@@ -29,8 +30,9 @@ exports.getChannelUrlInfo = channels.getChannelUrlInfo;
|
|
|
29
30
|
exports.findCommand = commands.findCommand;
|
|
30
31
|
exports.createComponentsManager = components.createComponentsManager;
|
|
31
32
|
exports.createLinkButton = components.createLinkButton;
|
|
32
|
-
exports.createModalInput = components.createModalInput;
|
|
33
33
|
exports.createRow = components.createRow;
|
|
34
|
+
exports.createModalFields = modals.createModalFields;
|
|
35
|
+
exports.createModalInput = modals.createModalInput;
|
|
34
36
|
exports.findEmoji = emojis.findEmoji;
|
|
35
37
|
exports.formatedMention = format.formatedMention;
|
|
36
38
|
exports.findMember = members.findMember;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as discord_js from 'discord.js';
|
|
2
|
-
import { GatewayIntentBits, Partials, ChannelType, Guild, CommandInteractionOption, Client, ApplicationCommand, AnyComponentBuilder, ActionRowBuilder,
|
|
2
|
+
import { GatewayIntentBits, Partials, ChannelType, Guild, CommandInteractionOption, Client, ApplicationCommand, AnyComponentBuilder, ActionRowBuilder, ButtonBuilder, ActionRow, MessageActionRowComponent, LinkButtonComponentData, ButtonComponent, StringSelectMenuComponent, UserSelectMenuComponent, ChannelSelectMenuComponent, RoleSelectMenuComponent, MentionableSelectMenuComponent, TextInputBuilder, TextInputComponentData, GuildEmoji, GuildBasedChannel, Role, User, GuildMember, GuildTextBasedChannel, Message, Attachment, AttachmentBuilder, EmbedAssetData, EmbedAuthorData, ImageURLOptions, EmbedBuilder, EmbedData, APIEmbed, Embed, ColorResolvable, EmbedFooterData } from 'discord.js';
|
|
3
3
|
export * from '@magicyan/core';
|
|
4
4
|
|
|
5
5
|
declare const chars: {
|
|
@@ -58,9 +58,6 @@ declare function findCommand(guildOrClient: Guild | Client<true>): {
|
|
|
58
58
|
};
|
|
59
59
|
|
|
60
60
|
declare function createRow<Component extends AnyComponentBuilder>(...components: Component[]): ActionRowBuilder<Component>;
|
|
61
|
-
interface CreateModalInputData extends Omit<TextInputComponentData, "type"> {
|
|
62
|
-
}
|
|
63
|
-
declare function createModalInput(data: CreateModalInputData): ActionRowBuilder<TextInputBuilder>;
|
|
64
61
|
interface CreateLinkButtonData extends Omit<LinkButtonComponentData, "style" | "type"> {
|
|
65
62
|
}
|
|
66
63
|
declare function createLinkButton(data: CreateLinkButtonData): ButtonBuilder;
|
|
@@ -88,6 +85,12 @@ interface MessageComponentsManager {
|
|
|
88
85
|
}
|
|
89
86
|
declare function createComponentsManager(components: ActionRow<MessageActionRowComponent>[]): MessageComponentsManager;
|
|
90
87
|
|
|
88
|
+
type TextInputData = Omit<TextInputComponentData, "type">;
|
|
89
|
+
type CreateModalInputData = TextInputData;
|
|
90
|
+
declare function createModalInput(data: CreateModalInputData): ActionRowBuilder<TextInputBuilder>;
|
|
91
|
+
type ModalFieldsData = Record<string, Omit<TextInputData, "customId">>;
|
|
92
|
+
declare function createModalFields(data: ModalFieldsData): ActionRowBuilder<TextInputBuilder>[];
|
|
93
|
+
|
|
91
94
|
type FindEmojiFilter = (emoji: GuildEmoji) => boolean;
|
|
92
95
|
declare function findEmoji(guildOrClient: Guild | Client): {
|
|
93
96
|
byName(name: string, animated?: boolean, and?: FindEmojiFilter): GuildEmoji | undefined;
|
|
@@ -125,6 +128,16 @@ interface MessageUrlInfo {
|
|
|
125
128
|
declare function getMessageUrlInfo(url: string): MessageUrlInfo;
|
|
126
129
|
|
|
127
130
|
type FindRoleFilter = (role: Role) => boolean;
|
|
131
|
+
/**
|
|
132
|
+
*
|
|
133
|
+
* @param guild Discord guild
|
|
134
|
+
*
|
|
135
|
+
* ```ts
|
|
136
|
+
* const memberRole = findRole(guild).byName("Member");
|
|
137
|
+
* const adminRole = findRole(guild).byHexColor("#ff5454");
|
|
138
|
+
* const leaderRole = findRole(guild).byId("537818031728885771");
|
|
139
|
+
* ```
|
|
140
|
+
*/
|
|
128
141
|
declare function findRole(guild: Guild): {
|
|
129
142
|
byColor(color: number, and?: FindRoleFilter): Role | undefined;
|
|
130
143
|
byHexColor(hexColor: string, and?: FindRoleFilter): Role | undefined;
|
|
@@ -215,7 +228,7 @@ declare class EmbedPlusBuilder extends EmbedBuilder {
|
|
|
215
228
|
get fieldsLength(): number;
|
|
216
229
|
get fields(): discord_js.APIEmbedField[];
|
|
217
230
|
}
|
|
218
|
-
type
|
|
231
|
+
type EmbedPlusProperty<P extends keyof EmbedPlusData> = EmbedPlusData[P];
|
|
219
232
|
interface CreateEmbedOptions<B extends boolean> extends EmbedPlusOptions {
|
|
220
233
|
array?: B;
|
|
221
234
|
}
|
|
@@ -228,4 +241,4 @@ interface CreateEmbedFooterOptions {
|
|
|
228
241
|
}
|
|
229
242
|
declare function createEmbedFooter(options: CreateEmbedFooterOptions): EmbedFooterData | undefined;
|
|
230
243
|
|
|
231
|
-
export { type AssetSource, CustomItents, CustomPartials, EmbedPlusBuilder, type
|
|
244
|
+
export { type AssetSource, CustomItents, CustomPartials, EmbedPlusBuilder, type EmbedPlusProperty, chars, createComponentsManager, createEmbed, createEmbedAsset, createEmbedAuthor, createEmbedFooter, createLinkButton, createModalFields, createModalInput, createRow, extractMentionId, findChannel, findCommand, findEmoji, findMember, findMessage, findRole, formatedMention, getChannelUrlInfo, getMessageUrlInfo, setMobileStatus };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as discord_js from 'discord.js';
|
|
2
|
-
import { GatewayIntentBits, Partials, ChannelType, Guild, CommandInteractionOption, Client, ApplicationCommand, AnyComponentBuilder, ActionRowBuilder,
|
|
2
|
+
import { GatewayIntentBits, Partials, ChannelType, Guild, CommandInteractionOption, Client, ApplicationCommand, AnyComponentBuilder, ActionRowBuilder, ButtonBuilder, ActionRow, MessageActionRowComponent, LinkButtonComponentData, ButtonComponent, StringSelectMenuComponent, UserSelectMenuComponent, ChannelSelectMenuComponent, RoleSelectMenuComponent, MentionableSelectMenuComponent, TextInputBuilder, TextInputComponentData, GuildEmoji, GuildBasedChannel, Role, User, GuildMember, GuildTextBasedChannel, Message, Attachment, AttachmentBuilder, EmbedAssetData, EmbedAuthorData, ImageURLOptions, EmbedBuilder, EmbedData, APIEmbed, Embed, ColorResolvable, EmbedFooterData } from 'discord.js';
|
|
3
3
|
export * from '@magicyan/core';
|
|
4
4
|
|
|
5
5
|
declare const chars: {
|
|
@@ -58,9 +58,6 @@ declare function findCommand(guildOrClient: Guild | Client<true>): {
|
|
|
58
58
|
};
|
|
59
59
|
|
|
60
60
|
declare function createRow<Component extends AnyComponentBuilder>(...components: Component[]): ActionRowBuilder<Component>;
|
|
61
|
-
interface CreateModalInputData extends Omit<TextInputComponentData, "type"> {
|
|
62
|
-
}
|
|
63
|
-
declare function createModalInput(data: CreateModalInputData): ActionRowBuilder<TextInputBuilder>;
|
|
64
61
|
interface CreateLinkButtonData extends Omit<LinkButtonComponentData, "style" | "type"> {
|
|
65
62
|
}
|
|
66
63
|
declare function createLinkButton(data: CreateLinkButtonData): ButtonBuilder;
|
|
@@ -88,6 +85,12 @@ interface MessageComponentsManager {
|
|
|
88
85
|
}
|
|
89
86
|
declare function createComponentsManager(components: ActionRow<MessageActionRowComponent>[]): MessageComponentsManager;
|
|
90
87
|
|
|
88
|
+
type TextInputData = Omit<TextInputComponentData, "type">;
|
|
89
|
+
type CreateModalInputData = TextInputData;
|
|
90
|
+
declare function createModalInput(data: CreateModalInputData): ActionRowBuilder<TextInputBuilder>;
|
|
91
|
+
type ModalFieldsData = Record<string, Omit<TextInputData, "customId">>;
|
|
92
|
+
declare function createModalFields(data: ModalFieldsData): ActionRowBuilder<TextInputBuilder>[];
|
|
93
|
+
|
|
91
94
|
type FindEmojiFilter = (emoji: GuildEmoji) => boolean;
|
|
92
95
|
declare function findEmoji(guildOrClient: Guild | Client): {
|
|
93
96
|
byName(name: string, animated?: boolean, and?: FindEmojiFilter): GuildEmoji | undefined;
|
|
@@ -125,6 +128,16 @@ interface MessageUrlInfo {
|
|
|
125
128
|
declare function getMessageUrlInfo(url: string): MessageUrlInfo;
|
|
126
129
|
|
|
127
130
|
type FindRoleFilter = (role: Role) => boolean;
|
|
131
|
+
/**
|
|
132
|
+
*
|
|
133
|
+
* @param guild Discord guild
|
|
134
|
+
*
|
|
135
|
+
* ```ts
|
|
136
|
+
* const memberRole = findRole(guild).byName("Member");
|
|
137
|
+
* const adminRole = findRole(guild).byHexColor("#ff5454");
|
|
138
|
+
* const leaderRole = findRole(guild).byId("537818031728885771");
|
|
139
|
+
* ```
|
|
140
|
+
*/
|
|
128
141
|
declare function findRole(guild: Guild): {
|
|
129
142
|
byColor(color: number, and?: FindRoleFilter): Role | undefined;
|
|
130
143
|
byHexColor(hexColor: string, and?: FindRoleFilter): Role | undefined;
|
|
@@ -215,7 +228,7 @@ declare class EmbedPlusBuilder extends EmbedBuilder {
|
|
|
215
228
|
get fieldsLength(): number;
|
|
216
229
|
get fields(): discord_js.APIEmbedField[];
|
|
217
230
|
}
|
|
218
|
-
type
|
|
231
|
+
type EmbedPlusProperty<P extends keyof EmbedPlusData> = EmbedPlusData[P];
|
|
219
232
|
interface CreateEmbedOptions<B extends boolean> extends EmbedPlusOptions {
|
|
220
233
|
array?: B;
|
|
221
234
|
}
|
|
@@ -228,4 +241,4 @@ interface CreateEmbedFooterOptions {
|
|
|
228
241
|
}
|
|
229
242
|
declare function createEmbedFooter(options: CreateEmbedFooterOptions): EmbedFooterData | undefined;
|
|
230
243
|
|
|
231
|
-
export { type AssetSource, CustomItents, CustomPartials, EmbedPlusBuilder, type
|
|
244
|
+
export { type AssetSource, CustomItents, CustomPartials, EmbedPlusBuilder, type EmbedPlusProperty, chars, createComponentsManager, createEmbed, createEmbedAsset, createEmbedAuthor, createEmbedFooter, createLinkButton, createModalFields, createModalInput, createRow, extractMentionId, findChannel, findCommand, findEmoji, findMember, findMessage, findRole, formatedMention, getChannelUrlInfo, getMessageUrlInfo, setMobileStatus };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as discord_js from 'discord.js';
|
|
2
|
-
import { GatewayIntentBits, Partials, ChannelType, Guild, CommandInteractionOption, Client, ApplicationCommand, AnyComponentBuilder, ActionRowBuilder,
|
|
2
|
+
import { GatewayIntentBits, Partials, ChannelType, Guild, CommandInteractionOption, Client, ApplicationCommand, AnyComponentBuilder, ActionRowBuilder, ButtonBuilder, ActionRow, MessageActionRowComponent, LinkButtonComponentData, ButtonComponent, StringSelectMenuComponent, UserSelectMenuComponent, ChannelSelectMenuComponent, RoleSelectMenuComponent, MentionableSelectMenuComponent, TextInputBuilder, TextInputComponentData, GuildEmoji, GuildBasedChannel, Role, User, GuildMember, GuildTextBasedChannel, Message, Attachment, AttachmentBuilder, EmbedAssetData, EmbedAuthorData, ImageURLOptions, EmbedBuilder, EmbedData, APIEmbed, Embed, ColorResolvable, EmbedFooterData } from 'discord.js';
|
|
3
3
|
export * from '@magicyan/core';
|
|
4
4
|
|
|
5
5
|
declare const chars: {
|
|
@@ -58,9 +58,6 @@ declare function findCommand(guildOrClient: Guild | Client<true>): {
|
|
|
58
58
|
};
|
|
59
59
|
|
|
60
60
|
declare function createRow<Component extends AnyComponentBuilder>(...components: Component[]): ActionRowBuilder<Component>;
|
|
61
|
-
interface CreateModalInputData extends Omit<TextInputComponentData, "type"> {
|
|
62
|
-
}
|
|
63
|
-
declare function createModalInput(data: CreateModalInputData): ActionRowBuilder<TextInputBuilder>;
|
|
64
61
|
interface CreateLinkButtonData extends Omit<LinkButtonComponentData, "style" | "type"> {
|
|
65
62
|
}
|
|
66
63
|
declare function createLinkButton(data: CreateLinkButtonData): ButtonBuilder;
|
|
@@ -88,6 +85,12 @@ interface MessageComponentsManager {
|
|
|
88
85
|
}
|
|
89
86
|
declare function createComponentsManager(components: ActionRow<MessageActionRowComponent>[]): MessageComponentsManager;
|
|
90
87
|
|
|
88
|
+
type TextInputData = Omit<TextInputComponentData, "type">;
|
|
89
|
+
type CreateModalInputData = TextInputData;
|
|
90
|
+
declare function createModalInput(data: CreateModalInputData): ActionRowBuilder<TextInputBuilder>;
|
|
91
|
+
type ModalFieldsData = Record<string, Omit<TextInputData, "customId">>;
|
|
92
|
+
declare function createModalFields(data: ModalFieldsData): ActionRowBuilder<TextInputBuilder>[];
|
|
93
|
+
|
|
91
94
|
type FindEmojiFilter = (emoji: GuildEmoji) => boolean;
|
|
92
95
|
declare function findEmoji(guildOrClient: Guild | Client): {
|
|
93
96
|
byName(name: string, animated?: boolean, and?: FindEmojiFilter): GuildEmoji | undefined;
|
|
@@ -125,6 +128,16 @@ interface MessageUrlInfo {
|
|
|
125
128
|
declare function getMessageUrlInfo(url: string): MessageUrlInfo;
|
|
126
129
|
|
|
127
130
|
type FindRoleFilter = (role: Role) => boolean;
|
|
131
|
+
/**
|
|
132
|
+
*
|
|
133
|
+
* @param guild Discord guild
|
|
134
|
+
*
|
|
135
|
+
* ```ts
|
|
136
|
+
* const memberRole = findRole(guild).byName("Member");
|
|
137
|
+
* const adminRole = findRole(guild).byHexColor("#ff5454");
|
|
138
|
+
* const leaderRole = findRole(guild).byId("537818031728885771");
|
|
139
|
+
* ```
|
|
140
|
+
*/
|
|
128
141
|
declare function findRole(guild: Guild): {
|
|
129
142
|
byColor(color: number, and?: FindRoleFilter): Role | undefined;
|
|
130
143
|
byHexColor(hexColor: string, and?: FindRoleFilter): Role | undefined;
|
|
@@ -215,7 +228,7 @@ declare class EmbedPlusBuilder extends EmbedBuilder {
|
|
|
215
228
|
get fieldsLength(): number;
|
|
216
229
|
get fields(): discord_js.APIEmbedField[];
|
|
217
230
|
}
|
|
218
|
-
type
|
|
231
|
+
type EmbedPlusProperty<P extends keyof EmbedPlusData> = EmbedPlusData[P];
|
|
219
232
|
interface CreateEmbedOptions<B extends boolean> extends EmbedPlusOptions {
|
|
220
233
|
array?: B;
|
|
221
234
|
}
|
|
@@ -228,4 +241,4 @@ interface CreateEmbedFooterOptions {
|
|
|
228
241
|
}
|
|
229
242
|
declare function createEmbedFooter(options: CreateEmbedFooterOptions): EmbedFooterData | undefined;
|
|
230
243
|
|
|
231
|
-
export { type AssetSource, CustomItents, CustomPartials, EmbedPlusBuilder, type
|
|
244
|
+
export { type AssetSource, CustomItents, CustomPartials, EmbedPlusBuilder, type EmbedPlusProperty, chars, createComponentsManager, createEmbed, createEmbedAsset, createEmbedAuthor, createEmbedFooter, createLinkButton, createModalFields, createModalInput, createRow, extractMentionId, findChannel, findCommand, findEmoji, findMember, findMessage, findRole, formatedMention, getChannelUrlInfo, getMessageUrlInfo, setMobileStatus };
|
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,8 @@ export { CustomItents, CustomPartials } from './constants/client.mjs';
|
|
|
3
3
|
export { setMobileStatus } from './functions/misc.mjs';
|
|
4
4
|
export { findChannel, getChannelUrlInfo } from './functions/channels.mjs';
|
|
5
5
|
export { findCommand } from './functions/commands.mjs';
|
|
6
|
-
export { createComponentsManager, createLinkButton,
|
|
6
|
+
export { createComponentsManager, createLinkButton, createRow } from './functions/components.mjs';
|
|
7
|
+
export { createModalFields, createModalInput } from './functions/modals.mjs';
|
|
7
8
|
export { findEmoji } from './functions/emojis.mjs';
|
|
8
9
|
export { formatedMention } from './functions/format.mjs';
|
|
9
10
|
export { findMember } from './functions/members.mjs';
|