This commit is contained in:
JustArchi 2019-01-12 17:48:56 +01:00
parent 1bbdce06c4
commit 7aff2ecbb1
2 changed files with 5 additions and 5 deletions

View file

@ -72,14 +72,14 @@ namespace ArchiSteamFarm {
}
[PublicAPI]
public async Task<string> Response(ulong steamID, string message) {
public async Task<string> Response(ulong steamID, string message, bool useCommandPrefix = true) {
if ((steamID == 0) || string.IsNullOrEmpty(message)) {
Bot.ArchiLogger.LogNullError(nameof(steamID) + " || " + nameof(message));
return null;
}
if (!string.IsNullOrEmpty(Program.GlobalConfig.CommandPrefix)) {
if (useCommandPrefix && !string.IsNullOrEmpty(Program.GlobalConfig.CommandPrefix)) {
if (!message.StartsWith(Program.GlobalConfig.CommandPrefix, StringComparison.Ordinal)) {
string pluginsResponse = await Core.OnBotMessage(Bot, steamID, message).ConfigureAwait(false);

View file

@ -55,11 +55,11 @@ namespace ArchiSteamFarm.IPC.Controllers.Api {
return BadRequest(new GenericResponse<string>(false, Strings.ErrorNoBotsDefined));
}
if (!string.IsNullOrEmpty(Program.GlobalConfig.CommandPrefix) && !command.StartsWith(Program.GlobalConfig.CommandPrefix, StringComparison.Ordinal)) {
command = Program.GlobalConfig.CommandPrefix + command;
if (!string.IsNullOrEmpty(Program.GlobalConfig.CommandPrefix) && command.StartsWith(Program.GlobalConfig.CommandPrefix, StringComparison.Ordinal)) {
command = command.Substring(Program.GlobalConfig.CommandPrefix.Length);
}
string response = await targetBot.Commands.Response(Program.GlobalConfig.SteamOwnerID, command).ConfigureAwait(false);
string response = await targetBot.Commands.Response(Program.GlobalConfig.SteamOwnerID, command, false).ConfigureAwait(false);
return Ok(new GenericResponse<string>(response));
}