Skip to content

Commit b1f85c6

Browse files
committed
up
1 parent 545b08c commit b1f85c6

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

src/Disc.NET.Client.SDK/Messages/ApiMessage.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,17 @@ public class ApiMessage
2828

2929
public List<object> MountComponents()
3030
{
31-
var results = new List<object>();
31+
if (Components.Count > 5)
32+
throw new DiscNetGenericException("The message cannot contain more than 5 top-level components.");
33+
34+
var results = new List<object>();
35+
3236
NormalizeActionRows<ActionRowSelectMenuComponentBuilder>(ActionRowConstraint.MAX_SELECT_MENUS_PER_ACTION_ROW, message =>
3337
new ActionRowSelectMenuComponentBuilder().AddMenu(message.First()));
3438

3539
NormalizeActionRows<ActionRowButtonComponentBuilder>(ActionRowConstraint.MAX_BUTTONS_PER_ACTION_ROW, message =>
3640
new ActionRowButtonComponentBuilder().AddButtons(message));
3741

38-
if (Components.Count > 5)
39-
throw new DiscNetGenericException("The message cannot contain more than 5 top-level components.");
40-
4142
Components.ForEach(x => results.Add(x.Build()));
4243
return results;
4344
}

0 commit comments

Comments
 (0)