Commit 69675aa0 authored by Mrs4s's avatar Mrs4s

fix #75.

parent 782a3e2a
...@@ -229,6 +229,14 @@ func (s *httpServer) GetGroupMemberInfo(c *gin.Context) { ...@@ -229,6 +229,14 @@ func (s *httpServer) GetGroupMemberInfo(c *gin.Context) {
} }
func (s *httpServer) SendMessage(c *gin.Context) { func (s *httpServer) SendMessage(c *gin.Context) {
if getParam(c, "message_type") == "private" {
s.SendPrivateMessage(c)
return
}
if getParam(c, "message_type") == "group" {
s.SendGroupMessage(c)
return
}
if getParam(c, "group_id") != "" { if getParam(c, "group_id") != "" {
s.SendGroupMessage(c) s.SendGroupMessage(c)
return return
......
...@@ -331,6 +331,12 @@ var wsApi = map[string]func(*coolq.CQBot, gjson.Result) coolq.MSG{ ...@@ -331,6 +331,12 @@ var wsApi = map[string]func(*coolq.CQBot, gjson.Result) coolq.MSG{
) )
}, },
"send_msg": func(bot *coolq.CQBot, p gjson.Result) coolq.MSG { "send_msg": func(bot *coolq.CQBot, p gjson.Result) coolq.MSG {
if p.Get("message_type").Str == "private" {
return bot.CQSendPrivateMessage(p.Get("user_id").Int(), p.Get("message"))
}
if p.Get("message_type").Str == "group" {
return bot.CQSendGroupMessage(p.Get("group_id").Int(), p.Get("message"))
}
if p.Get("group_id").Int() != 0 { if p.Get("group_id").Int() != 0 {
return bot.CQSendGroupMessage(p.Get("group_id").Int(), p.Get("message")) return bot.CQSendGroupMessage(p.Get("group_id").Int(), p.Get("message"))
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment