discljord.formatting
Contains utility functions to help with Discord message formatting.
block-quote
(block-quote text)
Returns the given text in a blockquote, with new lines pre- and appended.
I.e.:
> text
bold
(bold text)
Returns the given text in **bold**.
channel-mention
Regex pattern that matches text channel mentions.
Captures the channel id in its first capture group labelled "id".
code
(code text)
Wraps the given text in an `inline code block`.
code-block
(code-block lang text)
(code-block text)
Puts the given text in a codeblock with corresponding syntax highlighting, if a language is given.
I.e.:
```lang
text
```
embed-link
(embed-link text url title)
(embed-link text url)
Creates an inline-style link with an optional title.
I.e.: [text](url "title") or [text](url).
Can only be used in embeds, not in regular messages.
emoji-mention
Regex pattern that matches custom emoji mentions.
(Optionally) captures the `a` prefix in its first capture group labelled "animated"
to indicate if the emoji is animated; Captures the emoji name in its second capture group labelled
"name" and the id in a last capture group labelled "id".
full-block-quote
The full block quote (`>>>`).
Everything that follows this separator is shown as a block quote in Discord messages.
italics
(italics text)
Returns the given text as *italics*.
mention-channel
(mention-channel channel)
Takes a text channel object or id and returns a mention of that channel for use in messages.
mention-emoji
(mention-emoji emoji)
Takes an emoji object or a custom emoji id and returns a mention of that emoji for use in messages.
A provided emoji object may also represent a regular unicode emoji with just a name,
in which case that name will be returned.
mention-role
(mention-role role)
Takes a role object or id and returns a mention of that role for use in messages.
mention-user
(mention-user user)
Takes a user object or id and returns a mention of that user for use in messages.
role-mention
Regex pattern that matches role mentions.
Captures the role id in its first capture group labelled "id".
strike-through
(strike-through text)
Returns the given text with ~~strikethrough~~.
underline
(underline text)
Returns the given text __underlined__.
user-mention
Regex pattern that matches user or member mentions.
Captures the user id in its first capture group labelled "id".
user-tag
(user-tag {:keys [username discriminator], :as user})
Takes a user object and returns a string representing it as a tag, i.e. "username#discriminator".