@magicyan/discord 1.0.33 → 1.0.35

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.
@@ -16,28 +16,16 @@ function findCommand(guildOrClient) {
16
16
  }
17
17
  };
18
18
  }
19
- function createCommandOptions(options) {
20
- return Object.entries(options).map(
21
- ([name, data]) => Object.assign(data, { name })
22
- );
23
- }
24
- function createSubCommands(subcommands) {
25
- return Object.entries(subcommands).map(([name, data]) => {
26
- if (data.options)
27
- Object.assign(data, {
28
- options: createCommandOptions(data.options)
29
- });
30
- return Object.assign(data, { name, type: discord_js.ApplicationCommandOptionType.Subcommand });
31
- });
32
- }
33
- function createSubCommandsGroups(groups) {
34
- return Object.entries(groups).map(([name, data]) => {
35
- const options = createSubCommands(data.subcommands);
36
- return Object.assign(data, { name, type: discord_js.ApplicationCommandOptionType.SubcommandGroup, options });
37
- });
19
+ function commandMention(command, a, b) {
20
+ const args = [command.name, command.id];
21
+ if (a && b) {
22
+ args.splice(1, 0, a, b);
23
+ }
24
+ if (a && !b) {
25
+ args.splice(1, 0, a);
26
+ }
27
+ return discord_js.chatInputApplicationCommandMention(...args);
38
28
  }
39
29
 
40
- exports.createCommandOptions = createCommandOptions;
41
- exports.createSubCommands = createSubCommands;
42
- exports.createSubCommandsGroups = createSubCommandsGroups;
30
+ exports.commandMention = commandMention;
43
31
  exports.findCommand = findCommand;
@@ -1,4 +1,4 @@
1
- import { Client, ApplicationCommandOptionType } from 'discord.js';
1
+ import { Client, chatInputApplicationCommandMention } from 'discord.js';
2
2
 
3
3
  function findCommand(guildOrClient) {
4
4
  const commands = guildOrClient instanceof Client ? guildOrClient.application.commands.cache : guildOrClient.commands.cache;
@@ -14,25 +14,15 @@ function findCommand(guildOrClient) {
14
14
  }
15
15
  };
16
16
  }
17
- function createCommandOptions(options) {
18
- return Object.entries(options).map(
19
- ([name, data]) => Object.assign(data, { name })
20
- );
21
- }
22
- function createSubCommands(subcommands) {
23
- return Object.entries(subcommands).map(([name, data]) => {
24
- if (data.options)
25
- Object.assign(data, {
26
- options: createCommandOptions(data.options)
27
- });
28
- return Object.assign(data, { name, type: ApplicationCommandOptionType.Subcommand });
29
- });
30
- }
31
- function createSubCommandsGroups(groups) {
32
- return Object.entries(groups).map(([name, data]) => {
33
- const options = createSubCommands(data.subcommands);
34
- return Object.assign(data, { name, type: ApplicationCommandOptionType.SubcommandGroup, options });
35
- });
17
+ function commandMention(command, a, b) {
18
+ const args = [command.name, command.id];
19
+ if (a && b) {
20
+ args.splice(1, 0, a, b);
21
+ }
22
+ if (a && !b) {
23
+ args.splice(1, 0, a);
24
+ }
25
+ return chatInputApplicationCommandMention(...args);
36
26
  }
37
27
 
38
- export { createCommandOptions, createSubCommands, createSubCommandsGroups, findCommand };
28
+ export { commandMention, findCommand };
@@ -9,19 +9,19 @@ function createEmbedFiles(embed, options) {
9
9
  files.push(new discord_js.AttachmentBuilder(url, { name: `${name}.${ext}` }));
10
10
  return `attachment://${name}.${ext}`;
11
11
  };
12
- if (thumbnail?.url) {
12
+ if (thumbnail?.url && !options?.ignore?.includes("thumbnail")) {
13
13
  const url = handle(thumbnail.url, "thumbnail", options?.extentions?.thumbnail);
14
14
  embed.setThumbnail(url);
15
15
  }
16
- if (image?.url) {
16
+ if (image?.url && !options?.ignore?.includes("image")) {
17
17
  const url = handle(image.url, "image", options?.extentions?.image);
18
18
  embed.setImage(url);
19
19
  }
20
- if (author?.icon_url) {
20
+ if (author?.icon_url && !options?.ignore?.includes("author")) {
21
21
  const url = handle(author?.icon_url, "author", options?.extentions?.author);
22
22
  embed.setAuthor({ name: author.name, iconURL: url, url: author.url });
23
23
  }
24
- if (footer?.icon_url) {
24
+ if (footer?.icon_url && !options?.ignore?.includes("footer")) {
25
25
  const url = handle(footer.icon_url, "footer", options?.extentions?.footer);
26
26
  embed.setFooter({ text: footer.text, iconURL: url });
27
27
  }
@@ -7,19 +7,19 @@ function createEmbedFiles(embed, options) {
7
7
  files.push(new AttachmentBuilder(url, { name: `${name}.${ext}` }));
8
8
  return `attachment://${name}.${ext}`;
9
9
  };
10
- if (thumbnail?.url) {
10
+ if (thumbnail?.url && !options?.ignore?.includes("thumbnail")) {
11
11
  const url = handle(thumbnail.url, "thumbnail", options?.extentions?.thumbnail);
12
12
  embed.setThumbnail(url);
13
13
  }
14
- if (image?.url) {
14
+ if (image?.url && !options?.ignore?.includes("image")) {
15
15
  const url = handle(image.url, "image", options?.extentions?.image);
16
16
  embed.setImage(url);
17
17
  }
18
- if (author?.icon_url) {
18
+ if (author?.icon_url && !options?.ignore?.includes("author")) {
19
19
  const url = handle(author?.icon_url, "author", options?.extentions?.author);
20
20
  embed.setAuthor({ name: author.name, iconURL: url, url: author.url });
21
21
  }
22
- if (footer?.icon_url) {
22
+ if (footer?.icon_url && !options?.ignore?.includes("footer")) {
23
23
  const url = handle(footer.icon_url, "footer", options?.extentions?.footer);
24
24
  embed.setFooter({ text: footer.text, iconURL: url });
25
25
  }
@@ -4,6 +4,7 @@ const discord_js = require('discord.js');
4
4
  const components = require('./components.cjs');
5
5
 
6
6
  function createModalInput(data) {
7
+ data.style ?? (data.style = discord_js.TextInputStyle.Short);
7
8
  return components.createRow(new discord_js.TextInputBuilder(data));
8
9
  }
9
10
  function createModalFields(data) {
@@ -1,7 +1,8 @@
1
- import { TextInputBuilder } from 'discord.js';
1
+ import { TextInputStyle, TextInputBuilder } from 'discord.js';
2
2
  import { createRow } from './components.mjs';
3
3
 
4
4
  function createModalInput(data) {
5
+ data.style ?? (data.style = TextInputStyle.Short);
5
6
  return createRow(new TextInputBuilder(data));
6
7
  }
7
8
  function createModalFields(data) {
package/dist/index.cjs CHANGED
@@ -35,9 +35,7 @@ exports.createLinkButton = components.createLinkButton;
35
35
  exports.createRow = components.createRow;
36
36
  exports.findChannel = channels.findChannel;
37
37
  exports.getChannelUrlInfo = channels.getChannelUrlInfo;
38
- exports.createCommandOptions = commands.createCommandOptions;
39
- exports.createSubCommands = commands.createSubCommands;
40
- exports.createSubCommandsGroups = commands.createSubCommandsGroups;
38
+ exports.commandMention = commands.commandMention;
41
39
  exports.findCommand = commands.findCommand;
42
40
  exports.createModalFields = modals.createModalFields;
43
41
  exports.createModalInput = modals.createModalInput;
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as discord_js from 'discord.js';
2
- import { GatewayIntentBits, Partials, Attachment, AttachmentBuilder, EmbedAssetData, Guild, GuildMember, User, ClientUser, ImageURLOptions, EmbedFooterData, ColorResolvable, APIEmbed, Embed, EmbedData, EmbedBuilder, AttachmentData, AnyComponentBuilder, ActionRowBuilder, ButtonBuilder, LinkButtonComponentData, ChannelType, CommandInteractionOption, Client, ApplicationCommand, ApplicationCommandOptionData, ApplicationCommandSubCommandData, ApplicationCommandSubGroupData, TextInputBuilder, ModalSubmitFields, Collection, TextInputComponent, TextInputComponentData, GuildEmoji, GuildTextBasedChannel, Message, Role } from 'discord.js';
2
+ import { GatewayIntentBits, Partials, Attachment, AttachmentBuilder, EmbedAssetData, Guild, GuildMember, User, ClientUser, ImageURLOptions, EmbedFooterData, ColorResolvable, APIEmbed, Embed, EmbedData, EmbedBuilder, AttachmentData, AnyComponentBuilder, ActionRowBuilder, ButtonBuilder, LinkButtonComponentData, ChannelType, CommandInteractionOption, Client, ApplicationCommand, TextInputBuilder, ModalSubmitFields, Collection, TextInputComponent, TextInputStyle, TextInputComponentData, GuildEmoji, GuildTextBasedChannel, Message, Role } from 'discord.js';
3
3
  export * from '@magicyan/core';
4
4
 
5
5
  declare const chars: {
@@ -154,13 +154,13 @@ declare function createEmbed<B extends boolean>(options: CreateEmbedOptions<B>):
154
154
  type ImageFileExtention = "png" | "jpg" | "gif" | "webp";
155
155
  type ImageElementProperty = "author" | "thumbnail" | "image" | "footer";
156
156
  interface CreateEmbedFilesOptions {
157
+ ignore?: ImageElementProperty[];
157
158
  extentions?: Record<ImageElementProperty, ImageFileExtention>;
158
159
  }
159
160
  /**
160
- *
161
161
  * Turns any embed image url into an attachment and returns an attachment array
162
162
  */
163
- declare function createEmbedFiles(embed: EmbedPlusBuilder, options?: CreateEmbedFilesOptions): AttachmentBuilder[];
163
+ declare function createEmbedFiles(embed: EmbedBuilder, options?: CreateEmbedFilesOptions): AttachmentBuilder[];
164
164
 
165
165
  declare function createRow<Component extends AnyComponentBuilder>(...components: Component[]): ActionRowBuilder<Component>;
166
166
  interface CreateLinkButtonData extends Omit<LinkButtonComponentData, "style" | "type"> {
@@ -205,40 +205,21 @@ declare function findCommand(guildOrClient: Guild | Client<true>): {
205
205
  guild: discord_js.GuildResolvable;
206
206
  }> | undefined;
207
207
  };
208
- type OmitCommandDataProps = "name" | "options" | "autocomplete" | "type";
209
- type CommandOption = Exclude<Omit<ApplicationCommandOptionData, "name">, ApplicationCommandSubGroupData | ApplicationCommandSubCommandData>;
210
- type CommandOptions = Record<string, CommandOption>;
211
- /**
212
- * Creates an array of command options, quickly define command options with a record where the key is the option name and the value is the definitions
213
- * @param groups
214
- * @returns
215
- */
216
- declare function createCommandOptions(options: CommandOptions): ApplicationCommandOptionData[];
217
- type SubCommand = Omit<ApplicationCommandSubCommandData, OmitCommandDataProps> & {
218
- options?: Record<string, CommandOption>;
219
- };
220
- type SubCommands = Record<string, SubCommand>;
221
- /**
222
- * Create an array of command options, quickly define subcommands with a record where the key is the subcommand name and the value is the definitions
223
- * @param groups
224
- * @returns
225
- */
226
- declare function createSubCommands(subcommands: SubCommands): ApplicationCommandSubCommandData[];
227
- type SubCommandGroup = Omit<ApplicationCommandSubGroupData, OmitCommandDataProps> & {
228
- subcommands: SubCommands;
229
- };
230
- type SubCommandGroups = Record<string, SubCommandGroup>;
231
- /**
232
- * Create an array of command options, quickly define groups of subcommands with a record where the key is the group name and the value is the definitions
233
- * @param groups
234
- * @returns
235
- */
236
- declare function createSubCommandsGroups(groups: SubCommandGroups): ApplicationCommandSubGroupData[];
208
+ interface CommandMentionData {
209
+ id: string;
210
+ name: string;
211
+ }
212
+ declare function commandMention(command: CommandMentionData, group?: string, subcommand?: string): string;
213
+ declare function commandMention(command: CommandMentionData, subcommand?: string): string;
237
214
 
238
215
  type TextInputData = Omit<TextInputComponentData, "type">;
239
- type CreateModalInputData = TextInputData;
240
- declare function createModalInput(data: CreateModalInputData): ActionRowBuilder<TextInputBuilder>;
241
- type ModalFieldsData = Record<string, Omit<TextInputData, "customId">>;
216
+ interface ModalFieldData extends Omit<TextInputData, "customId" | "style"> {
217
+ style?: TextInputStyle;
218
+ }
219
+ declare function createModalInput(data: ModalFieldData & {
220
+ customId: string;
221
+ }): ActionRowBuilder<TextInputBuilder>;
222
+ type ModalFieldsData = Record<string, ModalFieldData>;
242
223
  declare function createModalFields(data: ModalFieldsData): ActionRowBuilder<TextInputBuilder>[];
243
224
  type ModalFieldsRecord<K extends string> = Record<K, string>;
244
225
  declare function modalFieldsToRecord<K extends string = string>(fields: ModalSubmitFields | Collection<string, TextInputComponent>): ModalFieldsRecord<K>;
@@ -313,4 +294,4 @@ declare function findRole(guild: Guild): {
313
294
  */
314
295
  declare function extractMentionId(mention: string): string | null;
315
296
 
316
- export { type AnyEmbedData, CustomItents, CustomPartials, type EmbedPlusAssetData, type EmbedPlusAuthorData, EmbedPlusBuilder, type EmbedPlusColorData, type EmbedPlusData, type EmbedPlusFooterData, type EmbedPlusProperty, chars, createCommandOptions, createEmbed, createEmbedAsset, createEmbedAuthor, createEmbedFiles, createEmbedFooter, createLinkButton, createModalFields, createModalInput, createRow, createSubCommands, createSubCommandsGroups, extractMentionId, findChannel, findCommand, findEmoji, findMember, findMessage, findRole, getChannelUrlInfo, getMessageUrlInfo, modalFieldsToRecord, setMobileStatus };
297
+ export { type AnyEmbedData, CustomItents, CustomPartials, type EmbedPlusAssetData, type EmbedPlusAuthorData, EmbedPlusBuilder, type EmbedPlusColorData, type EmbedPlusData, type EmbedPlusFooterData, type EmbedPlusProperty, chars, commandMention, createEmbed, createEmbedAsset, createEmbedAuthor, createEmbedFiles, createEmbedFooter, createLinkButton, createModalFields, createModalInput, createRow, extractMentionId, findChannel, findCommand, findEmoji, findMember, findMessage, findRole, getChannelUrlInfo, getMessageUrlInfo, modalFieldsToRecord, setMobileStatus };
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as discord_js from 'discord.js';
2
- import { GatewayIntentBits, Partials, Attachment, AttachmentBuilder, EmbedAssetData, Guild, GuildMember, User, ClientUser, ImageURLOptions, EmbedFooterData, ColorResolvable, APIEmbed, Embed, EmbedData, EmbedBuilder, AttachmentData, AnyComponentBuilder, ActionRowBuilder, ButtonBuilder, LinkButtonComponentData, ChannelType, CommandInteractionOption, Client, ApplicationCommand, ApplicationCommandOptionData, ApplicationCommandSubCommandData, ApplicationCommandSubGroupData, TextInputBuilder, ModalSubmitFields, Collection, TextInputComponent, TextInputComponentData, GuildEmoji, GuildTextBasedChannel, Message, Role } from 'discord.js';
2
+ import { GatewayIntentBits, Partials, Attachment, AttachmentBuilder, EmbedAssetData, Guild, GuildMember, User, ClientUser, ImageURLOptions, EmbedFooterData, ColorResolvable, APIEmbed, Embed, EmbedData, EmbedBuilder, AttachmentData, AnyComponentBuilder, ActionRowBuilder, ButtonBuilder, LinkButtonComponentData, ChannelType, CommandInteractionOption, Client, ApplicationCommand, TextInputBuilder, ModalSubmitFields, Collection, TextInputComponent, TextInputStyle, TextInputComponentData, GuildEmoji, GuildTextBasedChannel, Message, Role } from 'discord.js';
3
3
  export * from '@magicyan/core';
4
4
 
5
5
  declare const chars: {
@@ -154,13 +154,13 @@ declare function createEmbed<B extends boolean>(options: CreateEmbedOptions<B>):
154
154
  type ImageFileExtention = "png" | "jpg" | "gif" | "webp";
155
155
  type ImageElementProperty = "author" | "thumbnail" | "image" | "footer";
156
156
  interface CreateEmbedFilesOptions {
157
+ ignore?: ImageElementProperty[];
157
158
  extentions?: Record<ImageElementProperty, ImageFileExtention>;
158
159
  }
159
160
  /**
160
- *
161
161
  * Turns any embed image url into an attachment and returns an attachment array
162
162
  */
163
- declare function createEmbedFiles(embed: EmbedPlusBuilder, options?: CreateEmbedFilesOptions): AttachmentBuilder[];
163
+ declare function createEmbedFiles(embed: EmbedBuilder, options?: CreateEmbedFilesOptions): AttachmentBuilder[];
164
164
 
165
165
  declare function createRow<Component extends AnyComponentBuilder>(...components: Component[]): ActionRowBuilder<Component>;
166
166
  interface CreateLinkButtonData extends Omit<LinkButtonComponentData, "style" | "type"> {
@@ -205,40 +205,21 @@ declare function findCommand(guildOrClient: Guild | Client<true>): {
205
205
  guild: discord_js.GuildResolvable;
206
206
  }> | undefined;
207
207
  };
208
- type OmitCommandDataProps = "name" | "options" | "autocomplete" | "type";
209
- type CommandOption = Exclude<Omit<ApplicationCommandOptionData, "name">, ApplicationCommandSubGroupData | ApplicationCommandSubCommandData>;
210
- type CommandOptions = Record<string, CommandOption>;
211
- /**
212
- * Creates an array of command options, quickly define command options with a record where the key is the option name and the value is the definitions
213
- * @param groups
214
- * @returns
215
- */
216
- declare function createCommandOptions(options: CommandOptions): ApplicationCommandOptionData[];
217
- type SubCommand = Omit<ApplicationCommandSubCommandData, OmitCommandDataProps> & {
218
- options?: Record<string, CommandOption>;
219
- };
220
- type SubCommands = Record<string, SubCommand>;
221
- /**
222
- * Create an array of command options, quickly define subcommands with a record where the key is the subcommand name and the value is the definitions
223
- * @param groups
224
- * @returns
225
- */
226
- declare function createSubCommands(subcommands: SubCommands): ApplicationCommandSubCommandData[];
227
- type SubCommandGroup = Omit<ApplicationCommandSubGroupData, OmitCommandDataProps> & {
228
- subcommands: SubCommands;
229
- };
230
- type SubCommandGroups = Record<string, SubCommandGroup>;
231
- /**
232
- * Create an array of command options, quickly define groups of subcommands with a record where the key is the group name and the value is the definitions
233
- * @param groups
234
- * @returns
235
- */
236
- declare function createSubCommandsGroups(groups: SubCommandGroups): ApplicationCommandSubGroupData[];
208
+ interface CommandMentionData {
209
+ id: string;
210
+ name: string;
211
+ }
212
+ declare function commandMention(command: CommandMentionData, group?: string, subcommand?: string): string;
213
+ declare function commandMention(command: CommandMentionData, subcommand?: string): string;
237
214
 
238
215
  type TextInputData = Omit<TextInputComponentData, "type">;
239
- type CreateModalInputData = TextInputData;
240
- declare function createModalInput(data: CreateModalInputData): ActionRowBuilder<TextInputBuilder>;
241
- type ModalFieldsData = Record<string, Omit<TextInputData, "customId">>;
216
+ interface ModalFieldData extends Omit<TextInputData, "customId" | "style"> {
217
+ style?: TextInputStyle;
218
+ }
219
+ declare function createModalInput(data: ModalFieldData & {
220
+ customId: string;
221
+ }): ActionRowBuilder<TextInputBuilder>;
222
+ type ModalFieldsData = Record<string, ModalFieldData>;
242
223
  declare function createModalFields(data: ModalFieldsData): ActionRowBuilder<TextInputBuilder>[];
243
224
  type ModalFieldsRecord<K extends string> = Record<K, string>;
244
225
  declare function modalFieldsToRecord<K extends string = string>(fields: ModalSubmitFields | Collection<string, TextInputComponent>): ModalFieldsRecord<K>;
@@ -313,4 +294,4 @@ declare function findRole(guild: Guild): {
313
294
  */
314
295
  declare function extractMentionId(mention: string): string | null;
315
296
 
316
- export { type AnyEmbedData, CustomItents, CustomPartials, type EmbedPlusAssetData, type EmbedPlusAuthorData, EmbedPlusBuilder, type EmbedPlusColorData, type EmbedPlusData, type EmbedPlusFooterData, type EmbedPlusProperty, chars, createCommandOptions, createEmbed, createEmbedAsset, createEmbedAuthor, createEmbedFiles, createEmbedFooter, createLinkButton, createModalFields, createModalInput, createRow, createSubCommands, createSubCommandsGroups, extractMentionId, findChannel, findCommand, findEmoji, findMember, findMessage, findRole, getChannelUrlInfo, getMessageUrlInfo, modalFieldsToRecord, setMobileStatus };
297
+ export { type AnyEmbedData, CustomItents, CustomPartials, type EmbedPlusAssetData, type EmbedPlusAuthorData, EmbedPlusBuilder, type EmbedPlusColorData, type EmbedPlusData, type EmbedPlusFooterData, type EmbedPlusProperty, chars, commandMention, createEmbed, createEmbedAsset, createEmbedAuthor, createEmbedFiles, createEmbedFooter, createLinkButton, createModalFields, createModalInput, createRow, extractMentionId, findChannel, findCommand, findEmoji, findMember, findMessage, findRole, getChannelUrlInfo, getMessageUrlInfo, modalFieldsToRecord, setMobileStatus };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as discord_js from 'discord.js';
2
- import { GatewayIntentBits, Partials, Attachment, AttachmentBuilder, EmbedAssetData, Guild, GuildMember, User, ClientUser, ImageURLOptions, EmbedFooterData, ColorResolvable, APIEmbed, Embed, EmbedData, EmbedBuilder, AttachmentData, AnyComponentBuilder, ActionRowBuilder, ButtonBuilder, LinkButtonComponentData, ChannelType, CommandInteractionOption, Client, ApplicationCommand, ApplicationCommandOptionData, ApplicationCommandSubCommandData, ApplicationCommandSubGroupData, TextInputBuilder, ModalSubmitFields, Collection, TextInputComponent, TextInputComponentData, GuildEmoji, GuildTextBasedChannel, Message, Role } from 'discord.js';
2
+ import { GatewayIntentBits, Partials, Attachment, AttachmentBuilder, EmbedAssetData, Guild, GuildMember, User, ClientUser, ImageURLOptions, EmbedFooterData, ColorResolvable, APIEmbed, Embed, EmbedData, EmbedBuilder, AttachmentData, AnyComponentBuilder, ActionRowBuilder, ButtonBuilder, LinkButtonComponentData, ChannelType, CommandInteractionOption, Client, ApplicationCommand, TextInputBuilder, ModalSubmitFields, Collection, TextInputComponent, TextInputStyle, TextInputComponentData, GuildEmoji, GuildTextBasedChannel, Message, Role } from 'discord.js';
3
3
  export * from '@magicyan/core';
4
4
 
5
5
  declare const chars: {
@@ -154,13 +154,13 @@ declare function createEmbed<B extends boolean>(options: CreateEmbedOptions<B>):
154
154
  type ImageFileExtention = "png" | "jpg" | "gif" | "webp";
155
155
  type ImageElementProperty = "author" | "thumbnail" | "image" | "footer";
156
156
  interface CreateEmbedFilesOptions {
157
+ ignore?: ImageElementProperty[];
157
158
  extentions?: Record<ImageElementProperty, ImageFileExtention>;
158
159
  }
159
160
  /**
160
- *
161
161
  * Turns any embed image url into an attachment and returns an attachment array
162
162
  */
163
- declare function createEmbedFiles(embed: EmbedPlusBuilder, options?: CreateEmbedFilesOptions): AttachmentBuilder[];
163
+ declare function createEmbedFiles(embed: EmbedBuilder, options?: CreateEmbedFilesOptions): AttachmentBuilder[];
164
164
 
165
165
  declare function createRow<Component extends AnyComponentBuilder>(...components: Component[]): ActionRowBuilder<Component>;
166
166
  interface CreateLinkButtonData extends Omit<LinkButtonComponentData, "style" | "type"> {
@@ -205,40 +205,21 @@ declare function findCommand(guildOrClient: Guild | Client<true>): {
205
205
  guild: discord_js.GuildResolvable;
206
206
  }> | undefined;
207
207
  };
208
- type OmitCommandDataProps = "name" | "options" | "autocomplete" | "type";
209
- type CommandOption = Exclude<Omit<ApplicationCommandOptionData, "name">, ApplicationCommandSubGroupData | ApplicationCommandSubCommandData>;
210
- type CommandOptions = Record<string, CommandOption>;
211
- /**
212
- * Creates an array of command options, quickly define command options with a record where the key is the option name and the value is the definitions
213
- * @param groups
214
- * @returns
215
- */
216
- declare function createCommandOptions(options: CommandOptions): ApplicationCommandOptionData[];
217
- type SubCommand = Omit<ApplicationCommandSubCommandData, OmitCommandDataProps> & {
218
- options?: Record<string, CommandOption>;
219
- };
220
- type SubCommands = Record<string, SubCommand>;
221
- /**
222
- * Create an array of command options, quickly define subcommands with a record where the key is the subcommand name and the value is the definitions
223
- * @param groups
224
- * @returns
225
- */
226
- declare function createSubCommands(subcommands: SubCommands): ApplicationCommandSubCommandData[];
227
- type SubCommandGroup = Omit<ApplicationCommandSubGroupData, OmitCommandDataProps> & {
228
- subcommands: SubCommands;
229
- };
230
- type SubCommandGroups = Record<string, SubCommandGroup>;
231
- /**
232
- * Create an array of command options, quickly define groups of subcommands with a record where the key is the group name and the value is the definitions
233
- * @param groups
234
- * @returns
235
- */
236
- declare function createSubCommandsGroups(groups: SubCommandGroups): ApplicationCommandSubGroupData[];
208
+ interface CommandMentionData {
209
+ id: string;
210
+ name: string;
211
+ }
212
+ declare function commandMention(command: CommandMentionData, group?: string, subcommand?: string): string;
213
+ declare function commandMention(command: CommandMentionData, subcommand?: string): string;
237
214
 
238
215
  type TextInputData = Omit<TextInputComponentData, "type">;
239
- type CreateModalInputData = TextInputData;
240
- declare function createModalInput(data: CreateModalInputData): ActionRowBuilder<TextInputBuilder>;
241
- type ModalFieldsData = Record<string, Omit<TextInputData, "customId">>;
216
+ interface ModalFieldData extends Omit<TextInputData, "customId" | "style"> {
217
+ style?: TextInputStyle;
218
+ }
219
+ declare function createModalInput(data: ModalFieldData & {
220
+ customId: string;
221
+ }): ActionRowBuilder<TextInputBuilder>;
222
+ type ModalFieldsData = Record<string, ModalFieldData>;
242
223
  declare function createModalFields(data: ModalFieldsData): ActionRowBuilder<TextInputBuilder>[];
243
224
  type ModalFieldsRecord<K extends string> = Record<K, string>;
244
225
  declare function modalFieldsToRecord<K extends string = string>(fields: ModalSubmitFields | Collection<string, TextInputComponent>): ModalFieldsRecord<K>;
@@ -313,4 +294,4 @@ declare function findRole(guild: Guild): {
313
294
  */
314
295
  declare function extractMentionId(mention: string): string | null;
315
296
 
316
- export { type AnyEmbedData, CustomItents, CustomPartials, type EmbedPlusAssetData, type EmbedPlusAuthorData, EmbedPlusBuilder, type EmbedPlusColorData, type EmbedPlusData, type EmbedPlusFooterData, type EmbedPlusProperty, chars, createCommandOptions, createEmbed, createEmbedAsset, createEmbedAuthor, createEmbedFiles, createEmbedFooter, createLinkButton, createModalFields, createModalInput, createRow, createSubCommands, createSubCommandsGroups, extractMentionId, findChannel, findCommand, findEmoji, findMember, findMessage, findRole, getChannelUrlInfo, getMessageUrlInfo, modalFieldsToRecord, setMobileStatus };
297
+ export { type AnyEmbedData, CustomItents, CustomPartials, type EmbedPlusAssetData, type EmbedPlusAuthorData, EmbedPlusBuilder, type EmbedPlusColorData, type EmbedPlusData, type EmbedPlusFooterData, type EmbedPlusProperty, chars, commandMention, createEmbed, createEmbedAsset, createEmbedAuthor, createEmbedFiles, createEmbedFooter, createLinkButton, createModalFields, createModalInput, createRow, extractMentionId, findChannel, findCommand, findEmoji, findMember, findMessage, findRole, getChannelUrlInfo, getMessageUrlInfo, modalFieldsToRecord, setMobileStatus };
package/dist/index.mjs CHANGED
@@ -8,7 +8,7 @@ export { createEmbedFooter } from './functions/embeds/footer.mjs';
8
8
  export { createEmbedFiles } from './functions/embeds/files.mjs';
9
9
  export { createLinkButton, createRow } from './functions/components.mjs';
10
10
  export { findChannel, getChannelUrlInfo } from './functions/channels.mjs';
11
- export { createCommandOptions, createSubCommands, createSubCommandsGroups, findCommand } from './functions/commands.mjs';
11
+ export { commandMention, findCommand } from './functions/commands.mjs';
12
12
  export { createModalFields, createModalInput, modalFieldsToRecord } from './functions/modals.mjs';
13
13
  export { findEmoji } from './functions/emojis.mjs';
14
14
  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.33",
3
+ "version": "1.0.35",
4
4
  "description": "Simple functions to facilitate discord bot development",
5
5
  "license": "MIT",
6
6
  "type": "module",