[Fix] Incorrect casts in the legacy component builder (#3167)
* [Fix] Incorrect casts in the legacy component builder * cringe
This commit is contained in:
@@ -87,7 +87,7 @@ public class ComponentBuilder
|
|||||||
/// <returns>The current builder.</returns>
|
/// <returns>The current builder.</returns>
|
||||||
public ComponentBuilder RemoveComponentsOfType(ComponentType t)
|
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;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,7 +98,7 @@ public class ComponentBuilder
|
|||||||
/// <returns>The current builder.</returns>
|
/// <returns>The current builder.</returns>
|
||||||
public ComponentBuilder RemoveComponent(string customId)
|
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;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,7 +109,7 @@ public class ComponentBuilder
|
|||||||
/// <returns>The current builder.</returns>
|
/// <returns>The current builder.</returns>
|
||||||
public ComponentBuilder RemoveButtonByURL(string url)
|
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;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -319,7 +319,7 @@ public class ComponentBuilder
|
|||||||
_actionRows.RemoveAt(i);
|
_actionRows.RemoveAt(i);
|
||||||
|
|
||||||
return _actionRows != null
|
return _actionRows != null
|
||||||
? new MessageComponent(_actionRows.Select(x => x.Build()).OfType<IMessageComponent>().ToList())
|
? new MessageComponent(_actionRows.Select(IMessageComponent (x) => x.Build()).ToList())
|
||||||
: MessageComponent.Empty;
|
: MessageComponent.Empty;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user