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:
parent
52c911056e
commit
e319f2645e
@ -468,8 +468,8 @@ func (bot *CQBot) ToElement(t string, d map[string]string, group bool) (message.
|
|||||||
template := CQCodeEscapeValue(d["data"])
|
template := CQCodeEscapeValue(d["data"])
|
||||||
//println(template)
|
//println(template)
|
||||||
i, _ := strconv.ParseInt(resId, 10, 64)
|
i, _ := strconv.ParseInt(resId, 10, 64)
|
||||||
msg :=global.NewXmlMsg(template,i)
|
msg := global.NewXmlMsg(template, i)
|
||||||
return msg,nil
|
return msg, nil
|
||||||
default:
|
default:
|
||||||
return nil, errors.New("unsupported cq code: " + t)
|
return nil, errors.New("unsupported cq code: " + t)
|
||||||
}
|
}
|
||||||
|
2
go.mod
2
go.mod
@ -3,7 +3,7 @@ module github.com/Mrs4s/go-cqhttp
|
|||||||
go 1.14
|
go 1.14
|
||||||
|
|
||||||
require (
|
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/fastly/go-utils v0.0.0-20180712184237-d95a45783239 // indirect
|
||||||
github.com/gin-gonic/gin v1.6.3
|
github.com/gin-gonic/gin v1.6.3
|
||||||
github.com/gorilla/websocket v1.4.2
|
github.com/gorilla/websocket v1.4.2
|
||||||
|
6
go.sum
6
go.sum
@ -1,9 +1,7 @@
|
|||||||
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
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/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-20200824164833-834baa5b6b58 h1:bQDlJSgZmQh9fOMF7yWwL6w2HDm2YUmJlW871WQ404U=
|
||||||
github.com/Mrs4s/MiraiGo v0.0.0-20200823075559-507fe33e842d/go.mod h1:0je03wji/tSw4bUH4QCF2Z4/EjyNWjSJTyy5tliX6EM=
|
github.com/Mrs4s/MiraiGo v0.0.0-20200824164833-834baa5b6b58/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/bwmarrin/snowflake v0.3.0 h1:xm67bEhkKh6ij1790JB83OujPR5CzNe8QuQqAgISZN0=
|
github.com/bwmarrin/snowflake v0.3.0 h1:xm67bEhkKh6ij1790JB83OujPR5CzNe8QuQqAgISZN0=
|
||||||
github.com/bwmarrin/snowflake v0.3.0/go.mod h1:NdZxfVWX+oR6y2K0o6qAYv6gIOP9rjG0/E9WsDpxqwE=
|
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=
|
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||||
|
10
main.go
10
main.go
@ -171,6 +171,16 @@ func main() {
|
|||||||
time.Sleep(time.Second * 5)
|
time.Sleep(time.Second * 5)
|
||||||
log.Info("开始尝试登录并同步消息...")
|
log.Info("开始尝试登录并同步消息...")
|
||||||
cli := client.NewClient(conf.Uin, conf.Password)
|
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()
|
rsp, err := cli.Login()
|
||||||
for {
|
for {
|
||||||
global.Check(err)
|
global.Check(err)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user