Skip to content

Commit

Permalink
debug了半天我特么开了自定义消息内容
Browse files Browse the repository at this point in the history
  • Loading branch information
Cyl18 committed Jan 22, 2024
1 parent dc1c31d commit c6b6756
Showing 1 changed file with 24 additions and 11 deletions.
35 changes: 24 additions & 11 deletions WFBot/Features/Commands/SearchCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,10 @@ Task<string> Riven(string word)
public static async Task<List<RivenAuction>> GetRivenAuctions(string urlname)
{
var header = new List<KeyValuePair<string, string>>
{new KeyValuePair<string, string>("Platform", platform)};
{
new KeyValuePair<string, string>("Platform", platform),
new KeyValuePair<string, string>("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36")
};
var auctions = await WebHelper.DownloadJsonAsync<RivenAuctions>(Config.Instance.UseWFBotProxy ? $"https://wfbot.cyan.cafe/api/WFBotProxy/{Config.Instance.WFBotProxyToken}*https://api.warframe.market/v1/auctions/search{Uri.EscapeDataString($"?type=riven&weapon_url_name={urlname}&sort_by=price_desc")}" :
$"https://api.warframe.market/v1/auctions/search?type=riven&weapon_url_name={urlname}&sort_by=price_desc", header);

Expand Down Expand Up @@ -133,20 +136,30 @@ public async Task<string> SendRivenAuctions(string name)
return null;
}
}
var auctions = await GetRivenAuctions(weapon.urlname);

if (AsyncContext.GetUseImageRendering())
try
{
var rivens = auctions.Take(Config.Instance.WFASearchCount).ToList();
var image = ImageRenderHelper.RivenAuction(rivens, weapon);
SendImageAndText(image, rivens.Select(x => x.Owner.IngameName).Connect(", "));
return null;

var auctions = await GetRivenAuctions(weapon.urlname);

if (AsyncContext.GetUseImageRendering())
{
var rivens = auctions.Take(Config.Instance.WFASearchCount).ToList();
var image = ImageRenderHelper.RivenAuction(rivens, weapon);
SendImageAndText(image, rivens.Select(x => x.Owner.IngameName).Connect(", "));
return null;
}
else
{
var msg = WFFormatter.ToString(auctions.Take(Config.Instance.WFASearchCount).ToList(), weapon).AddPlatformInfo();
sb.AppendLine(msg);

}
}
else
catch (Exception e)
{
var msg = WFFormatter.ToString(auctions.Take(Config.Instance.WFASearchCount).ToList(), weapon).AddPlatformInfo();
sb.AppendLine(msg);

Console.WriteLine(e);
throw;
}

}
Expand Down

0 comments on commit c6b6756

Please sign in to comment.