@@ -23,18 +23,18 @@ func init() {
2323 en .OnRegex (`^加密\s?(.*)` ).SetBlock (true ).
2424 Handle (func (ctx * zero.Ctx ) {
2525 str := ctx .State ["regex_matched" ].([]string )[1 ]
26- es , err := base14 .UTF16be2utf8 ( base14 . EncodeString (str ) )
27- if err == nil {
28- ctx .SendChain (message .Text (helper . BytesToString ( es ) ))
26+ es := base14 .EncodeString (str )
27+ if es != "" {
28+ ctx .SendChain (message .Text (es ))
2929 } else {
3030 ctx .SendChain (message .Text ("加密失败!" ))
3131 }
3232 })
3333 en .OnRegex (`^解密\s?([一-踀]*[㴁-㴆]?)$` ).SetBlock (true ).
3434 Handle (func (ctx * zero.Ctx ) {
3535 str := ctx .State ["regex_matched" ].([]string )[1 ]
36- es , err := base14 .UTF82utf16be ( helper . StringToBytes ( str ) )
37- if err == nil {
36+ es := base14 .DecodeString ( str )
37+ if es != "" {
3838 ctx .SendChain (message .Text (base14 .DecodeString (es )))
3939 } else {
4040 ctx .SendChain (message .Text ("解密失败!" ))
@@ -44,7 +44,7 @@ func init() {
4444 Handle (func (ctx * zero.Ctx ) {
4545 key , str := ctx .State ["regex_matched" ].([]string )[1 ], ctx .State ["regex_matched" ].([]string )[2 ]
4646 t := getea (key )
47- es , err := base14 .UTF16be2utf8 (base14 .Encode (t .Encrypt (helper .StringToBytes (str ))))
47+ es , err := base14 .UTF16BE2UTF8 (base14 .Encode (t .Encrypt (helper .StringToBytes (str ))))
4848 if err == nil {
4949 ctx .SendChain (message .Text (helper .BytesToString (es )))
5050 } else {
@@ -55,7 +55,7 @@ func init() {
5555 Handle (func (ctx * zero.Ctx ) {
5656 key , str := ctx .State ["regex_matched" ].([]string )[1 ], ctx .State ["regex_matched" ].([]string )[2 ]
5757 t := getea (key )
58- es , err := base14 .UTF82utf16be (helper .StringToBytes (str ))
58+ es , err := base14 .UTF82UTF16BE (helper .StringToBytes (str ))
5959 if err == nil {
6060 ctx .SendChain (message .Text (helper .BytesToString (t .Decrypt (base14 .Decode (es )))))
6161 } else {
0 commit comments