Add project files.
This commit is contained in:
		
							
								
								
									
										32
									
								
								TomatenMusicCore/Prompt/Option/ButtonPromptOption.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								TomatenMusicCore/Prompt/Option/ButtonPromptOption.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,32 @@ | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Text; | ||||
| using DSharpPlus; | ||||
| using DSharpPlus.Entities; | ||||
| using System.Threading.Tasks; | ||||
| using TomatenMusic.Prompt.Option; | ||||
| using TomatenMusic.Prompt.Model; | ||||
|  | ||||
|  | ||||
| namespace TomatenMusic.Prompt | ||||
| { | ||||
|     class ButtonPromptOption : IPromptOption | ||||
|     { | ||||
|  | ||||
|         public ButtonStyle Style { get; set; } = ButtonStyle.Primary; | ||||
|         public string Content { get; set; } = " "; | ||||
|         public DiscordComponentEmoji Emoji { get; set; } | ||||
|         public bool Disabled { get; set; } = false; | ||||
|         public string CustomID { get; set; } | ||||
|         public string Link { get; set; } | ||||
|         public int Row { get; set; } | ||||
|         public Func<Option.IPromptOption, Task<Option.IPromptOption>> UpdateMethod { get; set; } = async prompt => | ||||
|         { | ||||
|             return prompt; | ||||
|         }; | ||||
|         public Func<DSharpPlus.EventArgs.ComponentInteractionCreateEventArgs, DiscordClient, IPromptOption, Task> Run { get; set; } = async (args, sender, prompt) => | ||||
|         { | ||||
|  | ||||
|         }; | ||||
|     } | ||||
| } | ||||
							
								
								
									
										26
									
								
								TomatenMusicCore/Prompt/Option/IPromptOption.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								TomatenMusicCore/Prompt/Option/IPromptOption.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,26 @@ | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Text; | ||||
| using DSharpPlus; | ||||
| using DSharpPlus.Entities; | ||||
| using System.Threading.Tasks; | ||||
| using TomatenMusic.Prompt.Option; | ||||
| using TomatenMusic.Prompt.Model; | ||||
|  | ||||
|  | ||||
| namespace TomatenMusic.Prompt.Option | ||||
| { | ||||
|     interface IPromptOption | ||||
|     { | ||||
|         public string Content { get; set; } | ||||
|         public string CustomID { get; set; } | ||||
|         public int Row { get; set; } | ||||
|         public bool Disabled { get; set; } | ||||
|         public Func<IPromptOption, Task<IPromptOption>> UpdateMethod { get; set; } | ||||
|         public Func<DSharpPlus.EventArgs.ComponentInteractionCreateEventArgs, DiscordClient, IPromptOption, Task> Run { get; set; } | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|     } | ||||
| } | ||||
							
								
								
									
										23
									
								
								TomatenMusicCore/Prompt/Option/SelectMenuOption.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								TomatenMusicCore/Prompt/Option/SelectMenuOption.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,23 @@ | ||||
| using DSharpPlus; | ||||
| using DSharpPlus.EventArgs; | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Text; | ||||
| using System.Threading.Tasks; | ||||
| using TomatenMusic.Prompt.Model; | ||||
| using DSharpPlus.Entities; | ||||
|  | ||||
| namespace TomatenMusic.Prompt.Option | ||||
| { | ||||
|     class SelectMenuOption | ||||
|     { | ||||
|         public string Label { get; set; } | ||||
|         public string CustomID { get; set; } | ||||
|         public string Description { get; set; } | ||||
|         public bool Default { get; set; } | ||||
|         public DiscordComponentEmoji Emoji { get; set; } | ||||
|         public Func<ComponentInteractionCreateEventArgs, DiscordClient, SelectMenuOption, Task> OnSelected { get; set; } | ||||
|         public Func<ComponentInteractionCreateEventArgs, DiscordClient, SelectMenuOption, Task> OnUnselected { get; set; } | ||||
|  | ||||
|     } | ||||
| } | ||||
							
								
								
									
										50
									
								
								TomatenMusicCore/Prompt/Option/SelectMenuPromptOption.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										50
									
								
								TomatenMusicCore/Prompt/Option/SelectMenuPromptOption.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,50 @@ | ||||
| using DSharpPlus; | ||||
| using DSharpPlus.Entities; | ||||
| using DSharpPlus.EventArgs; | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Text; | ||||
| using System.Threading.Tasks; | ||||
| using Microsoft.Extensions.Logging; | ||||
| using TomatenMusic.Prompt.Model; | ||||
| using System.Linq; | ||||
|  | ||||
|  | ||||
| namespace TomatenMusic.Prompt.Option | ||||
| { | ||||
|     class SelectMenuPromptOption : IPromptOption | ||||
|     { | ||||
|         public string Content { get; set; } = " "; | ||||
|         public string CustomID { get; set; } | ||||
|         public int Row { get; set; } = 1; | ||||
|         public bool Disabled { get; set; } = false; | ||||
|         public List<SelectMenuOption> Options { get; set; } = new List<SelectMenuOption>(); | ||||
|         public int MinValues { get; set; } = 1; | ||||
|         public int MaxValues { get; set; } = 1; | ||||
|         public List<string> CurrentValues { get; set; } = new List<string>(); | ||||
|  | ||||
|  | ||||
|         public Func<IPromptOption, Task<IPromptOption>> UpdateMethod { get; set; } = async (prompt) => | ||||
|         { | ||||
|             return prompt; | ||||
|         }; | ||||
|         public Func<ComponentInteractionCreateEventArgs, DiscordClient, IPromptOption, Task> Run { get; set; } = async (args, sender, option) => | ||||
|         { | ||||
|             SelectMenuPromptOption _option = (SelectMenuPromptOption)option; | ||||
|             foreach (var item in _option.Options) | ||||
|             { | ||||
|                 if (_option.CurrentValues.Contains(item.CustomID) && !args.Values.Contains(item.CustomID)) | ||||
|                 { | ||||
|                     await item.OnUnselected.Invoke(args, sender, item); | ||||
|                 } | ||||
|                 if (!_option.CurrentValues.Contains(item.CustomID) && args.Values.Contains(item.CustomID)) | ||||
|                 { | ||||
|                     await item.OnSelected.Invoke(args, sender, item); | ||||
|                 } | ||||
|             } | ||||
|             _option.CurrentValues = new List<string>(args.Values); | ||||
|  | ||||
|         }; | ||||
|  | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 Tim Müller
					Tim Müller