-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using DSharpPlus.CommandsNext; | ||
using DSharpPlus.CommandsNext.Attributes; | ||
using DSharpPlus.Entities; | ||
|
||
namespace csharp_discord_bot.Commands.Components | ||
{ | ||
/// <summary> | ||
/// Discord Components [Dropdowns, Modal] | ||
/// </summary> | ||
public class DiscordComponentCommands : BaseCommandModule | ||
{ | ||
[Command("dropdown-list")] | ||
public async Task DropDownList(CommandContext ctx) | ||
{ | ||
List<DiscordSelectComponentOption> optionsList = [ | ||
new DiscordSelectComponentOption("Option 1", "option1"), | ||
new DiscordSelectComponentOption("Option 2", "option2"), | ||
new DiscordSelectComponentOption("Option 3", "option3") | ||
]; | ||
|
||
var options = optionsList.AsEnumerable(); | ||
|
||
var dropdown = new DiscordSelectComponent("dropDownList", "Select....", options); | ||
|
||
var dropdownMessage = new DiscordMessageBuilder() | ||
.AddEmbed(new DiscordEmbedBuilder() | ||
.WithColor(DiscordColor.Gold) | ||
.WithTitle("This embed has a dropdown list on it") | ||
).AddComponents(dropdown); | ||
|
||
await ctx.Channel.SendMessageAsync(dropdownMessage); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters