about summary refs log tree commit diff
path: root/Utilities/LibMatrix.Utilities.Bot/Services
diff options
context:
space:
mode:
Diffstat (limited to 'Utilities/LibMatrix.Utilities.Bot/Services')
-rw-r--r--Utilities/LibMatrix.Utilities.Bot/Services/CommandListenerHostedService.cs6
1 files changed, 4 insertions, 2 deletions
diff --git a/Utilities/LibMatrix.Utilities.Bot/Services/CommandListenerHostedService.cs b/Utilities/LibMatrix.Utilities.Bot/Services/CommandListenerHostedService.cs

index 750e6a3..a6b5654 100644 --- a/Utilities/LibMatrix.Utilities.Bot/Services/CommandListenerHostedService.cs +++ b/Utilities/LibMatrix.Utilities.Bot/Services/CommandListenerHostedService.cs
@@ -141,11 +141,13 @@ public class CommandListenerHostedService : IHostedService { .SelectMany<ICommand, string>(x => [x.Name, ..x.Aliases ?? []]) .OrderByDescending(x => x.Length) .FirstOrDefault(commandWithoutPrefix.StartsWith); + var args = + usedCommand == null ? [] : commandWithoutPrefix[(usedCommand.Length + 1)..].Split(' '); var ctx = new CommandContext { Room = room, - MessageEvent = @evt, + MessageEvent = evt, Homeserver = _hs, - Args = commandWithoutPrefix.Split(' ').Length == 1 ? [] : commandWithoutPrefix.Split(' ')[1..], + Args = args, CommandName = usedCommand ?? commandWithoutPrefix.Split(' ')[0] }; try {