1
0
mirror of https://github.com/oliverbooth/VpSharp synced 2024-11-09 23:15:41 +00:00
This commit is contained in:
Oliver Booth 2024-01-20 17:30:24 +00:00
parent 63e775855a
commit d6cd882e0a
Signed by: oliverbooth
GPG Key ID: E60B570D1B7557B5
3 changed files with 8 additions and 5 deletions

View File

@ -9,6 +9,6 @@ public sealed class RequireBotOwnerAttribute : PreExecutionCheckAttribute
protected internal override Task<bool> PerformAsync(CommandContext context)
{
ArgumentNullException.ThrowIfNull(context);
return Task.FromResult(context.Avatar.User.Id == context.Client.CurrentUser?.Id);
return Task.FromResult(context.Avatar.UserId == context.Client.CurrentUser?.Id);
}
}

View File

@ -40,6 +40,6 @@ public sealed class RequireUserIdAttribute : PreExecutionCheckAttribute
protected internal override Task<bool> PerformAsync(CommandContext context)
{
ArgumentNullException.ThrowIfNull(context);
return Task.FromResult(UserIds.Contains(context.Avatar.User.Id));
return Task.FromResult(UserIds.Contains(context.Avatar.UserId));
}
}

View File

@ -1,4 +1,6 @@
namespace VpSharp.Commands.Attributes.ExecutionChecks;
using VpSharp.Entities;
namespace VpSharp.Commands.Attributes.ExecutionChecks;
#pragma warning disable CA1019 // Define accessors for attribute arguments
@ -37,9 +39,10 @@ public sealed class RequireUserNameAttribute : PreExecutionCheckAttribute
public IReadOnlyList<string> Names { get; }
/// <inheritdoc />
protected internal override Task<bool> PerformAsync(CommandContext context)
protected internal override async Task<bool> PerformAsync(CommandContext context)
{
ArgumentNullException.ThrowIfNull(context);
return Task.FromResult(Names.Contains(context.Avatar.User.Name));
VirtualParadiseUser user = await context.Avatar.GetUserAsync().ConfigureAwait(false);
return Names.Contains(user.Name);
}
}