Volvo and it's 7-days locks

This commit is contained in:
JustArchi 2015-10-29 17:06:02 +01:00
parent 7c9e5d818e
commit abe3beaee7
3 changed files with 16 additions and 6 deletions

View file

@ -281,7 +281,21 @@ namespace ArchiSteamFarm {
{"tradeofferid", tradeID.ToString()}
};
return await Utilities.UrlPostRequest(request, postData, SteamCookieDictionary, referer).ConfigureAwait(false);
HttpResponseMessage result = await Utilities.UrlPostRequestWithResponse(request, postData, SteamCookieDictionary, referer).ConfigureAwait(false);
bool success = result.IsSuccessStatusCode;
if (!success) {
Logging.LogGenericWarning(Bot.BotName, "Request failed, reason: " + result.ReasonPhrase);
switch (result.StatusCode) {
case HttpStatusCode.InternalServerError:
Logging.LogGenericWarning(Bot.BotName, "That might be caused by 7-days trade lock from new device");
Logging.LogGenericWarning(Bot.BotName, "Try again in 7 days, declining that offer for now");
DeclineTradeOffer(tradeID);
break;
}
}
return success;
}
internal bool DeclineTradeOffer(ulong tradeID) {

View file

@ -86,10 +86,6 @@ namespace ArchiSteamFarm {
success = Bot.ArchiWebHandler.DeclineTradeOffer(tradeID);
}
if (!success) {
Logging.LogGenericWarning(Bot.BotName, "Response <accept: " + tradeAccepted + "> to trade " + tradeID + " failed!");
}
if (tradeAccepted && success) {
// Do whatever we want with success
}

View file

@ -172,7 +172,7 @@ namespace ArchiSteamFarm {
requestMessage.Headers.Referrer = new Uri(referer);
}
HttpResponseMessage responseMessage = await client.SendAsync(requestMessage).ConfigureAwait(false);
if (responseMessage != null && responseMessage.IsSuccessStatusCode) {
if (responseMessage != null) {
result = responseMessage;
}
}