Use a single message for !mtg and show a searching message when the command starts executing

This commit is contained in:
runebaas 2020-06-19 12:28:22 +02:00
parent e564e80849
commit 9cc944fcc1
No known key found for this signature in database
GPG key ID: 2677AF508D0300D6

View file

@ -28,6 +28,8 @@ namespace Geekbot.net.Commands.Integrations
{ {
try try
{ {
var message = await Context.Channel.SendMessageAsync($":mag: Looking up\"{cardName}\", please wait...");
var service = new CardService(); var service = new CardService();
var result = service var result = service
.Where(x => x.Name, cardName) .Where(x => x.Name, cardName)
@ -37,7 +39,7 @@ namespace Geekbot.net.Commands.Integrations
var card = result.All().Value.FirstOrDefault(); var card = result.All().Value.FirstOrDefault();
if (card == null) if (card == null)
{ {
await ReplyAsync("I couldn't find that card..."); await message.ModifyAsync(properties => properties.Content = ":red_circle: I couldn't find a card with that name...");
return; return;
} }
@ -65,7 +67,11 @@ namespace Geekbot.net.Commands.Integrations
if (card.Legalities != null && card.Legalities.Count > 0) if (card.Legalities != null && card.Legalities.Count > 0)
eb.AddField("Legality", string.Join(", ", card.Legalities.Select(e => e.Format))); eb.AddField("Legality", string.Join(", ", card.Legalities.Select(e => e.Format)));
await ReplyAsync("", false, eb.Build()); await message.ModifyAsync(properties =>
{
properties.Content = string.Empty;
properties.Embed = eb.Build();
});
} }
catch (Exception e) catch (Exception e)
{ {