1
0
mirror of https://github.com/Mrs4s/go-cqhttp.git synced 2025-05-05 03:23:49 +08:00

update MiraiGo & more debug & fmt code.

This commit is contained in:
Mrs4s 2020-08-25 00:50:03 +08:00
parent 52c911056e
commit e319f2645e
4 changed files with 15 additions and 7 deletions

View File

@ -468,8 +468,8 @@ func (bot *CQBot) ToElement(t string, d map[string]string, group bool) (message.
template := CQCodeEscapeValue(d["data"])
//println(template)
i, _ := strconv.ParseInt(resId, 10, 64)
msg :=global.NewXmlMsg(template,i)
return msg,nil
msg := global.NewXmlMsg(template, i)
return msg, nil
default:
return nil, errors.New("unsupported cq code: " + t)
}

2
go.mod
View File

@ -3,7 +3,7 @@ module github.com/Mrs4s/go-cqhttp
go 1.14
require (
github.com/Mrs4s/MiraiGo v0.0.0-20200823184203-93de1f445681
github.com/Mrs4s/MiraiGo v0.0.0-20200824164833-834baa5b6b58
github.com/fastly/go-utils v0.0.0-20180712184237-d95a45783239 // indirect
github.com/gin-gonic/gin v1.6.3
github.com/gorilla/websocket v1.4.2

6
go.sum
View File

@ -1,9 +1,7 @@
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/Mrs4s/MiraiGo v0.0.0-20200823075559-507fe33e842d h1:F7ssNQDHqB7NZVwTeADRY+AxKT3eeSlBzfzeZYTUfxM=
github.com/Mrs4s/MiraiGo v0.0.0-20200823075559-507fe33e842d/go.mod h1:0je03wji/tSw4bUH4QCF2Z4/EjyNWjSJTyy5tliX6EM=
github.com/Mrs4s/MiraiGo v0.0.0-20200823184203-93de1f445681 h1:hnaJH7BGD+Sb2Xb59SLpRy+f8B3Rx29Qy53ZM0AbIsE=
github.com/Mrs4s/MiraiGo v0.0.0-20200823184203-93de1f445681/go.mod h1:0je03wji/tSw4bUH4QCF2Z4/EjyNWjSJTyy5tliX6EM=
github.com/Mrs4s/MiraiGo v0.0.0-20200824164833-834baa5b6b58 h1:bQDlJSgZmQh9fOMF7yWwL6w2HDm2YUmJlW871WQ404U=
github.com/Mrs4s/MiraiGo v0.0.0-20200824164833-834baa5b6b58/go.mod h1:0je03wji/tSw4bUH4QCF2Z4/EjyNWjSJTyy5tliX6EM=
github.com/bwmarrin/snowflake v0.3.0 h1:xm67bEhkKh6ij1790JB83OujPR5CzNe8QuQqAgISZN0=
github.com/bwmarrin/snowflake v0.3.0/go.mod h1:NdZxfVWX+oR6y2K0o6qAYv6gIOP9rjG0/E9WsDpxqwE=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=

10
main.go
View File

@ -171,6 +171,16 @@ func main() {
time.Sleep(time.Second * 5)
log.Info("开始尝试登录并同步消息...")
cli := client.NewClient(conf.Uin, conf.Password)
cli.OnLog(func(c *client.QQClient, e *client.LogEvent) {
switch e.Type {
case "INFO":
log.Info("Protocol -> " + e.Message)
case "ERROR":
log.Error("Protocol -> " + e.Message)
case "DEBUG":
log.Debug("Protocol -> " + e.Message)
}
})
rsp, err := cli.Login()
for {
global.Check(err)