You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

CommandBuilderTests.cs 1.0 KiB

12345678910111213141516171819202122232425262728293031323334353637
  1. using System;
  2. using Discord;
  3. using Xunit;
  4. namespace Discord;
  5. public class CommandBuilderTests
  6. {
  7. [Fact]
  8. public void BuildSimpleSlashCommand()
  9. {
  10. var command = new SlashCommandBuilder()
  11. .WithName("command")
  12. .WithDescription("description")
  13. .AddOption(
  14. "option1",
  15. ApplicationCommandOptionType.String,
  16. "option1 description",
  17. isRequired: true,
  18. choices: new []
  19. {
  20. new ApplicationCommandOptionChoiceProperties()
  21. {
  22. Name = "choice1", Value = "1"
  23. }
  24. })
  25. .AddOptions(new SlashCommandOptionBuilder()
  26. .WithName("option2")
  27. .WithDescription("option2 description")
  28. .WithType(ApplicationCommandOptionType.String)
  29. .WithRequired(true)
  30. .AddChannelType(ChannelType.Text)
  31. .AddChoice("choice1", "1")
  32. .AddChoice("choice2", "2"));
  33. command.Build();
  34. }
  35. }