mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2026-02-12 10:10:25 +00:00
✏️ drop pb in timer
This commit is contained in:
@@ -2,9 +2,9 @@ package main
|
||||
|
||||
import (
|
||||
"crypto/md5"
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
"os"
|
||||
"unsafe"
|
||||
|
||||
"github.com/RomiChan/protobuf/proto"
|
||||
"github.com/wdvxdr1123/ZeroBot/utils/helper"
|
||||
@@ -37,7 +37,7 @@ func main() {
|
||||
}
|
||||
for _, d := range compo.Array {
|
||||
s := md5.Sum(helper.StringToBytes(d))
|
||||
i := *(*int64)(unsafe.Pointer(&s))
|
||||
i := int64(binary.LittleEndian.Uint64(s[:8]))
|
||||
fmt.Printf("[Diana]id: %d\n", i)
|
||||
err = db.Insert("text", &Text{
|
||||
Id: i,
|
||||
|
||||
@@ -3,8 +3,8 @@ package data
|
||||
|
||||
import (
|
||||
"crypto/md5"
|
||||
"encoding/binary"
|
||||
"os"
|
||||
"unsafe"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
"github.com/wdvxdr1123/ZeroBot/utils/helper"
|
||||
@@ -56,8 +56,8 @@ func LoadText() error {
|
||||
// AddText 添加小作文
|
||||
func AddText(txt string) error {
|
||||
s := md5.Sum(helper.StringToBytes(txt))
|
||||
i := *(*int64)(unsafe.Pointer(&s))
|
||||
return db.Insert("text", &Text{Id: i, Data: txt})
|
||||
i := binary.LittleEndian.Uint64(s[:8])
|
||||
return db.Insert("text", &Text{Id: int64(i), Data: txt})
|
||||
}
|
||||
|
||||
// RandText 随机小作文
|
||||
|
||||
Reference in New Issue
Block a user