* new pages :3 * fimished intro page * fimished interaction page * remove unused shit * I think we are done lmao * I lied, fixed some small mistakes * Update docs/guides/components_v2/interaction.md Co-authored-by: Mihail Gribkov <61027276+Misha-133@users.noreply.github.com> * misha quality assurance :3 + breakings pages * Apply suggestions from code review Co-authored-by: Mihail Gribkov <61027276+Misha-133@users.noreply.github.com> * component types guide expanded * :3 * Apply suggestions from code review Co-authored-by: Mihail Gribkov <61027276+Misha-133@users.noreply.github.com> --------- Co-authored-by: Mihail Gribkov <61027276+Misha-133@users.noreply.github.com>
41 lines
1.5 KiB
Markdown
41 lines
1.5 KiB
Markdown
---
|
|
uid: Guides.Breakings.V3_18
|
|
title: V3.18
|
|
---
|
|
|
|
# V3.18
|
|
|
|
Among the changes in V3.18 was components V2, while splendid, it did bring with it a few changes you should be aware of.
|
|
|
|
- IMessage
|
|
|
|
Messages components type has changed. As a patch you can convert it to an `IEnumerable<ActionRowComponent>` again like so:
|
|
```cs
|
|
IMessage message = component.Message;
|
|
IReadOnlyCollection<IMessageComponent>? components = message.Components;
|
|
IEnumerable<ActionRowComponent>? componentsLegacy = components.OfType<ActionRowComponent>();
|
|
```
|
|
|
|
- Nested components
|
|
|
|
The usage of components with `ActionRowBuilder` and `ComponentBuilder` has a type change as well. You can find examples in [Components_V2_Advanced].
|
|
|
|
- Components V2 Flag
|
|
|
|
To use Components V2 in a message (through `ModifyAsync`/`UpdateAsync`/...), a specific flag has to be set. This cannot be undone though :^). You only have to set it if you modify a message that didn't have components v2 in them to begin with (or if you already set the flag manually - obviously). This means that if you created a message with your bot that has components in it, the flag will automatically be set.
|
|
|
|
Otherwise, you can manually set it like so:
|
|
|
|
```cs
|
|
MessageFlags? flags = component.Message.Flags ?? MessageFlags.None;
|
|
flags = flags | MessageFlags.ComponentsV2;
|
|
|
|
await component.UpdateAsync(m =>
|
|
{
|
|
m.Flags = flags;
|
|
m.Components = cv2builder.Build();
|
|
});
|
|
```
|
|
|
|
[Components_V2_Advanced]: xref:Guides.ComponentsV2.Advanced
|