2
0
mirror of synced 2025-01-26 08:20:02 +00:00

24 lines
672 B
C#
Raw Normal View History

2023-10-24 15:43:07 +02:00
using Discord;
namespace BiblioTech.Options
{
public class StringOption : CommandOption
{
public StringOption(string name, string description, bool isRequired)
: base(name, description, type: ApplicationCommandOptionType.String, isRequired)
{
}
public async Task<string?> Parse(CommandContext context)
{
var strData = context.Options.SingleOrDefault(o => o.Name == Name);
if (strData == null)
{
2023-10-25 10:54:26 +02:00
await context.Followup("String option not received.");
2023-10-24 15:43:07 +02:00
return null;
}
return strData.Value as string;
}
}
}