[Fix] Incorrect casts in the legacy component builder (#3167)

* [Fix] Incorrect casts in the legacy component builder

* cringe
This commit is contained in:
Mihail Gribkov
2025-07-20 01:53:17 +03:00
committed by GitHub
parent 87c1461698
commit 958d28636b

View File

@@ -87,7 +87,7 @@ public class ComponentBuilder
/// <returns>The current builder.</returns>
public ComponentBuilder RemoveComponentsOfType(ComponentType t)
{
this.ActionRows.ForEach(ar => ar.Components.RemoveAll(c => c.Type == t));
ActionRows.ForEach(ar => ar.Components.RemoveAll(c => c.Type == t));
return this;
}
@@ -98,7 +98,7 @@ public class ComponentBuilder
/// <returns>The current builder.</returns>
public ComponentBuilder RemoveComponent(string customId)
{
this.ActionRows.ForEach(ar => ar.Components.RemoveAll(c => c is IInteractableComponent i && i.CustomId == customId));
ActionRows.ForEach(ar => ar.Components.RemoveAll(c => c is IInteractableComponentBuilder i && i.CustomId == customId));
return this;
}
@@ -109,7 +109,7 @@ public class ComponentBuilder
/// <returns>The current builder.</returns>
public ComponentBuilder RemoveButtonByURL(string url)
{
this.ActionRows.ForEach(ar => ar.Components.RemoveAll(c => c is ButtonComponent b && b.Url == url));
ActionRows.ForEach(ar => ar.Components.RemoveAll(c => c is ButtonBuilder b && b.Url == url));
return this;
}
@@ -319,7 +319,7 @@ public class ComponentBuilder
_actionRows.RemoveAt(i);
return _actionRows != null
? new MessageComponent(_actionRows.Select(x => x.Build()).OfType<IMessageComponent>().ToList())
? new MessageComponent(_actionRows.Select(IMessageComponent (x) => x.Build()).ToList())
: MessageComponent.Empty;
}
}