Browse Source

Added warning for Select Menu duplicates values (#163)

Added a warning if it happens that the Select Menu if there is duplicates values
pull/1923/head
Simon Hjorthøj GitHub 3 years ago
parent
commit
0d811601b7
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions
  1. +2
    -0
      src/Discord.Net.Core/Entities/Interactions/Message Components/ComponentBuilder.cs

+ 2
- 0
src/Discord.Net.Core/Entities/Interactions/Message Components/ComponentBuilder.cs View File

@@ -124,6 +124,8 @@ namespace Discord
public ComponentBuilder WithSelectMenu(SelectMenuBuilder menu, int row = 0)
{
Preconditions.LessThan(row, MaxActionRowCount, nameof(row));
if (menu.Options.Distinct().Count() != menu.Options.Count())
throw new InvalidOperationException("Please make sure that there is no duplicates values.");

var builtMenu = menu.Build();



Loading…
Cancel
Save