/// <summary> /// Starts setup process where guild admins can easily setup their specific guild settings. /// </summary> public async Task SetupAsync(SocketCommandContext context) { //Delete the message that invoked this command await context.Message.DeleteAsync(); //Selection builder used to know which settings the admin wants to change var selection = new ReactionSelectionBuilder <string>() .WithTitle("Cobra Setup") .WithSelectables(new Dictionary <IEmote, string> { [new Emoji("1️⃣")] = "Welcome Channel", [new Emoji("2️⃣")] = "Moderation Channel", [new Emoji("3️⃣")] = "Role on Join", [new Emoji("4️⃣")] = "Custom Prefix", [new Emoji("5️⃣")] = "Private Chats" }) .WithUsers(context.User) .WithAllowCancel(true) .WithDeletion(DeletionOptions.AfterCapturedContext | DeletionOptions.Invalids); //Send the selection builder and save the result var result = await _interactivityService.SendSelectionAsync(selection.Build(), context.Channel, TimeSpan.FromMinutes(3)); //We switch through every result switch (result.Value) { //If user wants to setup Welcome Channel case "Welcome Channel": await WelcomeChannelSetup(context); break; //If user wants to setup Moderation Channel case "Moderation Channel": await ModerationSetup(context); break; //If user wants to setup Role on Join case "Role on Join": await RoleOnJoinSetup(context); break; //If user wants to setup Custom Prefix case "Custom Prefix": await PrefixSetup(context); break; //If user wants to setup Private Chats case "Private Chats": await PrivateChatSetup(context); break; } }
public async Task ExampleReactionSelectionAsync() { var builder = new ReactionSelectionBuilder <string>() .WithSelectables(new Dictionary <Emoji, string>() { [new Emoji("💵")] = "Hi", [new Emoji("🍭")] = "How", [new Emoji("😩")] = "Hey", [new Emoji("💠")] = "Huh?!" }) .WithUsers(Context.User) .WithDeletion(DeletionOptions.AfterCapturedContext | DeletionOptions.Invalids); var result = await Interactivity.SendSelectionAsync(builder.Build(), Context.Channel, TimeSpan.FromSeconds(50)); if (result.IsSuccess) { await Context.Channel.SendMessageAsync(result.Value.ToString()); } }