Commit 3bb844d1 authored by Mrs4s's avatar Mrs4s

support group quit.

parent 0fdb01e8
...@@ -46,6 +46,7 @@ ...@@ -46,6 +46,7 @@
| /set_group_kick | [群组T人](https://cqhttp.cc/docs/4.15/#/API?id=set_group_kick-群组踢人) | | /set_group_kick | [群组T人](https://cqhttp.cc/docs/4.15/#/API?id=set_group_kick-群组踢人) |
| /set_group_ban | [群组单人禁言](https://cqhttp.cc/docs/4.15/#/API?id=set_group_ban-群组单人禁言) | | /set_group_ban | [群组单人禁言](https://cqhttp.cc/docs/4.15/#/API?id=set_group_ban-群组单人禁言) |
| /set_group_whole_ban | [群组全员禁言](https://cqhttp.cc/docs/4.15/#/API?id=set_group_whole_ban-群组全员禁言) | | /set_group_whole_ban | [群组全员禁言](https://cqhttp.cc/docs/4.15/#/API?id=set_group_whole_ban-群组全员禁言) |
| /set_group_leave | [退出群组](https://cqhttp.cc/docs/4.15/#/API?id=set_group_leave-退出群组) |
| /set_group_name | 设置群组名(拓展API) | | /set_group_name | 设置群组名(拓展API) |
| /get_image | 获取图片信息(拓展API) | | /get_image | 获取图片信息(拓展API) |
| /get_group_msg | 获取群组消息(拓展API) | | /get_group_msg | 获取群组消息(拓展API) |
......
...@@ -273,6 +273,15 @@ func (bot *CQBot) CQSetGroupWholeBan(groupId int64, enable bool) MSG { ...@@ -273,6 +273,15 @@ func (bot *CQBot) CQSetGroupWholeBan(groupId int64, enable bool) MSG {
return Failed(100) return Failed(100)
} }
// https://cqhttp.cc/docs/4.15/#/API?id=set_group_leave-%E9%80%80%E5%87%BA%E7%BE%A4%E7%BB%84
func (bot *CQBot) CQSetGroupLeave(groupId int64) MSG {
if g := bot.Client.FindGroup(groupId); g != nil {
g.Quit()
return OK(nil)
}
return Failed(100)
}
// https://cqhttp.cc/docs/4.15/#/API?id=set_friend_add_request-%E5%A4%84%E7%90%86%E5%8A%A0%E5%A5%BD%E5%8F%8B%E8%AF%B7%E6%B1%82 // https://cqhttp.cc/docs/4.15/#/API?id=set_friend_add_request-%E5%A4%84%E7%90%86%E5%8A%A0%E5%A5%BD%E5%8F%8B%E8%AF%B7%E6%B1%82
func (bot *CQBot) CQProcessFriendRequest(flag string, approve bool) MSG { func (bot *CQBot) CQProcessFriendRequest(flag string, approve bool) MSG {
req, ok := bot.friendReqCache.Load(flag) req, ok := bot.friendReqCache.Load(flag)
......
...@@ -3,7 +3,7 @@ module github.com/Mrs4s/go-cqhttp ...@@ -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-20200730171208-f076f2a45730 github.com/Mrs4s/MiraiGo v0.0.0-20200731043935-dbb4073480bb
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
github.com/guonaihong/gout v0.1.1 github.com/guonaihong/gout v0.1.1
......
...@@ -4,6 +4,8 @@ github.com/Mrs4s/MiraiGo v0.0.0-20200730113850-298c1bb9119f h1:+MW9qbGu9uWJc9vs6 ...@@ -4,6 +4,8 @@ github.com/Mrs4s/MiraiGo v0.0.0-20200730113850-298c1bb9119f h1:+MW9qbGu9uWJc9vs6
github.com/Mrs4s/MiraiGo v0.0.0-20200730113850-298c1bb9119f/go.mod h1:M9wh1hjd0rie3+wm27tjPZkYMbD+MBV76CGqp2G7WSU= github.com/Mrs4s/MiraiGo v0.0.0-20200730113850-298c1bb9119f/go.mod h1:M9wh1hjd0rie3+wm27tjPZkYMbD+MBV76CGqp2G7WSU=
github.com/Mrs4s/MiraiGo v0.0.0-20200730171208-f076f2a45730 h1:ZQoh1RyCacWyyJV9+MO9S+kJ5HOQOaA9PLBEGBbL3oA= github.com/Mrs4s/MiraiGo v0.0.0-20200730171208-f076f2a45730 h1:ZQoh1RyCacWyyJV9+MO9S+kJ5HOQOaA9PLBEGBbL3oA=
github.com/Mrs4s/MiraiGo v0.0.0-20200730171208-f076f2a45730/go.mod h1:M9wh1hjd0rie3+wm27tjPZkYMbD+MBV76CGqp2G7WSU= github.com/Mrs4s/MiraiGo v0.0.0-20200730171208-f076f2a45730/go.mod h1:M9wh1hjd0rie3+wm27tjPZkYMbD+MBV76CGqp2G7WSU=
github.com/Mrs4s/MiraiGo v0.0.0-20200731043935-dbb4073480bb h1:L40i56EyeItfy5SN/TRtZL/aLtMDoFIjTTefJBhgU6E=
github.com/Mrs4s/MiraiGo v0.0.0-20200731043935-dbb4073480bb/go.mod h1:M9wh1hjd0rie3+wm27tjPZkYMbD+MBV76CGqp2G7WSU=
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=
......
...@@ -127,6 +127,9 @@ func (s *httpServer) Run(addr, authToken string, bot *coolq.CQBot) { ...@@ -127,6 +127,9 @@ func (s *httpServer) Run(addr, authToken string, bot *coolq.CQBot) {
s.engine.Any("/set_group_name", s.SetGroupName) s.engine.Any("/set_group_name", s.SetGroupName)
s.engine.Any("/set_group_name_async", s.SetGroupName) s.engine.Any("/set_group_name_async", s.SetGroupName)
s.engine.Any("/set_group_leave", s.SetGroupLeave)
s.engine.Any("/set_group_leave_async", s.SetGroupLeave)
s.engine.Any("/get_image", s.GetImage) s.engine.Any("/get_image", s.GetImage)
s.engine.Any("/get_image_async", s.GetImage) s.engine.Any("/get_image_async", s.GetImage)
...@@ -317,6 +320,11 @@ func (s *httpServer) SetGroupName(c *gin.Context) { ...@@ -317,6 +320,11 @@ func (s *httpServer) SetGroupName(c *gin.Context) {
c.JSON(200, s.bot.CQSetGroupName(gid, getParam(c, "name"))) c.JSON(200, s.bot.CQSetGroupName(gid, getParam(c, "name")))
} }
func (s *httpServer) SetGroupLeave(c *gin.Context) {
gid, _ := strconv.ParseInt(getParam(c, "group_id"), 10, 64)
c.JSON(200, s.bot.CQSetGroupLeave(gid))
}
func (s *httpServer) GetForwardMessage(c *gin.Context) { func (s *httpServer) GetForwardMessage(c *gin.Context) {
resId := getParam(c, "message_id") resId := getParam(c, "message_id")
c.JSON(200, s.bot.CQGetForwardMessage(resId)) c.JSON(200, s.bot.CQGetForwardMessage(resId))
......
...@@ -393,6 +393,9 @@ var wsApi = map[string]func(*coolq.CQBot, gjson.Result) coolq.MSG{ ...@@ -393,6 +393,9 @@ var wsApi = map[string]func(*coolq.CQBot, gjson.Result) coolq.MSG{
"set_group_name": func(bot *coolq.CQBot, p gjson.Result) coolq.MSG { "set_group_name": func(bot *coolq.CQBot, p gjson.Result) coolq.MSG {
return bot.CQSetGroupName(p.Get("group_id").Int(), p.Get("name").Str) return bot.CQSetGroupName(p.Get("group_id").Int(), p.Get("name").Str)
}, },
"set_group_leave": func(bot *coolq.CQBot, p gjson.Result) coolq.MSG {
return bot.CQSetGroupLeave(p.Get("group_id").Int())
},
"get_image": func(bot *coolq.CQBot, p gjson.Result) coolq.MSG { "get_image": func(bot *coolq.CQBot, p gjson.Result) coolq.MSG {
return bot.CQGetImage(p.Get("file").Str) return bot.CQGetImage(p.Get("file").Str)
}, },
......
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