diff options
| author | Anhgelus Morhtuuzh <william@herges.fr> | 2026-03-07 13:20:56 +0100 |
|---|---|---|
| committer | Anhgelus Morhtuuzh <william@herges.fr> | 2026-03-07 13:29:46 +0100 |
| commit | 89b23632f5ceeebd82132210c1407dc9514a547b (patch) | |
| tree | 647782dc5f1b1148893c10bc8b3e712b6ea8362b /user/state.go | |
| parent | 9da4d0379b10da8b33563dcd280aa2a9586aa3fb (diff) | |
feat(gokord): replace snowflake by uintrefactor/leave-old-gokord
Diffstat (limited to 'user/state.go')
| -rw-r--r-- | user/state.go | 13 |
1 files changed, 7 insertions, 6 deletions
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() |
