Make IPC respect bot order

This commit is contained in:
JustArchi 2017-09-27 01:06:48 +02:00
parent 47cccc2bee
commit c31ff08192

View file

@ -116,8 +116,8 @@ namespace ArchiSteamFarm {
break;
}
Bot bot = Bot.Bots.Values.FirstOrDefault();
if (bot == null) {
Bot targetBot = Bot.Bots.OrderBy(bot => bot.Key).Select(bot => bot.Value).FirstOrDefault();
if (targetBot == null) {
await context.Response.WriteAsync(HttpStatusCode.NotAcceptable, Strings.ErrorNoBotsDefined).ConfigureAwait(false);
return;
}
@ -126,7 +126,7 @@ namespace ArchiSteamFarm {
command = "!" + command;
}
string response = await bot.Response(Program.GlobalConfig.SteamOwnerID, command).ConfigureAwait(false);
string response = await targetBot.Response(Program.GlobalConfig.SteamOwnerID, command).ConfigureAwait(false);
ASF.ArchiLogger.LogGenericInfo(string.Format(Strings.IPCAnswered, command, response));