2
0
mirror of synced 2025-01-10 08:36:13 +00:00
2023-10-25 11:25:27 +02:00

20 lines
543 B
C#

using Discord;
namespace BiblioTech.Options
{
public class UserOption : CommandOption
{
public UserOption(string description, bool isRequired)
: base("user", description, ApplicationCommandOptionType.User, isRequired)
{
}
public IUser? GetUser(CommandContext context)
{
var userOptionData = context.Options.SingleOrDefault(o => o.Name == Name);
if (userOptionData == null) return null;
return userOptionData.Value as IUser;
}
}
}