Skip to content

Commit 958d286

Browse files
authored
[Fix] Incorrect casts in the legacy component builder (#3167)
* [Fix] Incorrect casts in the legacy component builder * cringe
1 parent 87c1461 commit 958d286

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Discord.Net.Core/Entities/Interactions/MessageComponents/Builders/ComponentBuilder.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ internal void AddComponent(IMessageComponent component, int row)
8787
/// <returns>The current builder.</returns>
8888
public ComponentBuilder RemoveComponentsOfType(ComponentType t)
8989
{
90-
this.ActionRows.ForEach(ar => ar.Components.RemoveAll(c => c.Type == t));
90+
ActionRows.ForEach(ar => ar.Components.RemoveAll(c => c.Type == t));
9191
return this;
9292
}
9393

@@ -98,7 +98,7 @@ public ComponentBuilder RemoveComponentsOfType(ComponentType t)
9898
/// <returns>The current builder.</returns>
9999
public ComponentBuilder RemoveComponent(string customId)
100100
{
101-
this.ActionRows.ForEach(ar => ar.Components.RemoveAll(c => c is IInteractableComponent i && i.CustomId == customId));
101+
ActionRows.ForEach(ar => ar.Components.RemoveAll(c => c is IInteractableComponentBuilder i && i.CustomId == customId));
102102
return this;
103103
}
104104

@@ -109,7 +109,7 @@ public ComponentBuilder RemoveComponent(string customId)
109109
/// <returns>The current builder.</returns>
110110
public ComponentBuilder RemoveButtonByURL(string url)
111111
{
112-
this.ActionRows.ForEach(ar => ar.Components.RemoveAll(c => c is ButtonComponent b && b.Url == url));
112+
ActionRows.ForEach(ar => ar.Components.RemoveAll(c => c is ButtonBuilder b && b.Url == url));
113113
return this;
114114
}
115115

@@ -319,7 +319,7 @@ public MessageComponent Build()
319319
_actionRows.RemoveAt(i);
320320

321321
return _actionRows != null
322-
? new MessageComponent(_actionRows.Select(x => x.Build()).OfType<IMessageComponent>().ToList())
322+
? new MessageComponent(_actionRows.Select(IMessageComponent (x) => x.Build()).ToList())
323323
: MessageComponent.Empty;
324324
}
325325
}

0 commit comments

Comments
 (0)