mirror of
https://github.com/Mrs4s/go-cqhttp.git
synced 2025-05-06 12:03:50 +08:00
optimization cqcode converter.
This commit is contained in:
parent
1fbaa6107d
commit
93d0d87fbb
@ -1,7 +1,6 @@
|
|||||||
package coolq
|
package coolq
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bufio"
|
|
||||||
"bytes"
|
"bytes"
|
||||||
"crypto/md5"
|
"crypto/md5"
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
@ -353,16 +352,14 @@ func (bot *CQBot) ConvertStringMessage(msg string, group bool) (r []message.IMes
|
|||||||
cqCode = []rune{}
|
cqCode = []rune{}
|
||||||
tempText = []rune{}
|
tempText = []rune{}
|
||||||
}()
|
}()
|
||||||
reader := strings.NewReader(string(cqCode))
|
s := strings.SplitN(string(cqCode), ",", -1)
|
||||||
buf := bufio.NewReader(reader)
|
if len(s) == 0 {
|
||||||
t, _ := buf.ReadString(',')
|
return
|
||||||
t = t[0 : len(t)-1]
|
|
||||||
params := make(map[string]string)
|
|
||||||
for buf.Buffered() > 0 {
|
|
||||||
p, _ := buf.ReadString(',')
|
|
||||||
if strings.HasSuffix(p, ",") {
|
|
||||||
p = p[0 : len(p)-1]
|
|
||||||
}
|
}
|
||||||
|
t := s[0]
|
||||||
|
params := make(map[string]string)
|
||||||
|
for i := 1; i < len(s); i++ {
|
||||||
|
p := s[i]
|
||||||
p = strings.TrimSpace(p)
|
p = strings.TrimSpace(p)
|
||||||
if p == "" {
|
if p == "" {
|
||||||
continue
|
continue
|
||||||
|
Loading…
x
Reference in New Issue
Block a user