aboutsummaryrefslogtreecommitdiff
path: root/exp
diff options
context:
space:
mode:
authorAnhgelus Morhtuuzh <william@herges.fr>2025-08-21 13:26:17 +0200
committerAnhgelus Morhtuuzh <william@herges.fr>2025-08-21 13:26:17 +0200
commitbbfaaaf04b69bf74143cf6974e626ce97296edbc (patch)
tree2388a18f81a7c5b9725680afedf58dd6beab6b60 /exp
parentbda9a5fa8f4af9218bd59364ad6dda2ca26ffc58 (diff)
parent026abcc07a57eeda8a08a746ad2b664e956360f3 (diff)
Merge branch 'main' into refactor/config-command
Diffstat (limited to 'exp')
-rw-r--r--exp/functions.go13
1 files changed, 7 insertions, 6 deletions
diff --git a/exp/functions.go b/exp/functions.go
index 026eb34..2608094 100644
--- a/exp/functions.go
+++ b/exp/functions.go
@@ -2,12 +2,13 @@ package exp
import (
"fmt"
- "github.com/anhgelus/gokord"
"math"
"regexp"
"slices"
"strings"
"time"
+
+ "github.com/anhgelus/gokord"
)
func MessageXP(length uint, diversity uint) uint {
@@ -50,14 +51,14 @@ func LevelXP(level uint) uint {
// TimeStampNDaysBefore returns the timestamp (year-month-day) n days before today
func TimeStampNDaysBefore(n uint) string {
- var y, d int
- var m time.Month
+ var unix time.Time
if gokord.Debug {
- y, m, d = time.Unix(time.Now().Unix()-int64(24*60*60), 0).Date() // reduce time for debug
+ unix = time.Unix(time.Now().Unix()-int64(n), 0) // reduce time for debug
} else {
- y, m, d = time.Unix(time.Now().Unix()-int64(n*24*60*60), 0).Date()
+ unix = time.Unix(time.Now().Unix()-int64(n*24*60*60), 0)
}
- return fmt.Sprintf("%d-%d-%d", y, m, d)
+ unix = unix.UTC()
+ return fmt.Sprintf("%d-%d-%d %d:%d:%d UTC", unix.Year(), unix.Month(), unix.Day(), unix.Hour(), unix.Minute(), unix.Second())
}
func TrimMessage(s string) string {