mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-15 11:03:30 +01:00
feat: backport chatInputApplicationCommandMention (#9245)
feat: chatInputApplicationCommandMention formatter
This commit is contained in:
@@ -52,6 +52,36 @@ Formatters.bold = bold;
|
|||||||
*/
|
*/
|
||||||
Formatters.channelMention = channelMention;
|
Formatters.channelMention = channelMention;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Formats an application command name, subcommand group name, subcommand name, and ID
|
||||||
|
* into an application command mention
|
||||||
|
* @method chatInputApplicationCommandMention
|
||||||
|
* @memberof Formatters
|
||||||
|
* @param {string} commandName The name of the application command
|
||||||
|
* @param {string|Snowflake} subcommandGroupOrSubOrId
|
||||||
|
* The subcommand group name, subcommand name, or application command id
|
||||||
|
* @param {?(string|Snowflake)} [subcommandNameOrId] The subcommand name or application command id
|
||||||
|
* @param {?Snowflake} [commandId] The id of the application command
|
||||||
|
* @returns {string}
|
||||||
|
* @static
|
||||||
|
*/
|
||||||
|
Formatters.chatInputApplicationCommandMention = function chatInputApplicationCommandMention(
|
||||||
|
commandName,
|
||||||
|
subcommandGroupOrSubOrId,
|
||||||
|
subcommandNameOrId,
|
||||||
|
commandId,
|
||||||
|
) {
|
||||||
|
if (typeof commandId !== 'undefined') {
|
||||||
|
return `</${commandName} ${subcommandGroupOrSubOrId} ${subcommandNameOrId}:${commandId}>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof subcommandNameOrId !== 'undefined') {
|
||||||
|
return `</${commandName} ${subcommandGroupOrSubOrId}:${subcommandNameOrId}>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
return `</${commandName}:${subcommandGroupOrSubOrId}>`;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wraps the content inside a code block with an optional language.
|
* Wraps the content inside a code block with an optional language.
|
||||||
* @method codeBlock
|
* @method codeBlock
|
||||||
|
|||||||
4
typings/index.d.ts
vendored
4
typings/index.d.ts
vendored
@@ -2775,6 +2775,10 @@ export class Formatters extends null {
|
|||||||
public static blockQuote: typeof blockQuote;
|
public static blockQuote: typeof blockQuote;
|
||||||
public static bold: typeof bold;
|
public static bold: typeof bold;
|
||||||
public static channelMention: typeof channelMention;
|
public static channelMention: typeof channelMention;
|
||||||
|
public static chatInputApplicationCommandMention
|
||||||
|
<N extends string, G extends string, S extends string, I extends Snowflake>(commandName: N, subcommandGroupName: G, subcommandName: S, commandId: I): `</${N} ${G} ${S}:${I}>`;
|
||||||
|
public static chatInputApplicationCommandMention<N extends string, S extends string, I extends Snowflake>(commandName: N, subcommandName: S, commandId: I): `</${N} ${S}:${I}>`;
|
||||||
|
public static chatInputApplicationCommandMention<N extends string, I extends Snowflake>(commandName: N, commandId: I): `</${N}:${I}>`;
|
||||||
public static codeBlock: typeof codeBlock;
|
public static codeBlock: typeof codeBlock;
|
||||||
public static formatEmoji: typeof formatEmoji;
|
public static formatEmoji: typeof formatEmoji;
|
||||||
public static hideLinkEmbed: typeof hideLinkEmbed;
|
public static hideLinkEmbed: typeof hideLinkEmbed;
|
||||||
|
|||||||
Reference in New Issue
Block a user