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

feature get_group_system_msg.

This commit is contained in:
Mrs4s 2020-10-25 22:03:14 +08:00
parent 1b63a15bbe
commit 6ad0d68978
5 changed files with 22 additions and 1 deletions

View File

@ -666,6 +666,15 @@ func (bot *CQBot) CQGetMessage(messageId int32) MSG {
})
}
func (bot *CQBot) CQGetGroupSystemMessages() MSG {
msg, err := bot.Client.GetGroupSystemMessages()
if err != nil {
log.Warnf("获取群系统消息失败: %v", err)
return Failed(100)
}
return OK(msg)
}
func (bot *CQBot) CQCanSendImage() MSG {
return OK(MSG{"yes": true})
}

2
go.mod
View File

@ -3,7 +3,7 @@ module github.com/Mrs4s/go-cqhttp
go 1.14
require (
github.com/Mrs4s/MiraiGo v0.0.0-20201024092610-03d2bbf32a4d
github.com/Mrs4s/MiraiGo v0.0.0-20201025135955-5be0ad946177
github.com/gin-gonic/gin v1.6.3
github.com/gorilla/websocket v1.4.2
github.com/guonaihong/gout v0.1.3

2
go.sum
View File

@ -8,6 +8,8 @@ github.com/Mrs4s/MiraiGo v0.0.0-20201017083749-517ddcd50b8d h1:f59SuqT0RVy6T9nAg
github.com/Mrs4s/MiraiGo v0.0.0-20201017083749-517ddcd50b8d/go.mod h1:cwYPI2uq6nxNbx0nA6YuAKF1V5szSs6FPlGVLQvRUlo=
github.com/Mrs4s/MiraiGo v0.0.0-20201024092610-03d2bbf32a4d h1:g200Tv/mkCy6oSFqfOzblMfa3D50iNhyG7IUUQWkb78=
github.com/Mrs4s/MiraiGo v0.0.0-20201024092610-03d2bbf32a4d/go.mod h1:cwYPI2uq6nxNbx0nA6YuAKF1V5szSs6FPlGVLQvRUlo=
github.com/Mrs4s/MiraiGo v0.0.0-20201025135955-5be0ad946177 h1:TcKqPWXKvOKW2O80rbswKYVLBB3Xas3+RvRInVMyBm8=
github.com/Mrs4s/MiraiGo v0.0.0-20201025135955-5be0ad946177/go.mod h1:cwYPI2uq6nxNbx0nA6YuAKF1V5szSs6FPlGVLQvRUlo=
github.com/bwmarrin/snowflake v0.3.0 h1:xm67bEhkKh6ij1790JB83OujPR5CzNe8QuQqAgISZN0=
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=

View File

@ -318,6 +318,10 @@ func (s *httpServer) GetForwardMessage(c *gin.Context) {
c.JSON(200, s.bot.CQGetForwardMessage(resId))
}
func (s *httpServer) GetGroupSystemMessage(c *gin.Context) {
c.JSON(200, s.bot.CQGetGroupSystemMessages())
}
func (s *httpServer) DeleteMessage(c *gin.Context) {
mid, _ := strconv.ParseInt(getParam(c, "message_id"), 10, 32)
c.JSON(200, s.bot.CQDeleteMessage(int32(mid)))
@ -505,6 +509,9 @@ var httpApi = map[string]func(s *httpServer, c *gin.Context){
"get_msg": func(s *httpServer, c *gin.Context) {
s.GetMessage(c)
},
"get_group_system_msg": func(s *httpServer, c *gin.Context) {
s.GetGroupSystemMessage(c)
},
"get_group_honor_info": func(s *httpServer, c *gin.Context) {
s.GetGroupHonorInfo(c)
},

View File

@ -495,6 +495,9 @@ var wsApi = map[string]func(*coolq.CQBot, gjson.Result) coolq.MSG{
"get_version_info": func(bot *coolq.CQBot, p gjson.Result) coolq.MSG {
return bot.CQGetVersionInfo()
},
"get_group_system_msg": func(bot *coolq.CQBot, p gjson.Result) coolq.MSG {
return bot.CQGetGroupSystemMessages()
},
"_get_vip_info": func(bot *coolq.CQBot, p gjson.Result) coolq.MSG {
return bot.CQGetVipInfo(p.Get("user_id").Int())
},