DiscordLua
discorddiscord
v1.2.4
Install

Formatters

Class
On this page

Formatters is a DiscordLua class representing a Discord resource. Obtain it from a manager, an event payload, or the constructor when one is documented below.

class Module 1.2.4 Source

Methods

Formatters.applicationDirectory()

# static

Performs application directory on this Formatters. Call it from bot code when you need that operation on the current object.

Signature

Formatters.applicationDirectory(applicationId, skuId)

Parameters

NameTypeRequiredBehavior
applicationId string required Snowflake id string.
skuId string required Snowflake id string.

Returns

any.

Example

lua
local discord = require("discord")
-- object is a Formatters
Formatters.applicationDirectory("123", "123")

Formatters.blockQuote()

# static

Performs block quote on this Formatters. Call it from bot code when you need that operation on the current object.

Signature

Formatters.blockQuote(text)

Parameters

NameTypeRequiredBehavior
text any required Passed through to the implementation as written.

Returns

any.

Example

lua
local discord = require("discord")
-- object is a Formatters
Formatters.blockQuote(text)

Formatters.bold()

# static

Performs bold on this Formatters. Call it from bot code when you need that operation on the current object.

Signature

Formatters.bold(text)

Parameters

NameTypeRequiredBehavior
text any required Passed through to the implementation as written.

Returns

any.

Example

lua
local discord = require("discord")
-- object is a Formatters
Formatters.bold(text)

Formatters.channelMention()

# static

Performs channel mention on this Formatters. Call it from bot code when you need that operation on the current object.

Signature

Formatters.channelMention(id)

Parameters

NameTypeRequiredBehavior
id string required Snowflake id string.

Returns

any.

Example

lua
local discord = require("discord")
-- object is a Formatters
Formatters.channelMention("123")

Formatters.chatInputApplicationCommandMention()

# static

Performs chat input application command mention on this Formatters. Call it from bot code when you need that operation on the current object.

Signature

Formatters.chatInputApplicationCommandMention(name, a, b, c)

Parameters

NameTypeRequiredBehavior
name any required Passed through to the implementation as written.
a any required Passed through to the implementation as written.
b any required Passed through to the implementation as written.
c any required Passed through to the implementation as written.

Returns

any.

Example

lua
local discord = require("discord")
-- object is a Formatters
Formatters.chatInputApplicationCommandMention(name, a, b, c)

Formatters.codeBlock()

# static

Performs code block on this Formatters. Call it from bot code when you need that operation on the current object.

Signature

Formatters.codeBlock(languageOrText, text)

Parameters

NameTypeRequiredBehavior
languageOrText any required Passed through to the implementation as written.
text any required Passed through to the implementation as written.

Returns

any.

Example

lua
local discord = require("discord")
-- object is a Formatters
Formatters.codeBlock(languageOrText, text)

Formatters.emoji()

# static

Performs emoji on this Formatters. Call it from bot code when you need that operation on the current object.

Signature

Formatters.emoji(name, id, animated)

Parameters

NameTypeRequiredBehavior
name any required Passed through to the implementation as written.
id string required Snowflake id string.
animated any required Passed through to the implementation as written.

Returns

any.

Example

lua
local discord = require("discord")
-- object is a Formatters
Formatters.emoji(name, "123", animated)

Formatters.escapeBold()

# static

Performs escape bold on this Formatters. Call it from bot code when you need that operation on the current object.

Signature

Formatters.escapeBold(text)

Parameters

NameTypeRequiredBehavior
text any required Passed through to the implementation as written.

Returns

any.

Example

lua
local discord = require("discord")
-- object is a Formatters
Formatters.escapeBold(text)

Formatters.escapeBulletedList()

# static

Performs escape bulleted list on this Formatters. Call it from bot code when you need that operation on the current object.

Signature

Formatters.escapeBulletedList(text)

Parameters

NameTypeRequiredBehavior
text any required Passed through to the implementation as written.

Returns

any.

Example

lua
local discord = require("discord")
-- object is a Formatters
Formatters.escapeBulletedList(text)

Formatters.escapeCodeBlock()

# static

Performs escape code block on this Formatters. Call it from bot code when you need that operation on the current object.

Signature

Formatters.escapeCodeBlock(text)

Parameters

NameTypeRequiredBehavior
text any required Passed through to the implementation as written.

Returns

any.

Example

lua
local discord = require("discord")
-- object is a Formatters
Formatters.escapeCodeBlock(text)

Formatters.escapeHeading()

# static

Performs escape heading on this Formatters. Call it from bot code when you need that operation on the current object.

Signature

Formatters.escapeHeading(text)

Parameters

NameTypeRequiredBehavior
text any required Passed through to the implementation as written.

Returns

any.

Example

lua
local discord = require("discord")
-- object is a Formatters
Formatters.escapeHeading(text)

Formatters.escapeInlineCode()

# static

Performs escape inline code on this Formatters. Call it from bot code when you need that operation on the current object.

Signature

Formatters.escapeInlineCode(text)

Parameters

NameTypeRequiredBehavior
text any required Passed through to the implementation as written.

Returns

any.

Example

lua
local discord = require("discord")
-- object is a Formatters
Formatters.escapeInlineCode(text)

Formatters.escapeItalic()

# static

Performs escape italic on this Formatters. Call it from bot code when you need that operation on the current object.

Signature

Formatters.escapeItalic(text)

Parameters

NameTypeRequiredBehavior
text any required Passed through to the implementation as written.

Returns

any.

Example

lua
local discord = require("discord")
-- object is a Formatters
Formatters.escapeItalic(text)

Formatters.escapeMarkdown()

# static

Performs escape markdown on this Formatters. Call it from bot code when you need that operation on the current object.

Signature

Formatters.escapeMarkdown(text)

Parameters

NameTypeRequiredBehavior
text any required Passed through to the implementation as written.

Returns

any.

Example

lua
local discord = require("discord")
-- object is a Formatters
Formatters.escapeMarkdown(text)

Formatters.escapeNumberedList()

# static

Performs escape numbered list on this Formatters. Call it from bot code when you need that operation on the current object.

Signature

Formatters.escapeNumberedList(text)

Parameters

NameTypeRequiredBehavior
text any required Passed through to the implementation as written.

Returns

any.

Example

lua
local discord = require("discord")
-- object is a Formatters
Formatters.escapeNumberedList(text)

Formatters.escapeSpoiler()

# static

Performs escape spoiler on this Formatters. Call it from bot code when you need that operation on the current object.

Signature

Formatters.escapeSpoiler(text)

Parameters

NameTypeRequiredBehavior
text any required Passed through to the implementation as written.

Returns

any.

Example

lua
local discord = require("discord")
-- object is a Formatters
Formatters.escapeSpoiler(text)

Formatters.escapeStrikethrough()

# static

Performs escape strikethrough on this Formatters. Call it from bot code when you need that operation on the current object.

Signature

Formatters.escapeStrikethrough(text)

Parameters

NameTypeRequiredBehavior
text any required Passed through to the implementation as written.

Returns

any.

Example

lua
local discord = require("discord")
-- object is a Formatters
Formatters.escapeStrikethrough(text)

Formatters.escapeUnderline()

# static

Performs escape underline on this Formatters. Call it from bot code when you need that operation on the current object.

Signature

Formatters.escapeUnderline(text)

Parameters

NameTypeRequiredBehavior
text any required Passed through to the implementation as written.

Returns

any.

Example

lua
local discord = require("discord")
-- object is a Formatters
Formatters.escapeUnderline(text)

Formatters.formatEmoji()

# static

Performs format emoji on this Formatters. Call it from bot code when you need that operation on the current object.

Signature

Formatters.formatEmoji(name, id, animated)

Parameters

NameTypeRequiredBehavior
name any required Passed through to the implementation as written.
id string required Snowflake id string.
animated any required Passed through to the implementation as written.

Returns

any.

Example

lua
local discord = require("discord")
-- object is a Formatters
Formatters.formatEmoji(name, "123", animated)

Formatters.heading()

# static

Performs heading on this Formatters. Call it from bot code when you need that operation on the current object.

Signature

Formatters.heading(text, level)

Parameters

NameTypeRequiredBehavior
text any required Passed through to the implementation as written.
level any required Passed through to the implementation as written.

Returns

any.

Example

lua
local discord = require("discord")
-- object is a Formatters
Formatters.heading(text, level)

Formatters.hideLinkEmbed()

# static

Performs hide link embed on this Formatters. Call it from bot code when you need that operation on the current object.

Signature

Formatters.hideLinkEmbed(url)

Parameters

NameTypeRequiredBehavior
url any required Passed through to the implementation as written.

Returns

any.

Example

lua
local discord = require("discord")
-- object is a Formatters
Formatters.hideLinkEmbed(url)

Formatters.inlineCode()

# static

Predicate that returns whether this Formatters matches inlineCode. Use it to branch before calling type-specific methods.

Signature

Formatters.inlineCode(text)

Parameters

NameTypeRequiredBehavior
text any required Passed through to the implementation as written.

Returns

any.

Example

lua
local discord = require("discord")
-- object is a Formatters
Formatters.inlineCode(text)

Formatters.italic()

# static

Performs italic on this Formatters. Call it from bot code when you need that operation on the current object.

Signature

Formatters.italic(text)

Parameters

NameTypeRequiredBehavior
text any required Passed through to the implementation as written.

Returns

any.

Example

lua
local discord = require("discord")
-- object is a Formatters
Formatters.italic(text)

Formatters.list()

# static

Performs list on this Formatters. Call it from bot code when you need that operation on the current object.

Signature

Formatters.list(items, options)

Parameters

NameTypeRequiredBehavior
items number required Duration in milliseconds.
options table optional Lua option table. Field names match the corresponding DiscordLua option type when one exists.

Returns

any.

Example

lua
local discord = require("discord")
-- object is a Formatters
Formatters.list(items, {})

Formatters.orderedList()

# static

Performs ordered list on this Formatters. Call it from bot code when you need that operation on the current object.

Signature

Formatters.orderedList(items, startNumber)

Parameters

NameTypeRequiredBehavior
items number required Duration in milliseconds.
startNumber any required Passed through to the implementation as written.

Returns

any.

Example

lua
local discord = require("discord")
-- object is a Formatters
Formatters.orderedList(items, startNumber)

Formatters.quote()

# static

Performs quote on this Formatters. Call it from bot code when you need that operation on the current object.

Signature

Formatters.quote(text)

Parameters

NameTypeRequiredBehavior
text any required Passed through to the implementation as written.

Returns

any.

Example

lua
local discord = require("discord")
-- object is a Formatters
Formatters.quote(text)

Formatters.roleMention()

# static

Performs role mention on this Formatters. Call it from bot code when you need that operation on the current object.

Signature

Formatters.roleMention(id)

Parameters

NameTypeRequiredBehavior
id string required Snowflake id string.

Returns

any.

Example

lua
local discord = require("discord")
-- object is a Formatters
Formatters.roleMention("123")

Formatters.slashCommandMention()

# static

Performs slash command mention on this Formatters. Call it from bot code when you need that operation on the current object.

Signature

Formatters.slashCommandMention(name, commandId)

Parameters

NameTypeRequiredBehavior
name any required Passed through to the implementation as written.
commandId string required Snowflake id string.

Returns

any.

Example

lua
local discord = require("discord")
-- object is a Formatters
Formatters.slashCommandMention(name, "123")

Formatters.spoiler()

# static

Performs spoiler on this Formatters. Call it from bot code when you need that operation on the current object.

Signature

Formatters.spoiler(text)

Parameters

NameTypeRequiredBehavior
text any required Passed through to the implementation as written.

Returns

any.

Example

lua
local discord = require("discord")
-- object is a Formatters
Formatters.spoiler(text)

Formatters.strikethrough()

# static

Performs strikethrough on this Formatters. Call it from bot code when you need that operation on the current object.

Signature

Formatters.strikethrough(text)

Parameters

NameTypeRequiredBehavior
text any required Passed through to the implementation as written.

Returns

any.

Example

lua
local discord = require("discord")
-- object is a Formatters
Formatters.strikethrough(text)

Formatters.subtext()

# static

Performs subtext on this Formatters. Call it from bot code when you need that operation on the current object.

Signature

Formatters.subtext(text)

Parameters

NameTypeRequiredBehavior
text any required Passed through to the implementation as written.

Returns

any.

Example

lua
local discord = require("discord")
-- object is a Formatters
Formatters.subtext(text)

Formatters.time()

# static

Performs time on this Formatters. Call it from bot code when you need that operation on the current object.

Signature

Formatters.time(seconds, style)

Parameters

NameTypeRequiredBehavior
seconds any required Passed through to the implementation as written.
style any optional Passed through to the implementation as written.

Returns

any.

Example

lua
local discord = require("discord")
-- object is a Formatters
Formatters.time(seconds, style)

Formatters.underline()

# static

Performs underline on this Formatters. Call it from bot code when you need that operation on the current object.

Signature

Formatters.underline(text)

Parameters

NameTypeRequiredBehavior
text any required Passed through to the implementation as written.

Returns

any.

Example

lua
local discord = require("discord")
-- object is a Formatters
Formatters.underline(text)

Formatters.unorderedList()

# static

Performs unordered list on this Formatters. Call it from bot code when you need that operation on the current object.

Signature

Formatters.unorderedList(items)

Parameters

NameTypeRequiredBehavior
items number required Duration in milliseconds.

Returns

any.

Example

lua
local discord = require("discord")
-- object is a Formatters
Formatters.unorderedList(items)

Formatters.userMention()

# static

Performs user mention on this Formatters. Call it from bot code when you need that operation on the current object.

Signature

Formatters.userMention(id)

Parameters

NameTypeRequiredBehavior
id string required Snowflake id string.

Returns

any.

Example

lua
local discord = require("discord")
-- object is a Formatters
Formatters.userMention("123")

Static members

  • Formatters.Faces
  • Formatters.HeadingLevel
  • Formatters.TimestampStyles
  • Formatters.timestamp
  • Formatters.underscore

Examples

Obtain this object from a manager, wrap helper, or event payload — it is not constructed directly in typical bot code.

ActionRow · Activity · ActivityInstance · ActivityLocation · AnonymousGuild · ApplicationCommand · ApplicationRoleConnectionMetadata · Attachment

Version: discord 1.2.4 · runtime 1.0.0

Search Ctrl K Navigate Open Esc