mirror of
https://github.com/Myxelium/Lunaris2.0.git
synced 2026-04-11 15:19:53 +00:00
Add Embed
This commit is contained in:
@@ -27,12 +27,24 @@ public static class Command
|
||||
public const string Description = "Join the voice channel!";
|
||||
}
|
||||
|
||||
public static class Skip
|
||||
{
|
||||
public const string Name = "skip";
|
||||
public const string Description = "Skip the current song!";
|
||||
}
|
||||
|
||||
public static class Stop
|
||||
{
|
||||
public const string Name = "stop";
|
||||
public const string Description = "Stop the music!";
|
||||
}
|
||||
|
||||
public static class Play
|
||||
{
|
||||
public const string Name = "play";
|
||||
public const string Description = "Play a song!";
|
||||
|
||||
public static readonly List<SlashCommandOptionBuilder> Options = new()
|
||||
public static readonly List<SlashCommandOptionBuilder>? Options = new()
|
||||
{
|
||||
new SlashCommandOptionBuilder
|
||||
{
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -10,10 +10,16 @@ public static class SlashCommandRegistration
|
||||
RegisterCommand(client, Command.Hello.Name, Command.Hello.Description);
|
||||
RegisterCommand(client, Command.Goodbye.Name, Command.Goodbye.Description);
|
||||
RegisterCommand(client, Command.Join.Name, Command.Join.Description);
|
||||
RegisterCommand(client, Command.Skip.Name, Command.Skip.Description);
|
||||
RegisterCommand(client, Command.Play.Name, Command.Play.Description, Command.Play.Options);
|
||||
RegisterCommand(client, Command.Stop.Name, Command.Stop.Description);
|
||||
}
|
||||
|
||||
private static void RegisterCommand(DiscordSocketClient client, string commandName, string commandDescription, List<SlashCommandOptionBuilder> commandOptions = null)
|
||||
private static void RegisterCommand(
|
||||
DiscordSocketClient client,
|
||||
string commandName,
|
||||
string commandDescription,
|
||||
List<SlashCommandOptionBuilder>? commandOptions = null)
|
||||
{
|
||||
var command = new SlashCommandBuilder(commandName, commandDescription, commandOptions);
|
||||
_ = command.CreateSlashCommand(client);
|
||||
|
||||
Reference in New Issue
Block a user