Skip to content

Commit 39e201f

Browse files
committed
Add new timestamp styles
discord/discord-api-docs#7922
1 parent 7487043 commit 39e201f

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

discord/mentionable.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ var (
1616
MentionTypeRole = MentionType{regexp.MustCompile(`<@&(\d+)>`)}
1717
MentionTypeChannel = MentionType{regexp.MustCompile(`<#(\d+)>`)}
1818
MentionTypeEmoji = MentionType{regexp.MustCompile(`<a?:(\w+):(\d+)>`)}
19-
MentionTypeTimestamp = MentionType{regexp.MustCompile(`<t:(?P<time>-?\d{1,17})(?::(?P<format>[tTdDfFR]))?>`)}
19+
MentionTypeTimestamp = MentionType{regexp.MustCompile(`<t:(?P<time>-?\d{1,17})(?::(?P<format>[tTdDfFsSR]))?>`)}
2020
MentionTypeSlashCommand = MentionType{regexp.MustCompile(`</(\w+) ?((\w+)|(\w+ \w+)):(\d+)>`)}
2121
MentionTypeHere = MentionType{regexp.MustCompile(`@here`)}
2222
MentionTypeEveryone = MentionType{regexp.MustCompile(`@everyone`)}

discord/timestamp.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ const (
3535
// TimestampStyleLongDateTime formats time as Tuesday, 20 April 2021 16:20
3636
TimestampStyleLongDateTime TimestampStyle = "F"
3737

38+
// TimestampStyleShortDateShortTime formats time as 20/04/2021, 16:20
39+
TimestampStyleShortDateShortTime TimestampStyle = "s"
40+
41+
// TimestampStyleShortDateMediumTime formats time as 20/04/2021, 16:20:30
42+
TimestampStyleShortDateMediumTime TimestampStyle = "S"
43+
3844
// TimestampStyleRelative formats time as 2 months ago
3945
TimestampStyleRelative TimestampStyle = "R"
4046
)

0 commit comments

Comments
 (0)