Fix Ids in ActionRowComponent and SelectmenuComponent (#3122)
This commit is contained in:
@@ -26,9 +26,10 @@ public class ActionRowComponent : IMessageComponent
|
||||
|
||||
internal ActionRowComponent() { }
|
||||
|
||||
internal ActionRowComponent(IReadOnlyCollection<IMessageComponent> components)
|
||||
internal ActionRowComponent(IReadOnlyCollection<IMessageComponent> components, int? id)
|
||||
{
|
||||
Components = components;
|
||||
Id = id;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -200,7 +200,7 @@ public class ActionRowBuilder : IMessageComponentBuilder, IInteractableComponent
|
||||
Preconditions.AtLeast(Components.Count, 1, nameof(Components), "There must be at least 1 component in a row.");
|
||||
Preconditions.AtMost(Components.Count, MaxChildCount, nameof(Components), $"Action row can only contain {MaxChildCount} child components!");
|
||||
|
||||
return new ActionRowComponent(_components.Select(x => x.Build()).ToList());
|
||||
return new ActionRowComponent(_components.Select(x => x.Build()).ToList(), Id);
|
||||
}
|
||||
IMessageComponent IMessageComponentBuilder.Build() => Build();
|
||||
|
||||
|
||||
@@ -54,6 +54,7 @@ namespace Discord.API
|
||||
Disabled = component.IsDisabled;
|
||||
ChannelTypes = component.ChannelTypes.ToArray();
|
||||
DefaultValues = component.DefaultValues.Select(x => new SelectMenuDefaultValue {Id = x.Id, Type = x.Type}).ToArray();
|
||||
Id = component.Id ?? Optional<int>.Unspecified;
|
||||
}
|
||||
|
||||
[JsonIgnore]
|
||||
|
||||
Reference in New Issue
Block a user