Null check slash command localizations (#2453)

This commit is contained in:
essoperagma
2022-09-09 10:20:19 +00:00
committed by GitHub
parent 5073afa316
commit 4834b27f90
5 changed files with 87 additions and 31 deletions

View File

@@ -0,0 +1,37 @@
using System;
using Discord;
using Xunit;
namespace Discord;
public class CommandBuilderTests
{
[Fact]
public void BuildSimpleSlashCommand()
{
var command = new SlashCommandBuilder()
.WithName("command")
.WithDescription("description")
.AddOption(
"option1",
ApplicationCommandOptionType.String,
"option1 description",
isRequired: true,
choices: new []
{
new ApplicationCommandOptionChoiceProperties()
{
Name = "choice1", Value = "1"
}
})
.AddOptions(new SlashCommandOptionBuilder()
.WithName("option2")
.WithDescription("option2 description")
.WithType(ApplicationCommandOptionType.String)
.WithRequired(true)
.AddChannelType(ChannelType.Text)
.AddChoice("choice1", "1")
.AddChoice("choice2", "2"));
command.Build();
}
}