diff options
author | Jordan <me@jordan.im> | 2022-02-10 19:10:54 -0700 |
---|---|---|
committer | Jordan <me@jordan.im> | 2022-02-10 19:10:54 -0700 |
commit | 2f0b35e3c25bc4394f3288e1baa77d250cb510ed (patch) | |
tree | 121612506bb8de7fc132a385b282f1d02922d65d /vendor/github.com/bwmarrin/discordgo/util.go | |
parent | 7d1248be0bd4a6412467301924fa99d037028b8d (diff) | |
download | keep-2f0b35e3c25bc4394f3288e1baa77d250cb510ed.tar.gz keep-2f0b35e3c25bc4394f3288e1baa77d250cb510ed.zip |
misc: go mod vendor
Diffstat (limited to 'vendor/github.com/bwmarrin/discordgo/util.go')
-rw-r--r-- | vendor/github.com/bwmarrin/discordgo/util.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/vendor/github.com/bwmarrin/discordgo/util.go b/vendor/github.com/bwmarrin/discordgo/util.go new file mode 100644 index 0000000..8a2b2e0 --- /dev/null +++ b/vendor/github.com/bwmarrin/discordgo/util.go @@ -0,0 +1,17 @@ +package discordgo + +import ( + "strconv" + "time" +) + +// SnowflakeTimestamp returns the creation time of a Snowflake ID relative to the creation of Discord. +func SnowflakeTimestamp(ID string) (t time.Time, err error) { + i, err := strconv.ParseInt(ID, 10, 64) + if err != nil { + return + } + timestamp := (i >> 22) + 1420070400000 + t = time.Unix(0, timestamp*1000000) + return +} |