Skip to content

Commit 51b3b7c

Browse files
committed
chore: make golangci-lint happy
1 parent 3fe55bd commit 51b3b7c

File tree

4 files changed

+17
-5
lines changed

4 files changed

+17
-5
lines changed

commands/infractions.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ func getUserInfractions(guildID, userID snowflake.ID, limit, offset int) (userIn
521521

522522
severity := 0.0
523523
for _, inf := range allInfractions {
524-
diff := time.Now().Sub(inf.CreatedAt)
524+
diff := time.Since(inf.CreatedAt)
525525
severity += utils.CalcHalfLife(diff, guildSettings.InfractionHalfLifeDays, float64(inf.Weight))
526526
}
527527

listeners/joinleave.go

+14
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,13 @@ func OnUserJoin(e *events.GuildMemberJoin) {
4545
}
4646

4747
_, err = e.Client().Rest().CreateMessage(joinLeaveChannel, discord.NewMessageCreateBuilder().SetContent(contents).Build())
48+
if err != nil {
49+
slog.Error("Failed to send join message.",
50+
"guild_id", guildID,
51+
"channel_id", joinLeaveChannel,
52+
"err", err,
53+
)
54+
}
4855
}
4956

5057
func OnUserLeave(e *events.GuildMemberLeave) {
@@ -83,4 +90,11 @@ func OnUserLeave(e *events.GuildMemberLeave) {
8390
}
8491

8592
_, err = e.Client().Rest().CreateMessage(joinLeaveChannel, discord.NewMessageCreateBuilder().SetContent(contents).Build())
93+
if err != nil {
94+
slog.Error("Failed to send leave message.",
95+
"guild_id", guildID,
96+
"channel_id", joinLeaveChannel,
97+
"err", err,
98+
)
99+
}
86100
}

listeners/notify_on_warned_user_join.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func OnWarnedUserJoin(e *events.GuildMemberJoin) {
2828

2929
totalSeverity := 0.0
3030
for _, infraction := range infractions {
31-
diff := time.Now().Sub(infraction.CreatedAt)
31+
diff := time.Since(infraction.CreatedAt)
3232
severity := utils.CalcHalfLife(diff, guildSettings.InfractionHalfLifeDays, float64(infraction.Weight))
3333
totalSeverity += severity
3434
}

task/task.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ import (
66
"time"
77
)
88

9-
func banUntilTask() {
10-
}
11-
129
type TaskStatus int
1310

1411
const (
@@ -39,6 +36,7 @@ type taskImpl struct {
3936
func New(name string, exec func(ctx context.Context), contextValues map[string]any, interval time.Duration) Task {
4037
ctx := context.Background()
4138
for k, v := range contextValues {
39+
//nolint:staticcheck
4240
ctx = context.WithValue(ctx, k, v)
4341
}
4442
ctx, cancelFunc := context.WithCancel(ctx)

0 commit comments

Comments
 (0)