mirror of
https://github.com/TeamOctolings/Octobot.git
synced 2025-04-20 00:43:36 +03:00
Use TimestampStyles
Signed-off-by: Macintosh II <mctaylxrs@outlook.com>
This commit is contained in:
parent
6ba2127b35
commit
6a2fed4571
1 changed files with 16 additions and 6 deletions
|
@ -324,9 +324,9 @@ public class ToolsCommandGroup : CommandGroup
|
||||||
|
|
||||||
private async Task<Result> SendRandomNumberAsync(TimeSpan? offset, IUser user, CancellationToken ct)
|
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)
|
if (offset is not null)
|
||||||
{
|
{
|
||||||
|
@ -334,11 +334,21 @@ public class ToolsCommandGroup : CommandGroup
|
||||||
Messages.TimestampOffset, Markdown.InlineCode(offset.ToString() ?? string.Empty))).AppendLine();
|
Messages.TimestampOffset, Markdown.InlineCode(offset.ToString() ?? string.Empty))).AppendLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
string[] options = { "d", "D", "t", "T", "f", "F", "R" };
|
TimestampStyle[] allStyles =
|
||||||
foreach (var option in options)
|
|
||||||
{
|
{
|
||||||
description.Append("- ").Append(Markdown.InlineCode($"<t:{timestamp}:{option}>"))
|
TimestampStyle.ShortDate,
|
||||||
.Append(" — ").AppendLine($"<t:{timestamp}:{option}>");
|
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(
|
var embed = new EmbedBuilder().WithSmallTitle(
|
||||||
|
|
Loading…
Add table
Reference in a new issue