2022-08-30 18:15:01 +03:00
|
|
|
|
namespace Boyfriend.Commands;
|
2022-01-18 20:38:15 +03:00
|
|
|
|
|
2022-09-18 17:41:29 +03:00
|
|
|
|
public sealed class PingCommand : ICommand {
|
|
|
|
|
public string[] Aliases { get; } = { "ping", "latency", "pong", "пинг", "задержка", "понг" };
|
2022-01-18 20:38:15 +03:00
|
|
|
|
|
2022-09-18 17:41:29 +03:00
|
|
|
|
public Task RunAsync(CommandProcessor cmd, string[] args, string[] cleanArgs) {
|
2022-05-14 16:12:24 +03:00
|
|
|
|
var builder = Boyfriend.StringBuilder;
|
2022-01-18 20:38:15 +03:00
|
|
|
|
|
2022-08-30 18:15:01 +03:00
|
|
|
|
builder.Append(Utils.GetBeep())
|
|
|
|
|
.Append(Math.Abs(DateTimeOffset.Now.Subtract(cmd.Context.Message.Timestamp).TotalMilliseconds))
|
|
|
|
|
.Append(Messages.Milliseconds);
|
2022-05-14 16:12:24 +03:00
|
|
|
|
|
2022-08-30 18:15:01 +03:00
|
|
|
|
cmd.Reply(builder.ToString(), ":signal_strength: ");
|
2022-05-14 16:12:24 +03:00
|
|
|
|
builder.Clear();
|
2022-01-18 20:38:15 +03:00
|
|
|
|
|
2022-05-14 16:12:24 +03:00
|
|
|
|
return Task.CompletedTask;
|
2022-01-18 20:38:15 +03:00
|
|
|
|
}
|
2022-09-18 17:41:29 +03:00
|
|
|
|
}
|