1
0
Fork 1
mirror of https://github.com/TeamOctolings/Octobot.git synced 2025-04-19 16:33:36 +03:00

Use TimestampStyles

Signed-off-by: Macintosh II <mctaylxrs@outlook.com>
This commit is contained in:
Macintxsh 2023-10-03 00:45:59 +03:00
parent 6ba2127b35
commit 6a2fed4571
Signed by: mctaylors
GPG key ID: 361D326747B61E65

View file

@ -324,9 +324,9 @@ public class ToolsCommandGroup : CommandGroup
private async Task<Result> SendRandomNumberAsync(TimeSpan? offset, IUser user, CancellationToken ct)
{
var timestamp = DateTimeOffset.UtcNow.Add(offset ?? TimeSpan.Zero).ToUnixTimeSeconds().ToString();
var timestamp = DateTimeOffset.UtcNow.Add(offset ?? TimeSpan.Zero).ToUnixTimeSeconds();
var description = new StringBuilder().Append("# ").AppendLine(timestamp);
var description = new StringBuilder().Append("# ").AppendLine(timestamp.ToString());
if (offset is not null)
{
@ -334,11 +334,21 @@ public class ToolsCommandGroup : CommandGroup
Messages.TimestampOffset, Markdown.InlineCode(offset.ToString() ?? string.Empty))).AppendLine();
}
string[] options = { "d", "D", "t", "T", "f", "F", "R" };
foreach (var option in options)
TimestampStyle[] allStyles =
{
description.Append("- ").Append(Markdown.InlineCode($"<t:{timestamp}:{option}>"))
.Append(" — ").AppendLine($"<t:{timestamp}:{option}>");
TimestampStyle.ShortDate,
TimestampStyle.LongDate,
TimestampStyle.ShortTime,
TimestampStyle.LongTime,
TimestampStyle.ShortDateTime,
TimestampStyle.LongDateTime,
TimestampStyle.RelativeTime
};
foreach (var style in allStyles)
{
description.Append("- ").Append(Markdown.InlineCode(Markdown.Timestamp(timestamp, style)))
.Append(" — ").AppendLine(Markdown.Timestamp(timestamp, style));
}
var embed = new EmbedBuilder().WithSmallTitle(