diff options
| author | Anhgelus Morhtuuzh <anhgelus.morhtuuzh@proton.me> | 2024-04-15 18:47:52 +0200 |
|---|---|---|
| committer | Anhgelus Morhtuuzh <anhgelus.morhtuuzh@proton.me> | 2024-04-15 18:47:52 +0200 |
| commit | 2aaeb2115b25952b71113a683b466c00cb92e690 (patch) | |
| tree | 6d95b74f7d7e7efcccba5b46200d4c3e161263f3 /xp/member.go | |
| parent | c1e4653a5c7ae34dd23d442f67a171eff466aad3 (diff) | |
feat(xp): basic reducer
Diffstat (limited to 'xp/member.go')
| -rw-r--r-- | xp/member.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/xp/member.go b/xp/member.go index bcfcedf..fc01ec0 100644 --- a/xp/member.go +++ b/xp/member.go @@ -2,6 +2,7 @@ package xp import ( "context" + "errors" "fmt" "github.com/anhgelus/gokord" "github.com/anhgelus/gokord/utils" @@ -77,7 +78,9 @@ func (c *Copaing) HourSinceLastEvent() uint { } u := c.GetUserBase() res := client.Get(context.Background(), fmt.Sprintf("%s:%s", u.GenKey(), LastEvent)) - if res.Err() != nil { + if errors.Is(res.Err(), redis.Nil) { + return 0 + } else if res.Err() != nil { utils.SendAlert("xp/member.go - Getting last event", res.Err().Error(), "base_key", u.GenKey()) return 0 } |
