Skip to content

Embeds and messages

cembed makes an embed from pairs of a name and a value. Put it inside sendMessage:

{{ sendMessage nil (cembed
"title" "Welcome"
"description" (printf "Hi %s, you are member number %d." .User.Username .Guild.MemberCount)
"color" "#ff91c2"
"footer" .Guild.Name
) }}
Name Value Limit
title Text 256 characters
description Text 4096 characters
url A link that starts with http:// or https://
color A number from 0 to 16777215, or text such as "#ff91c2"
footer Text 2048 characters
author Text 256 characters
authorIcon A link that starts with http:// or https://, such as .User.Avatar: the picture next to the author. Needs an author
authorUrl A link that opens when the author is clicked. Needs an author
footerIcon A link for the small picture next to the footer. Needs a footer
thumbnail, image A link that starts with http:// or https://
timestamp true to show the time now
fields A list of fields, each one cslice "name" "value" or cslice "name" "value" true (the last one makes it inline) 25 fields, name 256, value 1024

A value that is nil leaves that part out. An embed holds at most 6000 characters in total. A name that does not exist is a mistake that lists the valid ones.

{{ $fields := cslice
(cslice "Members" (str .Guild.MemberCount) true)
(cslice "Channel" .Channel.Mention true) }}
{{ sendMessage nil (cembed "title" "Info" "fields" $fields) }}

complexMessage sends text, an embed and buttons in the same message. It takes "content", "embed" and "components" (Buttons and menus):

{{ sendMessage nil (complexMessage "content" "Look at this:" "embed" (cembed "title" "Hi")) }}

"embed" must be made with cembed: a map written by hand is refused. The content has at most 2000 characters.

sendMessage and sendDM accept a text, a cembed or a complexMessage. See Actions.