Skip to content

Commit d5d3db6

Browse files
chore: wallet
1 parent 4cce0da commit d5d3db6

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

plugin/wallet/wallet.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@ import (
55
"math"
66
"os"
77
"strconv"
8+
"strings"
89
"time"
910

1011
"github.com/FloatTech/AnimeAPI/wallet"
12+
"github.com/FloatTech/floatbox/binary"
1113
"github.com/FloatTech/floatbox/file"
1214
ctrl "github.com/FloatTech/zbpctrl"
1315
"github.com/FloatTech/zbputils/control"
@@ -41,7 +43,7 @@ func init() {
4143
if err != nil {
4244
panic(err)
4345
}
44-
coinName = string(content)
46+
coinName = binary.BytesToString(content)
4547
} else {
4648
// 旧版本数据
4749
coinName = "ATRI币"
@@ -136,10 +138,10 @@ func init() {
136138
}
137139
ctx.SendChain(message.Image("file:///" + file.BOTPATH + "/" + drawedFile))
138140
})
139-
en.OnRegex(`^设置硬币名称\s*(.*)$`, zero.OnlyToMe, zero.SuperUserPermission).SetBlock(true).
141+
en.OnPrefix("设置硬币名称", zero.OnlyToMe, zero.SuperUserPermission).SetBlock(true).
140142
Handle(func(ctx *zero.Ctx) {
141-
coinName := ctx.State["regex_matched"].([]string)[1]
142-
err := os.WriteFile(coinNameFile, []byte(coinName), 0644)
143+
coinName := strings.TrimSpace(ctx.State["args"].(string))
144+
err := os.WriteFile(coinNameFile, binary.StringToBytes(coinName), 0644)
143145
if err != nil {
144146
ctx.SendChain(message.Text("ERROR: ", err))
145147
return

0 commit comments

Comments
 (0)