Part2 of the response system rework

This commit is contained in:
Kwoth
2024-04-29 01:13:45 +00:00
parent 4bab94b329
commit d28c7b500d
128 changed files with 2723 additions and 2289 deletions

View File

@@ -25,13 +25,13 @@ public partial class Searches
using var http = _httpFactory.CreateClient();
var res = await http.GetStringAsync($"{XKCD_URL}/info.0.json");
var comic = JsonConvert.DeserializeObject<XkcdComic>(res);
var embed = _eb.Create()
var embed = new EmbedBuilder()
.WithOkColor()
.WithImageUrl(comic.ImageLink)
.WithAuthor(comic.Title, "https://xkcd.com/s/919f27.ico", $"{XKCD_URL}/{comic.Num}")
.AddField(GetText(strs.comic_number), comic.Num.ToString(), true)
.AddField(GetText(strs.date), $"{comic.Month}/{comic.Year}", true);
var sent = await EmbedAsync(embed);
var sent = await Response().Embed(embed).SendAsync();
await Task.Delay(10000);
@@ -39,7 +39,7 @@ public partial class Searches
}
catch (HttpRequestException)
{
await ReplyErrorLocalizedAsync(strs.comic_not_found);
await Response().Error(strs.comic_not_found).SendAsync();
}
return;
@@ -60,14 +60,14 @@ public partial class Searches
var res = await http.GetStringAsync($"{XKCD_URL}/{num}/info.0.json");
var comic = JsonConvert.DeserializeObject<XkcdComic>(res);
var embed = _eb.Create()
var embed = new EmbedBuilder()
.WithOkColor()
.WithImageUrl(comic.ImageLink)
.WithAuthor(comic.Title, "https://xkcd.com/s/919f27.ico", $"{XKCD_URL}/{num}")
.AddField(GetText(strs.comic_number), comic.Num.ToString(), true)
.AddField(GetText(strs.date), $"{comic.Month}/{comic.Year}", true);
var sent = await EmbedAsync(embed);
var sent = await Response().Embed(embed).SendAsync();
await Task.Delay(10000);
@@ -75,7 +75,7 @@ public partial class Searches
}
catch (HttpRequestException)
{
await ReplyErrorLocalizedAsync(strs.comic_not_found);
await Response().Error(strs.comic_not_found).SendAsync();
}
}
}