about summary refs log tree commit diff
path: root/Utilities/LibMatrix.Utilities.Bot/Services
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2025-04-24 03:45:11 +0200
committerRory& <root@rory.gay>2025-04-24 03:45:11 +0200
commit3d317764b889e2a92c82f007f80c898ec386c59b (patch)
tree572d45d4ef54c2809ac06aedb771d32de0af503b /Utilities/LibMatrix.Utilities.Bot/Services
parentFix command names with spaces, allow specifying formatted body in MessageBuil... (diff)
downloadLibMatrix-3d317764b889e2a92c82f007f80c898ec386c59b.tar.xz
Fix args when using commands with spaces
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 {