mirror of
https://github.com/Mrs4s/go-cqhttp.git
synced 2025-05-05 03:23:49 +08:00
update MiraiGo.
This commit is contained in:
parent
322b70c6b5
commit
cb9599271a
@ -342,7 +342,7 @@ func (bot *CQBot) CQProcessFriendRequest(flag string, approve bool) MSG {
|
||||
}
|
||||
|
||||
// https://cqhttp.cc/docs/4.15/#/API?id=set_group_add_request-%E5%A4%84%E7%90%86%E5%8A%A0%E7%BE%A4%E8%AF%B7%E6%B1%82%EF%BC%8F%E9%82%80%E8%AF%B7
|
||||
func (bot *CQBot) CQProcessGroupRequest(flag, subType string, approve bool) MSG {
|
||||
func (bot *CQBot) CQProcessGroupRequest(flag, subType, reason string, approve bool) MSG {
|
||||
if subType == "add" {
|
||||
req, ok := bot.joinReqCache.Load(flag)
|
||||
if !ok {
|
||||
@ -352,7 +352,7 @@ func (bot *CQBot) CQProcessGroupRequest(flag, subType string, approve bool) MSG
|
||||
if approve {
|
||||
req.(*client.UserJoinGroupRequest).Accept()
|
||||
} else {
|
||||
req.(*client.UserJoinGroupRequest).Reject()
|
||||
req.(*client.UserJoinGroupRequest).Reject(false, reason)
|
||||
}
|
||||
return OK(nil)
|
||||
}
|
||||
@ -362,7 +362,7 @@ func (bot *CQBot) CQProcessGroupRequest(flag, subType string, approve bool) MSG
|
||||
if approve {
|
||||
req.(*client.GroupInvitedRequest).Accept()
|
||||
} else {
|
||||
req.(*client.GroupInvitedRequest).Reject()
|
||||
req.(*client.GroupInvitedRequest).Reject(false, reason)
|
||||
}
|
||||
return OK(nil)
|
||||
}
|
||||
@ -485,7 +485,7 @@ func (bot *CQBot) CQHandleQuickOperation(context, operation gjson.Result) MSG {
|
||||
bot.CQProcessFriendRequest(context.Get("flag").Str, operation.Get("approve").Bool())
|
||||
}
|
||||
if reqType == "group" {
|
||||
bot.CQProcessGroupRequest(context.Get("flag").Str, context.Get("sub_type").Str, operation.Get("approve").Bool())
|
||||
bot.CQProcessGroupRequest(context.Get("flag").Str, context.Get("sub_type").Str, context.Get("reason").Str, operation.Get("approve").Bool())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
3
go.mod
3
go.mod
@ -3,7 +3,7 @@ module github.com/Mrs4s/go-cqhttp
|
||||
go 1.14
|
||||
|
||||
require (
|
||||
github.com/Mrs4s/MiraiGo v0.0.0-20200819185537-8d1e5fb04c17
|
||||
github.com/Mrs4s/MiraiGo v0.0.0-20200821111822-80481f0022d5
|
||||
github.com/gin-gonic/gin v1.6.3
|
||||
github.com/gorilla/websocket v1.4.2
|
||||
github.com/guonaihong/gout v0.1.1
|
||||
@ -15,6 +15,5 @@ require (
|
||||
github.com/tidwall/gjson v1.6.0
|
||||
github.com/xujiajun/nutsdb v0.5.0
|
||||
github.com/yinghau76/go-ascii-art v0.0.0-20190517192627-e7f465a30189
|
||||
golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa
|
||||
golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae // indirect
|
||||
)
|
||||
|
4
go.sum
4
go.sum
@ -1,7 +1,7 @@
|
||||
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||
github.com/Mrs4s/MiraiGo v0.0.0-20200819185537-8d1e5fb04c17 h1:sY4lwW34serGKnD26hP7ZLpnJ4NfVYKdS2SJIW1Mezs=
|
||||
github.com/Mrs4s/MiraiGo v0.0.0-20200819185537-8d1e5fb04c17/go.mod h1:0je03wji/tSw4bUH4QCF2Z4/EjyNWjSJTyy5tliX6EM=
|
||||
github.com/Mrs4s/MiraiGo v0.0.0-20200821111822-80481f0022d5 h1:50yz9Xgup7WgFAxeen/GQ0fCX3YUvv+ipGktZIznDuU=
|
||||
github.com/Mrs4s/MiraiGo v0.0.0-20200821111822-80481f0022d5/go.mod h1:0je03wji/tSw4bUH4QCF2Z4/EjyNWjSJTyy5tliX6EM=
|
||||
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=
|
||||
|
@ -304,7 +304,7 @@ func (s *httpServer) ProcessGroupRequest(c *gin.Context) {
|
||||
subType = getParam(c, "type")
|
||||
}
|
||||
approve := getParamOrDefault(c, "approve", "true")
|
||||
c.JSON(200, s.bot.CQProcessGroupRequest(flag, subType, approve == "true"))
|
||||
c.JSON(200, s.bot.CQProcessGroupRequest(flag, subType, getParam(c, "reason"), approve == "true"))
|
||||
}
|
||||
|
||||
func (s *httpServer) SetGroupCard(c *gin.Context) {
|
||||
|
@ -372,7 +372,7 @@ var wsApi = map[string]func(*coolq.CQBot, gjson.Result) coolq.MSG{
|
||||
if p.Get("approve").Exists() {
|
||||
apr = p.Get("approve").Bool()
|
||||
}
|
||||
return bot.CQProcessGroupRequest(p.Get("flag").Str, subType, apr)
|
||||
return bot.CQProcessGroupRequest(p.Get("flag").Str, subType, p.Get("reason").Str, apr)
|
||||
},
|
||||
"set_group_card": func(bot *coolq.CQBot, p gjson.Result) coolq.MSG {
|
||||
return bot.CQSetGroupCard(p.Get("group_id").Int(), p.Get("user_id").Int(), p.Get("card").Str)
|
||||
|
Loading…
x
Reference in New Issue
Block a user