From 89b23632f5ceeebd82132210c1407dc9514a547b Mon Sep 17 00:00:00 2001 From: Anhgelus Morhtuuzh Date: Sat, 7 Mar 2026 13:20:56 +0100 Subject: feat(gokord): replace snowflake by uint --- user/state.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'user/state.go') diff --git a/user/state.go b/user/state.go index d1f84b5..9f1c90e 100644 --- a/user/state.go +++ b/user/state.go @@ -3,6 +3,7 @@ package user import ( "context" "errors" + "fmt" "math" "sync" "time" @@ -22,8 +23,8 @@ type XPCached struct { type CopaingCached struct { ID uint - DiscordID string - GuildID string + DiscordID uint64 + GuildID uint64 XP uint XPs []XPCached XPToAdd uint @@ -130,8 +131,8 @@ func KeyCopaingCached(c *Copaing) string { return KeyCopaingCachedRaw(c.GuildID, c.DiscordID) } -func KeyCopaingCachedRaw(guildID, copaingID string) string { - return guildID + ":" + copaingID +func KeyCopaingCachedRaw(guildID, copaingID uint64) string { + return fmt.Sprintf("%d:%d", guildID, copaingID) } type State struct { @@ -176,7 +177,7 @@ func deepCopy(src CopaingCached) CopaingCached { return res } -func (s *State) Copaing(guildID, copaingID string) (*CopaingCached, error) { +func (s *State) Copaing(guildID, copaingID uint64) (*CopaingCached, error) { s.mu.RLock() defer s.mu.RUnlock() @@ -187,7 +188,7 @@ func (s *State) Copaing(guildID, copaingID string) (*CopaingCached, error) { return &c, nil } -func (s *State) Copaings(guild string) []CopaingCached { +func (s *State) Copaings(guild uint64) []CopaingCached { s.mu.RLock() defer s.mu.RUnlock() -- cgit v1.2.3