mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2025-12-21 15:30:09 +08:00
✏️ 修复 cd valid 判断
This commit is contained in:
parent
2dc1fbde96
commit
8acf9b817f
@ -10,6 +10,7 @@ import (
|
|||||||
"github.com/wdvxdr1123/ZeroBot/message"
|
"github.com/wdvxdr1123/ZeroBot/message"
|
||||||
"github.com/wdvxdr1123/ZeroBot/utils/helper"
|
"github.com/wdvxdr1123/ZeroBot/utils/helper"
|
||||||
|
|
||||||
|
"github.com/FloatTech/ZeroBot-Plugin/utils/math"
|
||||||
"github.com/FloatTech/ZeroBot-Plugin/utils/process"
|
"github.com/FloatTech/ZeroBot-Plugin/utils/process"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -87,7 +88,7 @@ func isValidToken(tok string) (yes bool) {
|
|||||||
if err == nil {
|
if err == nil {
|
||||||
timebytes := make([]byte, 1, 8)
|
timebytes := make([]byte, 1, 8)
|
||||||
timebytes = append(timebytes, b14.Decode(s)...)
|
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
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,3 +24,11 @@ func Abs(x int) int {
|
|||||||
}
|
}
|
||||||
return x
|
return x
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Abs64 返回绝对值,该函数将被内联
|
||||||
|
func Abs64(x int64) int64 {
|
||||||
|
if x < 0 {
|
||||||
|
return -x
|
||||||
|
}
|
||||||
|
return x
|
||||||
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user