mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-13 02:38:27 -04:00
Part2 of the response system rework
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user