✏️ 修复 cd valid 判断

This commit is contained in:
fumiama
2022-01-06 12:40:48 +08:00
parent 2dc1fbde96
commit 8acf9b817f
2 changed files with 10 additions and 1 deletions

View File

@@ -10,6 +10,7 @@ import (
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/wdvxdr1123/ZeroBot/utils/helper"
"github.com/FloatTech/ZeroBot-Plugin/utils/math"
"github.com/FloatTech/ZeroBot-Plugin/utils/process"
)
@@ -87,7 +88,7 @@ func isValidToken(tok string) (yes bool) {
if err == nil {
timebytes := make([]byte, 1, 8)
timebytes = append(timebytes, b14.Decode(s)...)
yes = time.Now().Unix()-int64(binary.BigEndian.Uint64(timebytes)) < 10
yes = math.Abs64(time.Now().Unix()-int64(binary.BigEndian.Uint64(timebytes))) < 10
}
return
}