From d6cd882e0aee5b74d52569df9b7ac1122c779697 Mon Sep 17 00:00:00 2001 From: Oliver Booth Date: Sat, 20 Jan 2024 17:30:24 +0000 Subject: [PATCH] fix: amend 63e775855a406b7204807bd4389e48af425c57e3 --- .../ExecutionChecks/RequireBotOwnerAttribute.cs | 2 +- .../Attributes/ExecutionChecks/RequireUserIdAttribute.cs | 2 +- .../ExecutionChecks/RequireUserNameAttribute.cs | 9 ++++++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/VpSharp.Commands/Attributes/ExecutionChecks/RequireBotOwnerAttribute.cs b/VpSharp.Commands/Attributes/ExecutionChecks/RequireBotOwnerAttribute.cs index d3a54cf..9c2e3c6 100644 --- a/VpSharp.Commands/Attributes/ExecutionChecks/RequireBotOwnerAttribute.cs +++ b/VpSharp.Commands/Attributes/ExecutionChecks/RequireBotOwnerAttribute.cs @@ -9,6 +9,6 @@ public sealed class RequireBotOwnerAttribute : PreExecutionCheckAttribute protected internal override Task 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); } } diff --git a/VpSharp.Commands/Attributes/ExecutionChecks/RequireUserIdAttribute.cs b/VpSharp.Commands/Attributes/ExecutionChecks/RequireUserIdAttribute.cs index cfeefd6..35d7cdc 100644 --- a/VpSharp.Commands/Attributes/ExecutionChecks/RequireUserIdAttribute.cs +++ b/VpSharp.Commands/Attributes/ExecutionChecks/RequireUserIdAttribute.cs @@ -40,6 +40,6 @@ public sealed class RequireUserIdAttribute : PreExecutionCheckAttribute protected internal override Task PerformAsync(CommandContext context) { ArgumentNullException.ThrowIfNull(context); - return Task.FromResult(UserIds.Contains(context.Avatar.User.Id)); + return Task.FromResult(UserIds.Contains(context.Avatar.UserId)); } } diff --git a/VpSharp.Commands/Attributes/ExecutionChecks/RequireUserNameAttribute.cs b/VpSharp.Commands/Attributes/ExecutionChecks/RequireUserNameAttribute.cs index 7847a1f..de275f8 100644 --- a/VpSharp.Commands/Attributes/ExecutionChecks/RequireUserNameAttribute.cs +++ b/VpSharp.Commands/Attributes/ExecutionChecks/RequireUserNameAttribute.cs @@ -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 Names { get; } /// - protected internal override Task PerformAsync(CommandContext context) + protected internal override async Task 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); } }