This commit is contained in:
JustArchi
2020-10-14 14:24:53 +02:00
parent 4cd581ec04
commit deb886066b
3 changed files with 10 additions and 8 deletions

View File

@@ -67,11 +67,12 @@ namespace ArchiSteamFarm.IPC.Controllers.Api {
string? commandPrefix = ASF.GlobalConfig != null ? ASF.GlobalConfig.CommandPrefix : GlobalConfig.DefaultCommandPrefix;
if (!string.IsNullOrEmpty(commandPrefix) && command.StartsWith(commandPrefix!, StringComparison.Ordinal)) {
command = command.Substring(commandPrefix!.Length);
if (string.IsNullOrEmpty(command)) {
if (command.Length == commandPrefix!.Length) {
// If the message starts with command prefix and is of the same length as command prefix, then it's just empty command trigger, useless
return BadRequest(new GenericResponse(false, string.Format(Strings.ErrorIsEmpty, nameof(command))));
}
command = command.Substring(commandPrefix!.Length);
}
string? response = await targetBot.Commands.Response(steamOwnerID, command).ConfigureAwait(false);