From 7e5324d8a8d84d94d62305361be800fbd8338fa3 Mon Sep 17 00:00:00 2001 From: Tyler Thompson Date: Tue, 10 Sep 2024 18:21:07 +0100 Subject: [PATCH] feat: add function SnowFlakeFromString --- discord/types.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/discord/types.go b/discord/types.go index da3044b..1ee6cc8 100644 --- a/discord/types.go +++ b/discord/types.go @@ -43,6 +43,12 @@ func (s Snowflake) String() string { return strconv.FormatInt(int64(s), 10) } +func SnowFlakeFromString(s string) *Snowflake { + i, _ := strconv.ParseInt(s, 10, 64) + sf := Snowflake(i) + return &sf +} + // Time returns the creation time of the Snowflake. func (s Snowflake) Time() time.Time { nsec := (int64(s) >> 22) + DiscordCreation