Esempio n. 1
0
        public async Task PingAsync(EventContext e)
        {
            (await e.CreateEmbedBuilder()
             .WithTitle(new RawResource("Ping"))
             .WithDescription("ping_placeholder")
             .Build()
             .QueueToChannelAsync(e.Channel))
            .ThenWait(200)
            .Then(async x =>
            {
                float ping         = (float)(x.Timestamp - e.message.Timestamp).TotalMilliseconds;
                DiscordEmbed embed = new EmbedBuilder()
                                     .SetTitle("Pong - " + Environment.MachineName)
                                     .SetColor(Color.Lerp(new Color(0.0f, 1.0f, 0.0f), new Color(1.0f, 0.0f, 0.0f), Math.Min(ping / 1000, 1f)))
                                     .AddInlineField("Miki", ((int)ping).ToFormattedString() + "ms").ToEmbed();

                await embed.EditAsync(x);
            });
        }