Formatters
ClassOn 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.
Methods
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
| Name | Type | Required | Behavior |
|---|---|---|---|
applicationId |
string |
required | Snowflake id string. |
skuId |
string |
required | Snowflake id string. |
Returns
any.
Example
local discord = require("discord")
-- object is a Formatters
Formatters.applicationDirectory("123", "123")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
| Name | Type | Required | Behavior |
|---|---|---|---|
text |
any |
required | Passed through to the implementation as written. |
Returns
any.
Example
local discord = require("discord")
-- object is a Formatters
Formatters.blockQuote(text)Performs bold on this Formatters. Call it from bot code when you need that operation on the current object.
Signature
Formatters.bold(text) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
text |
any |
required | Passed through to the implementation as written. |
Returns
any.
Example
local discord = require("discord")
-- object is a Formatters
Formatters.bold(text)Performs channel link on this Formatters. Call it from bot code when you need that operation on the current object.
Signature
Formatters.channelLink(channelId, guildId) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
channelId |
string |
required | Snowflake id string. |
guildId |
string |
required | Snowflake id string. |
Returns
any.
Example
local discord = require("discord")
-- object is a Formatters
Formatters.channelLink("123", "123")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
| Name | Type | Required | Behavior |
|---|---|---|---|
id |
string |
required | Snowflake id string. |
Returns
any.
Example
local discord = require("discord")
-- object is a Formatters
Formatters.channelMention("123")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
| Name | Type | Required | Behavior |
|---|---|---|---|
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
local discord = require("discord")
-- object is a Formatters
Formatters.chatInputApplicationCommandMention(name, a, b, c)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
| Name | Type | Required | Behavior |
|---|---|---|---|
languageOrText |
any |
required | Passed through to the implementation as written. |
text |
any |
required | Passed through to the implementation as written. |
Returns
any.
Example
local discord = require("discord")
-- object is a Formatters
Formatters.codeBlock(languageOrText, text)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
| Name | Type | Required | Behavior |
|---|---|---|---|
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
local discord = require("discord")
-- object is a Formatters
Formatters.emoji(name, "123", animated)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
| Name | Type | Required | Behavior |
|---|---|---|---|
text |
any |
required | Passed through to the implementation as written. |
Returns
any.
Example
local discord = require("discord")
-- object is a Formatters
Formatters.escapeBold(text)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
| Name | Type | Required | Behavior |
|---|---|---|---|
text |
any |
required | Passed through to the implementation as written. |
Returns
any.
Example
local discord = require("discord")
-- object is a Formatters
Formatters.escapeBulletedList(text)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
| Name | Type | Required | Behavior |
|---|---|---|---|
text |
any |
required | Passed through to the implementation as written. |
Returns
any.
Example
local discord = require("discord")
-- object is a Formatters
Formatters.escapeCodeBlock(text)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
| Name | Type | Required | Behavior |
|---|---|---|---|
text |
any |
required | Passed through to the implementation as written. |
Returns
any.
Example
local discord = require("discord")
-- object is a Formatters
Formatters.escapeHeading(text)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
| Name | Type | Required | Behavior |
|---|---|---|---|
text |
any |
required | Passed through to the implementation as written. |
Returns
any.
Example
local discord = require("discord")
-- object is a Formatters
Formatters.escapeInlineCode(text)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
| Name | Type | Required | Behavior |
|---|---|---|---|
text |
any |
required | Passed through to the implementation as written. |
Returns
any.
Example
local discord = require("discord")
-- object is a Formatters
Formatters.escapeItalic(text)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
| Name | Type | Required | Behavior |
|---|---|---|---|
text |
any |
required | Passed through to the implementation as written. |
Returns
any.
Example
local discord = require("discord")
-- object is a Formatters
Formatters.escapeMarkdown(text)Performs escape masked link on this Formatters. Call it from bot code when you need that operation on the current object.
Signature
Formatters.escapeMaskedLink(text) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
text |
any |
required | Passed through to the implementation as written. |
Returns
any.
Example
local discord = require("discord")
-- object is a Formatters
Formatters.escapeMaskedLink(text)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
| Name | Type | Required | Behavior |
|---|---|---|---|
text |
any |
required | Passed through to the implementation as written. |
Returns
any.
Example
local discord = require("discord")
-- object is a Formatters
Formatters.escapeNumberedList(text)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
| Name | Type | Required | Behavior |
|---|---|---|---|
text |
any |
required | Passed through to the implementation as written. |
Returns
any.
Example
local discord = require("discord")
-- object is a Formatters
Formatters.escapeSpoiler(text)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
| Name | Type | Required | Behavior |
|---|---|---|---|
text |
any |
required | Passed through to the implementation as written. |
Returns
any.
Example
local discord = require("discord")
-- object is a Formatters
Formatters.escapeStrikethrough(text)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
| Name | Type | Required | Behavior |
|---|---|---|---|
text |
any |
required | Passed through to the implementation as written. |
Returns
any.
Example
local discord = require("discord")
-- object is a Formatters
Formatters.escapeUnderline(text)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
| Name | Type | Required | Behavior |
|---|---|---|---|
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
local discord = require("discord")
-- object is a Formatters
Formatters.formatEmoji(name, "123", animated)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
| Name | Type | Required | Behavior |
|---|---|---|---|
text |
any |
required | Passed through to the implementation as written. |
level |
any |
required | Passed through to the implementation as written. |
Returns
any.
Example
local discord = require("discord")
-- object is a Formatters
Formatters.heading(text, level)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
| Name | Type | Required | Behavior |
|---|---|---|---|
url |
any |
required | Passed through to the implementation as written. |
Returns
any.
Example
local discord = require("discord")
-- object is a Formatters
Formatters.hideLinkEmbed(url)Performs hyperlink on this Formatters. Call it from bot code when you need that operation on the current object.
Signature
Formatters.hyperlink(content, url) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
content |
string | table |
required | Message content string, or a send/reply payload table. |
url |
any |
required | Passed through to the implementation as written. |
Returns
any.
Example
local discord = require("discord")
-- object is a Formatters
Formatters.hyperlink("Hello", url)Predicate that returns whether this Formatters matches inlineCode. Use it to branch before calling type-specific methods.
Signature
Formatters.inlineCode(text) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
text |
any |
required | Passed through to the implementation as written. |
Returns
any.
Example
local discord = require("discord")
-- object is a Formatters
Formatters.inlineCode(text)Performs italic on this Formatters. Call it from bot code when you need that operation on the current object.
Signature
Formatters.italic(text) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
text |
any |
required | Passed through to the implementation as written. |
Returns
any.
Example
local discord = require("discord")
-- object is a Formatters
Formatters.italic(text)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
| Name | Type | Required | Behavior |
|---|---|---|---|
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
local discord = require("discord")
-- object is a Formatters
Formatters.list(items, {})Performs message link on this Formatters. Call it from bot code when you need that operation on the current object.
Signature
Formatters.messageLink(channelId, messageId, guildId) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
channelId |
string |
required | Snowflake id string. |
messageId |
string |
required | Snowflake id string. |
guildId |
string |
required | Snowflake id string. |
Returns
any.
Example
local discord = require("discord")
-- object is a Formatters
Formatters.messageLink("123", "123", "123")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
| Name | Type | Required | Behavior |
|---|---|---|---|
items |
number |
required | Duration in milliseconds. |
startNumber |
any |
required | Passed through to the implementation as written. |
Returns
any.
Example
local discord = require("discord")
-- object is a Formatters
Formatters.orderedList(items, startNumber)Performs quote on this Formatters. Call it from bot code when you need that operation on the current object.
Signature
Formatters.quote(text) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
text |
any |
required | Passed through to the implementation as written. |
Returns
any.
Example
local discord = require("discord")
-- object is a Formatters
Formatters.quote(text)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
| Name | Type | Required | Behavior |
|---|---|---|---|
id |
string |
required | Snowflake id string. |
Returns
any.
Example
local discord = require("discord")
-- object is a Formatters
Formatters.roleMention("123")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
| Name | Type | Required | Behavior |
|---|---|---|---|
name |
any |
required | Passed through to the implementation as written. |
commandId |
string |
required | Snowflake id string. |
Returns
any.
Example
local discord = require("discord")
-- object is a Formatters
Formatters.slashCommandMention(name, "123")Performs spoiler on this Formatters. Call it from bot code when you need that operation on the current object.
Signature
Formatters.spoiler(text) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
text |
any |
required | Passed through to the implementation as written. |
Returns
any.
Example
local discord = require("discord")
-- object is a Formatters
Formatters.spoiler(text)Performs strikethrough on this Formatters. Call it from bot code when you need that operation on the current object.
Signature
Formatters.strikethrough(text) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
text |
any |
required | Passed through to the implementation as written. |
Returns
any.
Example
local discord = require("discord")
-- object is a Formatters
Formatters.strikethrough(text)Performs subtext on this Formatters. Call it from bot code when you need that operation on the current object.
Signature
Formatters.subtext(text) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
text |
any |
required | Passed through to the implementation as written. |
Returns
any.
Example
local discord = require("discord")
-- object is a Formatters
Formatters.subtext(text)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
| Name | Type | Required | Behavior |
|---|---|---|---|
seconds |
any |
required | Passed through to the implementation as written. |
style |
any |
optional | Passed through to the implementation as written. |
Returns
any.
Example
local discord = require("discord")
-- object is a Formatters
Formatters.time(seconds, style)Performs underline on this Formatters. Call it from bot code when you need that operation on the current object.
Signature
Formatters.underline(text) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
text |
any |
required | Passed through to the implementation as written. |
Returns
any.
Example
local discord = require("discord")
-- object is a Formatters
Formatters.underline(text)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
| Name | Type | Required | Behavior |
|---|---|---|---|
items |
number |
required | Duration in milliseconds. |
Returns
any.
Example
local discord = require("discord")
-- object is a Formatters
Formatters.unorderedList(items)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
| Name | Type | Required | Behavior |
|---|---|---|---|
id |
string |
required | Snowflake id string. |
Returns
any.
Example
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.
Related APIs
ActionRow · Activity · ActivityInstance · ActivityLocation · AnonymousGuild · ApplicationCommand · ApplicationRoleConnectionMetadata · Attachment
Version: discord 1.2.4 · runtime 1.0.0