Skip to content

Embed

This data type describes the Embed message builder. Almost all the methods return the same builder, so it is possible to build a method chains like this:

JuniperBot Template
{% do channel
    .createEmbed()
    .withContent('Content outside the embed')
    .withTitle('Title', 'https://juniper.bot')
    .withDescription('Oh, hi!')
    .appendDescription('\nHow are you?')
    .withDate(1587713425964)
    .withColor('ffff00')
    .withThumbnail(member.avatarUrl)
    .withImage('https://i.pinimg.com/originals/a4/41/6e/a4416e024d691af3a2971e4114a6da7f.png')
    .withAuthor(member.nickname)
    .withFooter('Huff, bye!', member.avatarUrl)
    .addField('First field', 'Ah! A value of the first field', true)
    .addField('Second field', 'Something here too', true)
    .addReaction(':fox_face:')
    .addButton('LINK', 'https://juniper.bot/', 'Website', '🦊')
    .send()
%}

Properties

PropertyTypeDescription
emptyBooleantrue if empty
validLengthBooleantrue if length is valid to send this message
lengthNumberCurrent embed length

Methods

withContent(Content)

Sets the message content outside the Embed.

Returns: Embed

withTitle(Name, URL)

Sets the Embed Title with URL.

Returns: Embed

withAuthor(Name, URL, IconURL)

Sets the Embed Author with optional link and icon.

Returns: Embed

withDescription(Content)

Sets the Embed Description

Returns: Embed

appendDescription(String)

Appends new text to existing Embed Description

Returns: Embed

withThumbnail(URL)

Sets Embed Thumbnail

Returns: Embed

withImage(URL)

Sets Embed Image

Returns: Embed

withColor(Color)

Sets Embed border color, this method accepts HEX color string, for example #FF0000 for red (you can remove the #).

https://htmlcolorcodes.com/

Returns: Embed

withDate(Date)

Adds a date to Embed Footer.

Returns: Embed

withFooter(Content, IconURL)

Sets Embed Footer with optional icon.

Returns: Embed

addField(Name, Value, IsInline)

Adds new Embed Field with name, value and inline option specified.

Returns: Embed

addBlankField(IsInline)

Adds en empty Embed Field with inline option.

Returns: Embed

addReaction(Emote)

Adds a reaction to the resulting message of this embed. Works the same as reaction function.

Returns: Embed

addButton(Style, URL_ID, Label, Emote, UUID, Disabled)

Adds a button to the resulting message of this embed. Works the same as button function.

Returns: Embed

addSelectMenu(Type, ID, Label, UUID, Disabled)

Adds a select menu to the resulting message of this embed. Works the same as select_menu function.

Returns: MenuBuilder

addComponentsRow()

Adds new message components row.

Returns: Embed

withPoll(Question, Duration, IsMultiAnswer)

Adds a poll to the resulting message of this embed.

Returns: Embed

addPollAnswer(Answer, Emote)

Adds an answer to the poll (up to 10). Must be executed after withPoll.

Returns: Embed

clearFields()

Clears all the Embed Fields added

Returns: Embed

clear()

Clears the whole Embed data.

Returns: Embed

error()

Makes this Embed styled as error, sets its color to red with Error title.

Returns: Embed

deleteAfterSec(Seconds)

Sets the seconds after which this Embed message will be deleted.

Returns: Embed

preferEphemeral(Ephemeral)

Sets if ephemeral (personal) message should be preferred.

Will only take effect if action is executed by the interaction (slash command, components, menu, modal, etc), is not deferred and only for override!

Returns: Embed

editComponentMessage(Edit)

Sets if original message content should be replaced by this one.

Will only take effect if action is executed by component or modal and only for override!

Returns: Embed

withAllowedMentions(Types)

Sets allowed mention types.

Returns: Embed

pin(Pin)

Pins this Embed.

Returns: Embed

unpin(Unpin)

Unpins this Embed. Only works while updating the message.

Returns: Embed

send()

Sends message to the channel where this builder were created.

Returns true if message was sent successfully

Returns: Boolean

Warning! Quota

Following methods have shared quota and can only be invoked 2 times in the same template:

  • send
  • sendAndGet
  • update
  • updateAndGet
  • Channel#sendMessage
  • Channel#sendMessageAndGet

sendAndGet()

Sends message to the channel where this builder were created.

Returns result message object if it was sent successfully

Returns: Message

Warning! Quota

Following methods have shared quota and can only be invoked 2 times in the same template:

  • send
  • sendAndGet
  • update
  • updateAndGet
  • Channel#sendMessage
  • Channel#sendMessageAndGet

update(id)

Updates message by the Message ID given.

Returns true, if message was successfully updated.

You can only edit bot's messages!

Returns: Boolean

Warning! Quota

Following methods have shared quota and can only be invoked 2 times in the same template:

  • send
  • sendAndGet
  • update
  • updateAndGet
  • Channel#sendMessage
  • Channel#sendMessageAndGet

updateAndGet(id)

Updates message by the Message ID given.

Returns result message object, if it was successfully updated.

You can only edit bot's messages!

Returns: Message

Warning! Quota

Following methods have shared quota and can only be invoked 2 times in the same template:

  • send
  • sendAndGet
  • update
  • updateAndGet
  • Channel#sendMessage
  • Channel#sendMessageAndGet

All rights sniffed.