mirror of
https://github.com/discordjs/discord.js.git
synced 2026-09-17 08:47:27 +00:00
feat(formatters): add gameProfileMention() (#11612)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
@@ -10,6 +10,7 @@ import {
|
||||
codeBlock,
|
||||
Faces,
|
||||
formatEmoji,
|
||||
gameProfileMention,
|
||||
heading,
|
||||
HeadingLevel,
|
||||
hideLinkEmbed,
|
||||
@@ -153,6 +154,12 @@ describe('Message formatters', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('gameProfileMention', () => {
|
||||
test('GIVEN gameId THEN returns "<@$[gameId]>"', () => {
|
||||
expect<'<@$1402418491272986635>'>(gameProfileMention('1402418491272986635')).toEqual('<@$1402418491272986635>');
|
||||
});
|
||||
});
|
||||
|
||||
describe('chatInputApplicationCommandMention', () => {
|
||||
test('GIVEN commandId and commandName THEN returns "</[commandName]:[commandId]>"', () => {
|
||||
expect(chatInputApplicationCommandMention('815434166602170409', 'airhorn')).toEqual(
|
||||
|
||||
@@ -223,6 +223,16 @@ export function linkedRoleMention<RoleId extends Snowflake>(roleId: RoleId): `<i
|
||||
return `<id:linked-roles:${roleId}>`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats a game id into a game profile mention.
|
||||
*
|
||||
* @typeParam GameId - This is inferred by the supplied game id
|
||||
* @param gameId - The game id to format
|
||||
*/
|
||||
export function gameProfileMention<GameId extends Snowflake>(gameId: GameId): `<@$${GameId}>` {
|
||||
return `<@$${gameId}>`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats an application command name and id into an application command mention.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user