From 1f761668f7ff2f250743d2f956799db5f1baeb31 Mon Sep 17 00:00:00 2001 From: Oliver Booth Date: Mon, 8 May 2023 15:44:06 +0100 Subject: [PATCH] fix(commands): swap out unreferenced MessageReceivedEventArgs --- VpSharp.Commands/CommandsExtension.cs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/VpSharp.Commands/CommandsExtension.cs b/VpSharp.Commands/CommandsExtension.cs index b4897ee..31925ea 100644 --- a/VpSharp.Commands/CommandsExtension.cs +++ b/VpSharp.Commands/CommandsExtension.cs @@ -162,14 +162,13 @@ public sealed class CommandsExtension : VirtualParadiseClientExtension } /// - protected internal override Task OnMessageReceived(MessageReceivedEventArgs args) + protected internal override Task OnMessageReceived(VirtualParadiseMessage message) { - ArgumentNullException.ThrowIfNull(args); - VirtualParadiseMessage message = args.Message; + ArgumentNullException.ThrowIfNull(message); if (message.Type != MessageType.ChatMessage) { - return base.OnMessageReceived(args); + return base.OnMessageReceived(message); } foreach (ReadOnlySpan prefix in _configuration.Prefixes) @@ -197,7 +196,7 @@ public sealed class CommandsExtension : VirtualParadiseClientExtension var commandNameString = commandName.ToString(); if (!_commandMap.TryGetValue(commandNameString, out Command? command)) { - return base.OnMessageReceived(args); + return base.OnMessageReceived(message); } var context = new CommandContext(Client, message.Author, command.Name, commandNameString, rawArguments.ToString()); @@ -207,7 +206,7 @@ public sealed class CommandsExtension : VirtualParadiseClientExtension { if (!attribute.PerformAsync(context).ConfigureAwait(false).GetAwaiter().GetResult()) { - return base.OnMessageReceived(args); + return base.OnMessageReceived(message); } } @@ -255,7 +254,7 @@ public sealed class CommandsExtension : VirtualParadiseClientExtension ParameterInfo[] parameters = commandMethod.GetParameters(); if (parameters.Length != arguments.Length || parameters[arguments.Length..].Any(p => !p.IsOptional)) { - return base.OnMessageReceived(args); + return base.OnMessageReceived(message); } for (var index = 0; index < arguments.Length; index++) @@ -297,10 +296,10 @@ public sealed class CommandsExtension : VirtualParadiseClientExtension return task; } - return base.OnMessageReceived(args); + return base.OnMessageReceived(message); } - return base.OnMessageReceived(args); + return base.OnMessageReceived(message); } private void RegisterCommandMethod(CommandModule module, MethodInfo methodInfo)