mirror of
https://github.com/oliverbooth/VpSharp
synced 2024-11-22 14:08:49 +00:00
refactor: offer cls-compliant attribute ctors
This commit is contained in:
parent
7084fc3f4a
commit
9171872ec4
@ -1,15 +1,29 @@
|
||||
namespace VpSharp.Commands.Attributes.ExecutionChecks;
|
||||
|
||||
#pragma warning disable CA1019 // Define accessors for attribute arguments
|
||||
|
||||
/// <summary>
|
||||
/// Specifies that this command can only be run by bots.
|
||||
/// </summary>
|
||||
public sealed class RequireAvatarNameAttribute : PreExecutionCheckAttribute
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="RequireAvatarNameAttribute" /> class.
|
||||
/// </summary>
|
||||
/// <param name="names">An enumerable collection of allowed user names.</param>
|
||||
/// <exception cref="ArgumentNullException"><paramref name="names" /> is <see langword="null" />.</exception>
|
||||
public RequireAvatarNameAttribute(IEnumerable<string> names)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(names);
|
||||
Names = names.ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="RequireAvatarNameAttribute" /> class.
|
||||
/// </summary>
|
||||
/// <param name="names">An array of allowed user names.</param>
|
||||
/// <exception cref="ArgumentNullException"><paramref name="names" /> is <see langword="null" />.</exception>
|
||||
[CLSCompliant(false)]
|
||||
public RequireAvatarNameAttribute(params string[] names)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(names);
|
||||
|
@ -1,15 +1,29 @@
|
||||
namespace VpSharp.Commands.Attributes.ExecutionChecks;
|
||||
|
||||
#pragma warning disable CA1019 // Define accessors for attribute arguments
|
||||
|
||||
/// <summary>
|
||||
/// Specifies that this command can only be run by bots.
|
||||
/// </summary>
|
||||
public sealed class RequireUserIdAttribute : PreExecutionCheckAttribute
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="RequireUserIdAttribute" /> class.
|
||||
/// </summary>
|
||||
/// <param name="userIds">An enumerable collection of allowed user IDs.</param>
|
||||
/// <exception cref="ArgumentNullException"><paramref name="userIds" /> is <see langword="null" />.</exception>
|
||||
public RequireUserIdAttribute(IEnumerable<int> userIds)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(userIds);
|
||||
UserIds = userIds.ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="RequireUserIdAttribute" /> class.
|
||||
/// </summary>
|
||||
/// <param name="userIds">An array of allowed user IDs.</param>
|
||||
/// <exception cref="ArgumentNullException"><paramref name="userIds" /> is <see langword="null" />.</exception>
|
||||
[CLSCompliant(false)]
|
||||
public RequireUserIdAttribute(params int[] userIds)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(userIds);
|
||||
|
@ -1,15 +1,29 @@
|
||||
namespace VpSharp.Commands.Attributes.ExecutionChecks;
|
||||
|
||||
#pragma warning disable CA1019 // Define accessors for attribute arguments
|
||||
|
||||
/// <summary>
|
||||
/// Specifies that this command can only be run by bots.
|
||||
/// </summary>
|
||||
public sealed class RequireUserNameAttribute : PreExecutionCheckAttribute
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="RequireUserNameAttribute" /> class.
|
||||
/// </summary>
|
||||
/// <param name="names">An enumerable collection of allowed user names.</param>
|
||||
/// <exception cref="ArgumentNullException"><paramref name="names" /> is <see langword="null" />.</exception>
|
||||
public RequireUserNameAttribute(IEnumerable<string> names)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(names);
|
||||
Names = names.ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="RequireUserNameAttribute" /> class.
|
||||
/// </summary>
|
||||
/// <param name="names">An array of allowed user names.</param>
|
||||
/// <exception cref="ArgumentNullException"><paramref name="names" /> is <see langword="null" />.</exception>
|
||||
[CLSCompliant(false)]
|
||||
public RequireUserNameAttribute(params string[] names)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(names);
|
||||
|
Loading…
Reference in New Issue
Block a user