mirror of
https://github.com/Mrs4s/go-cqhttp.git
synced 2025-05-06 12:03:50 +08:00
feat send CQ:forward
This commit is contained in:
parent
ec3c2d6244
commit
5a8d918d9d
@ -781,7 +781,7 @@ func (bot *CQBot) CQGetMessage(messageId int32) MSG {
|
|||||||
"nickname": sender.Nickname,
|
"nickname": sender.Nickname,
|
||||||
},
|
},
|
||||||
"time": msg["time"],
|
"time": msg["time"],
|
||||||
"message_raw": raw,
|
"raw_message": raw,
|
||||||
"message": ToFormattedMessage(bot.ConvertStringMessage(raw, isGroup), func() int64 {
|
"message": ToFormattedMessage(bot.ConvertStringMessage(raw, isGroup), func() int64 {
|
||||||
if isGroup {
|
if isGroup {
|
||||||
return gid.(int64)
|
return gid.(int64)
|
||||||
|
@ -402,6 +402,12 @@ func (bot *CQBot) ConvertStringMessage(msg string, group bool) (r []message.IMes
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if t == "forward" { // 单独处理转发
|
||||||
|
if id, ok := params["id"]; ok {
|
||||||
|
r = []message.IMessageElement{bot.Client.DownloadForwardMessage(id)}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
elem, err := bot.ToElement(t, params, group)
|
elem, err := bot.ToElement(t, params, group)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
org := "[" + string(cqCode) + "]"
|
org := "[" + string(cqCode) + "]"
|
||||||
@ -475,6 +481,10 @@ func (bot *CQBot) ConvertObjectMessage(m gjson.Result, group bool) (r []message.
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if t == "forward" {
|
||||||
|
r = []message.IMessageElement{bot.Client.DownloadForwardMessage(e.Get("data.id").String())}
|
||||||
|
return
|
||||||
|
}
|
||||||
d := make(map[string]string)
|
d := make(map[string]string)
|
||||||
e.Get("data").ForEach(func(key, value gjson.Result) bool {
|
e.Get("data").ForEach(func(key, value gjson.Result) bool {
|
||||||
d[key.Str] = value.String()
|
d[key.Str] = value.String()
|
||||||
@ -491,7 +501,6 @@ func (bot *CQBot) ConvertObjectMessage(m gjson.Result, group bool) (r []message.
|
|||||||
case []message.IMessageElement:
|
case []message.IMessageElement:
|
||||||
r = append(r, i...)
|
r = append(r, i...)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if m.Type == gjson.String {
|
if m.Type == gjson.String {
|
||||||
return bot.ConvertStringMessage(m.Str, group)
|
return bot.ConvertStringMessage(m.Str, group)
|
||||||
|
2
go.mod
2
go.mod
@ -3,7 +3,7 @@ module github.com/Mrs4s/go-cqhttp
|
|||||||
go 1.15
|
go 1.15
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/Mrs4s/MiraiGo v0.0.0-20201229094454-2476ece99e8f
|
github.com/Mrs4s/MiraiGo v0.0.0-20201231081106-eaa543ae8683
|
||||||
github.com/dustin/go-humanize v1.0.0
|
github.com/dustin/go-humanize v1.0.0
|
||||||
github.com/getlantern/go-update v0.0.0-20190510022740-79c495ab728c
|
github.com/getlantern/go-update v0.0.0-20190510022740-79c495ab728c
|
||||||
github.com/getlantern/golog v0.0.0-20201105130739-9586b8bde3a9 // indirect
|
github.com/getlantern/golog v0.0.0-20201105130739-9586b8bde3a9 // indirect
|
||||||
|
4
go.sum
4
go.sum
@ -1,7 +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-20201229094454-2476ece99e8f h1:zzRPWuR61umlXwBnywlaOL/8ElT8hswZTQG+VHHMBsY=
|
github.com/Mrs4s/MiraiGo v0.0.0-20201231081106-eaa543ae8683 h1:Hh7GPsqvYzfS2sn7oCK5bv1cWGLO/bpLL16w5WBlWv0=
|
||||||
github.com/Mrs4s/MiraiGo v0.0.0-20201229094454-2476ece99e8f/go.mod h1:7brUNAmygY22+PDCUiVT4MLeyvGHDBjW9f+67DKeHTw=
|
github.com/Mrs4s/MiraiGo v0.0.0-20201231081106-eaa543ae8683/go.mod h1:7brUNAmygY22+PDCUiVT4MLeyvGHDBjW9f+67DKeHTw=
|
||||||
github.com/a8m/syncmap v0.0.0-20200818084611-4bbbd178de97/go.mod h1:f3iF7/3t9i9hsYF8DPgT0XeIVyNzevhMCKf2445Q6pE=
|
github.com/a8m/syncmap v0.0.0-20200818084611-4bbbd178de97/go.mod h1:f3iF7/3t9i9hsYF8DPgT0XeIVyNzevhMCKf2445Q6pE=
|
||||||
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=
|
||||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||||
|
Loading…
x
Reference in New Issue
Block a user