Custom Embeds
An embed is just like a form, containing many objects, such as the Title, the Author, the Thumbnail, the Description, the Fields, the Color, the Footer, the Image, the URL, and the Timestamp
The customembed
command
customembed
commandOne method of sending an embed with YAGPDB is using the command customembed
(or for short, ce
).
Create embeds by hand
YAGPDB accepts embeds in JSON following the rules of this format.
There, we'll take a look at the Embed Objects. You can add a value to each of these objects. A very simple embed would look like this:
Let's break this down: We start of with the customembed command -ce
. After this, I start my object (the embed) with a curly brace. Then we have the name of the object (title) and the value of it (This is my title). We separate data with commas. After that we have the same thing again, but for the description. In the end we close the object (embed) with another curly brace.
You can add the multiple objects to this, but keep in mind that Discord limits your message to 2000 characters.
The syntax of JSON
The syntax of json is pretty easy. You start off with a curly brace ({
) and end with a curly brace (}
). Between this, you can add names and their according values. Data (a name and a value) get separated by commas (,
) . Around strings (text) you wrap two quotation marks (""
), but nothing around integers (whole numbers) or booleans (true or false statements). You can play around with this a bit.
Special character
Escaped output
Quotation mark (")
\"
Backslash (\)
\\
Slash (/)
\/
Backspace
\b
Form feed
\f
New line
\n
Carriage return
\r
Horizontal tab
\t
Creating embeds with a generator can be more difficult if you don't need any difficult features. If you want your embed to be super shiny, you can use this embed generator. YAGPDB does not use the first part of its code, so you have to remove the following:
and the last curly brace (}
). After this you can just copy and paste it into Discord:
The simpleembed
command
simpleembed
commandSimple embeds are easier to use than custom embeds as they do not require any knowledge of json. Their downside is that they don't support all Discord embed fields from the embed structure, for example fields. You can create a simple embed with the simpleembed
command, se
for short.
Simple embeds work with switches, here is a list of them all:
Switch
Description
-channel
Optional channel to send in.
-title
Title field.
-desc
Description field.
-color
Color field, either in hex or a color name.
-url
URL field for embed.
-thumbnail
URL to an image for thumbnail field.
-image
URL to an image.
-author
Author field.
-authoricon
URL for the icon in 'author' field.
-footer
Footer field.
-footericon
URL to an image for footer icon field.
The values for simple embeds need to bet placed within quotes:

You can play around with this command a bit because it's really easy to use.
Embeds in Custom Commands
Preface
Look at the following embed, is it beautiful? Most of the people will say "yes". So, how can you create an embed like that in custom commands?

Read the following codes, and you will notice that the codes for the embed are not very different from the normal custom commands. That being so, there are still some differences between them.
Embeds in custom commands are a little more difficult. Also, there is no generator that you could use for this. Please only proceed if you have a good amount of knowledge about custom commands and templates in general.
To make your code readable, especially for large embeds, indents may be used, as YAGPDB's templating system allows this sort of formatting.
Do you think that making an embed is hard? After reading the content below, you will be able to make your own unique embed by yourself.
Now we are going to introduce how to make an embed with YAGPDB in a custom command.
Create an embed
When you create an embed by a custom command, cembed
is indispensable. There are several ways of making and sending an embed. We will introduce some below.
Create an embed, save it into a normal variable, and send a message with that variable.
Directly use
sendMessage
with the message beingcembed ...
.
Save the embed into a variable (
$s
for example) which is of typetemplates.SDict
, usecembed $s
to create an embed, and send it withsendMessage
.
This way of creating an embed will be useful when your embed objects are added inside a if-else
block or if you want to edit your embed in the future. We will introduce the usage of it in the future.
Title and Description
The basic objects of an embed.
We don't follow the json syntax here and only define everything one after the other ("name
" "value
" et cetera). Now we use the objects for discord embeds from the developer page.
Do not just use {{$embed}}
to show the embed because the bot will only show the embed objects and will not combine them together.
The followings introduce more things that you can add in an embed.
Add fields
The name
and value
should be of type string
, or it won't output the embed.
Display an image
You can display an image by simply pasting the link to it in the response, or by doing it fancy this way: (make sure to replace the link with your own image)
Add author objects
You can add the author in the embed, and his/her avatar or any image as well.
You cannot only add the icon_url
in the author part.
Display the thumbnail
You can add a thumbnail for the embed to make your embed more beautiful.
Add the footer
You can add the footer to show some tips or whatever you want. You can also add an icon for the footer.
You cannot only add a picture in the footer.
The Color of The Embed
You can add color (decimal number) for your embed to make it better.
The color for the embed should be between 1 and 16777214, or it will not show the color.
Discord uses color decimal. SpyColor is a good tool to pick colors or convert hex to decimal. Visit there or use the following command to convert hex to decimal.
Use Sdict to Create an Embed
If a value inside an embed is from your input, how to make it?
Compare the two ways written below:
Condition: If you input something $s
after the trigger -e
, it will make the description for the embed.
Without
sdict
:
This way is for novices, and it will waste lots of space, so we don't really recommend this way.
With
sdict
:
This way can save much more space than the previous way, especially when there are many objects being made by if-else
function. Try to make your own embed with the means above. You can spot that the more complicated your embed is, the more efficient the sdict
way is.
Complex Message by Sdict
The following way allows you to use sdict
to create a complex message.
Remember that the usage of complexMessage
is complexMessage "content" "Your content" "embed" "The embed" "file" "The text file"
? So just create 3 keys inside sdict
: content
, embed
, and file
, and then make the value of the key embed
a sdict
that contains the embed objects. Finally, use sendMessage nil (complexMessage $message)
to send the complex message.
Edit an Embed
If you want the embed the bot sends to be edited after a while or a specific action, how to do it? sdict
will be the best solution to the question.
The following command makes the bot send an embed with the title itself only, and edit the embed with more objects after 3 seconds.
With sdict
, we can do way more things than you can think of, so try your best to explore more!
Last updated
Was this helpful?