mirror of
https://github.com/Mrs4s/go-cqhttp.git
synced 2025-05-05 03:23:49 +08:00
feature get_group_at_all_remain.
This commit is contained in:
parent
cbbe196f26
commit
474de6ad3d
11
coolq/api.go
11
coolq/api.go
@ -428,6 +428,17 @@ func (bot *CQBot) CQSetGroupLeave(groupId int64) MSG {
|
||||
return Failed(100, "GROUP_NOT_FOUND", "群聊不存在")
|
||||
}
|
||||
|
||||
func (bot *CQBot) CQGetAtAllRemain(groupId int64) MSG {
|
||||
if g := bot.Client.FindGroup(groupId); g != nil {
|
||||
i, err := bot.Client.GetAtAllRemain(groupId)
|
||||
if err != nil {
|
||||
return Failed(100, "GROUP_REMAIN_API_ERROR", err.Error())
|
||||
}
|
||||
return OK(i)
|
||||
}
|
||||
return Failed(100, "GROUP_NOT_FOUND", "群聊不存在")
|
||||
}
|
||||
|
||||
// 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 {
|
||||
req, ok := bot.friendReqCache.Load(flag)
|
||||
|
@ -394,6 +394,11 @@ func GetStrangerInfo(s *httpServer, c *gin.Context) {
|
||||
c.JSON(200, s.bot.CQGetStrangerInfo(uid))
|
||||
}
|
||||
|
||||
func GetGroupAtAllRemain(s *httpServer, c *gin.Context) {
|
||||
gid, _ := strconv.ParseInt(getParam(c, "group_id"), 10, 64)
|
||||
c.JSON(200, s.bot.CQGetAtAllRemain(gid))
|
||||
}
|
||||
|
||||
func HandleQuickOperation(s *httpServer, c *gin.Context) {
|
||||
if c.Request.Method != "POST" {
|
||||
c.AbortWithStatus(404)
|
||||
@ -514,6 +519,7 @@ var httpApi = map[string]func(s *httpServer, c *gin.Context){
|
||||
".handle_quick_operation": HandleQuickOperation,
|
||||
".ocr_image": OcrImage,
|
||||
"ocr_image": OcrImage,
|
||||
"get_group_at_all_remain": GetGroupAtAllRemain,
|
||||
".get_word_slices": GetWordSlices,
|
||||
}
|
||||
|
||||
|
@ -536,6 +536,9 @@ var wsApi = map[string]func(*coolq.CQBot, gjson.Result) coolq.MSG{
|
||||
"ocr_image": func(bot *coolq.CQBot, p gjson.Result) coolq.MSG {
|
||||
return bot.CQOcrImage(p.Get("image").Str)
|
||||
},
|
||||
"get_group_at_all_remain": func(bot *coolq.CQBot, p gjson.Result) coolq.MSG {
|
||||
return bot.CQGetAtAllRemain(p.Get("group_id").Int())
|
||||
},
|
||||
".get_word_slices": func(bot *coolq.CQBot, p gjson.Result) coolq.MSG {
|
||||
return bot.CQGetWordSlices(p.Get("content").Str)
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user