public async Task GetCopperPriceAsync()
        {
            try
            {
                using (Context.Channel.EnterTypingState())
                {
                    MetalResponse result = await MetalService.GetCopperPrice();

                    if (result != null)
                    {
                        EmbedBuilder embed = await MetalService.CreateMetalEmbedAsync(result);

                        embed.AddCommandDeprecationNotice(Configuration);
                        await ReplyAsync(embed : embed.Build());
                    }
                    else
                    {
                        await ReplyAsync(REQUEST_ERROR_MESSAGE);
                    }
                }
            }
            catch (Exception ex)
            {
                await SendErrorReply(ex);
            }
        }
Beispiel #2
0
 public async Task GetCopperPriceAsync()
 {
     await DeferAsync().ContinueWith(async(task) =>
     {
         try
         {
             MetalResponse result = await MetalService.GetCopperPrice();
             if (result != null)
             {
                 EmbedBuilder embed = await MetalService.CreateMetalEmbedAsync(result);
                 await SendDeferredEmbedAsync(embed.Build());
             }
             else
             {
                 await SendDeferredApiErrorResponseAsync();
             }
         }
         catch (Exception ex)
         {
             await SendDeferredErrorResponseAsync(ex);
         }
     });
 }