Add Embed

This commit is contained in:
Myx
2024-04-14 21:43:25 +02:00
parent 2d7ec0829e
commit 0bc2a9be56
19 changed files with 347 additions and 228 deletions

View File

@@ -5,11 +5,14 @@ using Newtonsoft.Json;
namespace Lunaris2.SlashCommand;
public class SlashCommandBuilder(string commandName, string commandDescription, List<SlashCommandOptionBuilder> commandOptions = null)
public class SlashCommandBuilder(
string commandName,
string commandDescription,
List<SlashCommandOptionBuilder>? commandOptions = null)
{
private string CommandName { get; set; } = commandName;
private string CommandDescription { get; set; } = commandDescription;
private List<SlashCommandOptionBuilder> CommandOptions { get; set; }
private List<SlashCommandOptionBuilder>? CommandOptions { get; set; } = commandOptions;
public async Task CreateSlashCommand(DiscordSocketClient client)
{
@@ -23,7 +26,7 @@ public class SlashCommandBuilder(string commandName, string commandDescription,
globalCommand.WithName(CommandName);
globalCommand.WithDescription(CommandDescription);
commandOptions.ForEach(option => globalCommand.AddOption(option));
CommandOptions?.ForEach(option => globalCommand.AddOption(option));
try
{