2023-10-24 13:25:45 +00:00
|
|
|
|
using Discord;
|
|
|
|
|
|
|
|
|
|
namespace BiblioTech.Options
|
|
|
|
|
{
|
|
|
|
|
public abstract class CommandOption
|
|
|
|
|
{
|
|
|
|
|
public CommandOption(string name, string description, ApplicationCommandOptionType type, bool isRequired)
|
|
|
|
|
{
|
|
|
|
|
Name = name;
|
|
|
|
|
Description = description;
|
|
|
|
|
Type = type;
|
|
|
|
|
IsRequired = isRequired;
|
2024-07-02 08:22:00 +00:00
|
|
|
|
|
|
|
|
|
if (Description.Length > 100) throw new Exception("Description for option " + name + " too long!");
|
2023-10-24 13:25:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string Name { get; }
|
|
|
|
|
public string Description { get; }
|
|
|
|
|
public ApplicationCommandOptionType Type { get; }
|
|
|
|
|
public bool IsRequired { get; }
|
|
|
|
|
|
|
|
|
|
public virtual SlashCommandOptionBuilder Build()
|
|
|
|
|
{
|
|
|
|
|
return new SlashCommandOptionBuilder()
|
|
|
|
|
.WithName(Name)
|
|
|
|
|
.WithDescription(Description)
|
|
|
|
|
.WithType(Type)
|
|
|
|
|
.WithRequired(IsRequired);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|