mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
feat: add subtext formatter (#10400)
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
This commit is contained in:
@@ -23,6 +23,7 @@ import {
|
||||
roleMention,
|
||||
spoiler,
|
||||
strikethrough,
|
||||
subtext,
|
||||
time,
|
||||
TimestampStyles,
|
||||
underline,
|
||||
@@ -277,6 +278,12 @@ describe('Message formatters', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('subtext', () => {
|
||||
test('GIVEN "discord.js" THEN returns "-# discord.js"', () => {
|
||||
expect<'-# discord.js'>(subtext('discord.js')).toEqual('-# discord.js');
|
||||
});
|
||||
});
|
||||
|
||||
describe('time', () => {
|
||||
test('GIVEN no arguments THEN returns "<t:${bigint}>"', () => {
|
||||
vitest.useFakeTimers();
|
||||
|
||||
@@ -569,6 +569,16 @@ export function unorderedList(list: RecursiveArray<string>): string {
|
||||
return listCallback(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats the content into a subtext.
|
||||
*
|
||||
* @typeParam Content - This is inferred by the supplied content
|
||||
* @param content - The content to wrap
|
||||
*/
|
||||
export function subtext<Content extends string>(content: Content): `-# ${Content}` {
|
||||
return `-# ${content}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats a date into a short date-time string.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user