From 5e31eb12a693df53f6e40e98c6580257accf56b7 Mon Sep 17 00:00:00 2001 From: MrCakeSlayer <13650699+MrCakeSlayer@users.noreply.github.com> Date: Tue, 6 Jul 2021 09:00:17 -0400 Subject: [PATCH] Include addition vars for selection dropdowns --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index f7671aca6..f99f3ec4a 100644 --- a/README.md +++ b/README.md @@ -74,9 +74,15 @@ private async Task MyMessageComponentHandler(SocketInteraction arg) // You can also followup with a second message await parsedArg.FollowupAsync($"Clicked {parsedArg.Data.CustomId}!", type: InteractionResponseType.ChannelMessageWithSource, ephemeral: true); + + //If you are using selection dropdowns, you can get the selected label and values using these: + var selectedLabel = ((SelectMenu) parsedArg.Message.Components.First().Components.First()).Options.FirstOrDefault(x => x.Value == parsedArg.Data.Values.FirstOrDefault())?.Label; + var selectedValue = parsedArg.Data.Values.First(); } ``` +> Note: The example above assumes that the selection dropdown is expecting only 1 returned value, if you configured your dropdown for multiple values, you'll need to modify the code slightly. + ### Sending messages with buttons Theres a new field in all `SendMessageAsync` functions that takes in a `MessageComponent`, you can use it like so: ```cs