Preview environment

class Formatters

extends

null
deprecated
export class Formatters extends null

Contains various Discord-specific functions for formatting messages.

deprecatedstatic
blockQuote : typeof blockQuote

deprecatedstatic
bold : typeof bold

deprecatedstatic
channelMention : typeof channelMention

deprecatedstatic
codeBlock : typeof codeBlock

deprecatedstatic
formatEmoji : typeof formatEmoji

deprecatedstatic
hideLinkEmbed : typeof hideLinkEmbed

deprecatedstatic
inlineCode : typeof inlineCode

deprecatedstatic
italic : typeof italic

deprecatedstatic
quote : typeof quote

deprecatedstatic
roleMention : typeof roleMention

deprecatedstatic
spoiler : typeof spoiler

deprecatedstatic
strikethrough : typeof strikethrough

deprecatedstatic
time : typeof time

deprecatedstatic
TimestampStyles : typeof TimestampStyles

The message formatting timestamp [styles](https://discord.com/developers/docs/reference#message-formatting-timestamp-styles) supported by Discord.

deprecatedstatic
underscore : typeof underscore

deprecatedstatic
userMention : typeof userMention

deprecatedstatic
blockQuote(
content: string
) : string

Formats the content into a block quote. This needs to be at the start of the line for Discord to format it.

deprecatedstatic
bold(
content: string
) : string

Formats the content into bold text.

deprecatedstatic
channelMention(
channelId: Snowflake
) : string

Formats a channel id into a channel mention.

deprecatedstatic
codeBlock(
contentOrLanguage: string
content?: string
) : string

Wraps the content inside a code block with an optional language.

deprecatedstatic
formatEmoji(
emojiId: string
animated?: boolean
) : string

Formats an emoji id into a fully qualified emoji identifier.

deprecatedstatic
hideLinkEmbed(
content: string
) : string

Wraps the URL into <>, which stops it from embedding.

Formats the content and the URL into a masked URL with an optional title.

deprecatedstatic
inlineCode(
content: string
) : string

Wraps the content inside `backticks`, which formats it as inline code.

deprecatedstatic
italic(
content: string
) : string

Formats the content into italic text.

deprecatedstatic
quote(
content: string
) : string

Formats the content into a quote. This needs to be at the start of the line for Discord to format it.

deprecatedstatic
roleMention(
roleId: Snowflake
) : string

Formats a role id into a role mention.

deprecatedstatic
spoiler(
content: string
) : string

Formats the content into spoiler text.

deprecatedstatic
strikethrough(
content: string
) : string

Formats the content into strike-through text.

deprecatedstatic
time(
date?: number | Date
style?: TimestampStylesString
) : string

Formats a date into a short date-time string.

deprecatedstatic
underscore(
content: string
) : string

Formats the content into underscored text.

deprecatedstatic
userMention(
userId: Snowflake
) : string

Formats a user id into a user mention.