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

fix onebot protocol.

This commit is contained in:
Mrs4s 2020-12-26 00:59:43 +08:00
parent 690384a9a3
commit 569b89a117
2 changed files with 8 additions and 1 deletions

View File

@ -352,6 +352,9 @@ func SetRestart(s *httpServer, c *gin.Context) {
func GetForwardMessage(s *httpServer, c *gin.Context) { func GetForwardMessage(s *httpServer, c *gin.Context) {
resId := getParam(c, "message_id") resId := getParam(c, "message_id")
if resId == "" {
resId = getParam(c, "id")
}
c.JSON(200, s.bot.CQGetForwardMessage(resId)) c.JSON(200, s.bot.CQGetForwardMessage(resId))
} }

View File

@ -481,7 +481,11 @@ var wsApi = map[string]func(*coolq.CQBot, gjson.Result) coolq.MSG{
return bot.CQGetImage(p.Get("file").Str) return bot.CQGetImage(p.Get("file").Str)
}, },
"get_forward_msg": func(bot *coolq.CQBot, p gjson.Result) coolq.MSG { "get_forward_msg": func(bot *coolq.CQBot, p gjson.Result) coolq.MSG {
return bot.CQGetForwardMessage(p.Get("message_id").Str) id := p.Get("message_id").Str
if id == "" {
id = p.Get("id").Str
}
return bot.CQGetForwardMessage(id)
}, },
"get_msg": func(bot *coolq.CQBot, p gjson.Result) coolq.MSG { "get_msg": func(bot *coolq.CQBot, p gjson.Result) coolq.MSG {
return bot.CQGetMessage(int32(p.Get("message_id").Int())) return bot.CQGetMessage(int32(p.Get("message_id").Int()))