@@ -5,9 +5,11 @@ import (
5
5
"math"
6
6
"os"
7
7
"strconv"
8
+ "strings"
8
9
"time"
9
10
10
11
"github.com/FloatTech/AnimeAPI/wallet"
12
+ "github.com/FloatTech/floatbox/binary"
11
13
"github.com/FloatTech/floatbox/file"
12
14
ctrl "github.com/FloatTech/zbpctrl"
13
15
"github.com/FloatTech/zbputils/control"
@@ -41,7 +43,7 @@ func init() {
41
43
if err != nil {
42
44
panic (err )
43
45
}
44
- coinName = string (content )
46
+ coinName = binary . BytesToString (content )
45
47
} else {
46
48
// 旧版本数据
47
49
coinName = "ATRI币"
@@ -136,10 +138,10 @@ func init() {
136
138
}
137
139
ctx .SendChain (message .Image ("file:///" + file .BOTPATH + "/" + drawedFile ))
138
140
})
139
- en .OnRegex ( `^ 设置硬币名称\s*(.*)$` , zero .OnlyToMe , zero .SuperUserPermission ).SetBlock (true ).
141
+ en .OnPrefix ( " 设置硬币名称" , zero .OnlyToMe , zero .SuperUserPermission ).SetBlock (true ).
140
142
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 )
143
145
if err != nil {
144
146
ctx .SendChain (message .Text ("ERROR: " , err ))
145
147
return
0 commit comments