aboutsummaryrefslogtreecommitdiff
path: root/commands
diff options
context:
space:
mode:
Diffstat (limited to 'commands')
-rw-r--r--commands/stats.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/commands/stats.go b/commands/stats.go
index cde49a1..0114918 100644
--- a/commands/stats.go
+++ b/commands/stats.go
@@ -2,6 +2,7 @@ package commands
import (
"bytes"
+ "errors"
"gorm.io/gorm"
"image/color"
"io"
@@ -143,8 +144,12 @@ func stats(s *discordgo.Session, i *discordgo.InteractionCreate, days uint, exec
if !ok {
var cp user.Copaing
if err := gokord.DB.First(&cp, raw.CopaingID).Error; err != nil {
- logger.Alert("commands/stats.go - Finding copaing", err.Error(), "id", raw.CopaingID)
- return nil, err
+ if !errors.Is(err, gorm.ErrRecordNotFound) {
+ logger.Alert("commands/stats.go - Finding copaing", err.Error(), "id", raw.CopaingID)
+ return nil, err
+ }
+ logger.Warn("Copaing not found, skipping entry", "old_id", raw.CopaingID)
+ continue
}
copaings[raw.CopaingID] = &cp
}