namespace VpSharp.Commands.Attributes.ExecutionChecks; /// /// Specifies that this command can only be run by bots. /// public sealed class RequireUserNameAttribute : PreExecutionCheckAttribute { /// /// Initializes a new instance of the class. /// /// An array of allowed user names. /// is . public RequireUserNameAttribute(params string[] names) { ArgumentNullException.ThrowIfNull(names); Names = names[..]; } /// /// Gets a read-only view of the user names allowed to run this command. /// /// A of representing the allowed user names. public IReadOnlyList Names { get; } /// protected internal override Task PerformAsync(CommandContext context) { ArgumentNullException.ThrowIfNull(context); return Task.FromResult(Names.Contains(context.Avatar.User.Name)); } }