using DSharpPlus.Entities; using System; using System.Collections.Generic; using System.Text; using TomatenMusic.Prompt.Option; using System.Linq; using System.Threading.Tasks; using TomatenMusic.Util; using Microsoft.Extensions.Logging; namespace TomatenMusic.Prompt.Model { class CombinedPrompt : DiscordPromptBase { public string Content { get; protected set; } = ""; public List Embeds { get; protected set; } = new List(); public CombinedPrompt(DiscordPromptBase lastPrompt = null, string content = "Example Content", List embeds = null) : base(lastPrompt) { this.LastPrompt = lastPrompt; this.Content = content; this.Embeds = embeds == null ? new List() : embeds; } protected async override Task GetComponentAsync(IPromptOption option) { if (option is SelectMenuPromptOption) { SelectMenuPromptOption selectOption = (SelectMenuPromptOption)option; List options = new List(); foreach (var item in selectOption.Options) { options.Add(new DiscordSelectComponentOption(item.Label, item.CustomID, item.Description, item.Default, item.Emoji)); } return new DiscordSelectComponent(selectOption.CustomID, selectOption.Content, options, selectOption.Disabled, selectOption.MinValues, selectOption.MaxValues); } else { var myOption = (ButtonPromptOption)option; DiscordComponent component; if (myOption.Link != null) component = new DiscordLinkButtonComponent(myOption.Link, myOption.Content, myOption.Disabled, myOption.Emoji); else component = new DiscordButtonComponent(myOption.Style, myOption.CustomID, myOption.Content, myOption.Disabled, myOption.Emoji); return component; } } protected async override Task GetMessageAsync() { return new DiscordMessageBuilder() .WithContent(Content) .AddEmbeds(Embeds); } } }