Skip to content

Commit 8a2ad6f

Browse files
committed
add explanations to method chaining and resending
1 parent d7f520c commit 8a2ad6f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

guide/popular-topics/embeds.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ The `.setColor()` method accepts an integer, HEX color string, an array of RGB v
8787
On the master branch, the receiving and outgoing embed classes have been unified; you will need to use `Discord.MessageEmbed()` as constructor instead.
8888
:::
8989

90-
The above example chains the manipulating methods to the newly created RichEmbed object.
91-
If you want to modify the embed based on conditions you will need to reference it as the constant `exampleEmbed` (for our example).
90+
The above example chains the manipulating methods to the newly created RichEmbed object. This is possible because the return value of each manipulating method is the RichEmbed instance itself.
91+
If you want to modify the embed based on conditions you will need to reference it directly (as `exampleEmbed` for our example).
9292

9393
<!-- eslint-skip -->
9494

@@ -183,7 +183,7 @@ You don't need to include all the elements showcased above. If you want a simple
183183
The `color` field has to be an integer for embed objects! If you have a hex color string (e.g. `'#7289da'`) you can replace the `#` with `0x` to use it as a number: `0x7289da`.
184184
:::
185185

186-
If you want to modify the embed object based on conditions you will need to reference it as the constant (`exampleEmbed` for our example). You can then reassign the property values as you would with any other object.
186+
If you want to modify the embed object based on conditions you will need to reference it directly (as `exampleEmbed` for our example). You can then (re)assign the property values as you would with any other object.
187187

188188
```js
189189
const exampleEmbed = { title: 'Some title' };
@@ -224,6 +224,7 @@ To achieve this, you retrieve the embed from the messages embed array (`message.
224224

225225
::: warning
226226
You cannot just resend the received embed structure! It's a [MessageEmbed](https://discord.js.org/#/docs/main/stable/class/MessageEmbed) rather than a RichEmbed and contains circular references that prevent sending.
227+
While possible on the master branch due to above mentioned merge of RichEmbed and MessageEmbed it's still not recommended to edit the reference directly as this modifies the embed on the original Message in your bots cache as well and thus may lead to unexpected behaviour!
227228
:::
228229

229230
```js

0 commit comments

Comments
 (0)