2
0
mirror of synced 2025-02-12 00:16:39 +00:00

20 lines
543 B
C#
Raw Normal View History

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