2023-10-22 08:10:52 +00:00
|
|
|
|
using Discord;
|
|
|
|
|
|
2023-10-24 13:25:45 +00:00
|
|
|
|
namespace BiblioTech.Options
|
2023-10-22 08:10:52 +00:00
|
|
|
|
{
|
|
|
|
|
public class UserOption : CommandOption
|
|
|
|
|
{
|
|
|
|
|
public UserOption(string description, bool isRequired)
|
|
|
|
|
: base("user", description, ApplicationCommandOptionType.User, isRequired)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2023-10-25 09:25:27 +00:00
|
|
|
|
public IUser? GetUser(CommandContext context)
|
2023-10-22 08:10:52 +00:00
|
|
|
|
{
|
2023-10-24 13:25:45 +00:00
|
|
|
|
var userOptionData = context.Options.SingleOrDefault(o => o.Name == Name);
|
2023-10-22 08:10:52 +00:00
|
|
|
|
if (userOptionData == null) return null;
|
2023-10-25 09:25:27 +00:00
|
|
|
|
return userOptionData.Value as IUser;
|
2023-10-22 08:10:52 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|