mirror of
https://github.com/Mrs4s/MiraiGo.git
synced 2025-05-04 11:07:40 +08:00
Merge pull request #25 from wfjsw/patches/group-join-request-reject-reason
Mrs4s/go-cqhttp#142
This commit is contained in:
commit
248753a076
@ -3,6 +3,9 @@ package client
|
||||
import (
|
||||
"crypto/md5"
|
||||
"encoding/hex"
|
||||
"math/rand"
|
||||
"strconv"
|
||||
|
||||
"github.com/Mrs4s/MiraiGo/binary"
|
||||
"github.com/Mrs4s/MiraiGo/binary/jce"
|
||||
"github.com/Mrs4s/MiraiGo/client/pb"
|
||||
@ -18,8 +21,6 @@ import (
|
||||
"github.com/Mrs4s/MiraiGo/protocol/tlv"
|
||||
"github.com/Mrs4s/MiraiGo/utils"
|
||||
"github.com/golang/protobuf/proto"
|
||||
"math/rand"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -680,7 +681,7 @@ func (c *QQClient) buildSystemMsgNewFriendPacket() (uint16, []byte) {
|
||||
}
|
||||
|
||||
// ProfileService.Pb.ReqSystemMsgAction.Group
|
||||
func (c *QQClient) buildSystemMsgGroupActionPacket(reqId, requester, group int64, isInvite, accept, block bool) (uint16, []byte) {
|
||||
func (c *QQClient) buildSystemMsgGroupActionPacket(reqId, requester, group int64, isInvite, accept, block bool, reason string) (uint16, []byte) {
|
||||
seq := c.nextSeq()
|
||||
req := &structmsg.ReqSystemMsgAction{
|
||||
MsgType: 1,
|
||||
@ -709,6 +710,7 @@ func (c *QQClient) buildSystemMsgGroupActionPacket(reqId, requester, group int64
|
||||
}(),
|
||||
GroupCode: group,
|
||||
Blacklist: block,
|
||||
Msg: reason,
|
||||
Sig: EmptyBytes,
|
||||
},
|
||||
Language: 1000,
|
||||
|
@ -707,13 +707,18 @@ func (c *QQClient) FindGroup(code int64) *GroupInfo {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *QQClient) SolveGroupJoinRequest(i interface{}, accept bool) {
|
||||
func (c *QQClient) SolveGroupJoinRequest(i interface{}, accept, block bool, reason string) {
|
||||
if accept {
|
||||
block = false
|
||||
reason = ""
|
||||
}
|
||||
|
||||
switch req := i.(type) {
|
||||
case *UserJoinGroupRequest:
|
||||
_, pkt := c.buildSystemMsgGroupActionPacket(req.RequestId, req.RequesterUin, req.GroupCode, false, accept, false)
|
||||
_, pkt := c.buildSystemMsgGroupActionPacket(req.RequestId, req.RequesterUin, req.GroupCode, false, accept, block, reason)
|
||||
_ = c.send(pkt)
|
||||
case *GroupInvitedRequest:
|
||||
_, pkt := c.buildSystemMsgGroupActionPacket(req.RequestId, req.InvitorUin, req.GroupCode, true, accept, false)
|
||||
_, pkt := c.buildSystemMsgGroupActionPacket(req.RequestId, req.InvitorUin, req.GroupCode, true, accept, block, reason)
|
||||
_ = c.send(pkt)
|
||||
}
|
||||
}
|
||||
|
@ -267,19 +267,19 @@ func (m *GroupMemberInfo) Manageable() bool {
|
||||
}
|
||||
|
||||
func (r *UserJoinGroupRequest) Accept() {
|
||||
r.client.SolveGroupJoinRequest(r, true)
|
||||
r.client.SolveGroupJoinRequest(r, true, false, "")
|
||||
}
|
||||
|
||||
func (r *UserJoinGroupRequest) Reject() {
|
||||
r.client.SolveGroupJoinRequest(r, false)
|
||||
func (r *UserJoinGroupRequest) Reject(block bool, reason string) {
|
||||
r.client.SolveGroupJoinRequest(r, false, block, reason)
|
||||
}
|
||||
|
||||
func (r *GroupInvitedRequest) Accept() {
|
||||
r.client.SolveGroupJoinRequest(r, true)
|
||||
r.client.SolveGroupJoinRequest(r, true, false, "")
|
||||
}
|
||||
|
||||
func (r *GroupInvitedRequest) Reject() {
|
||||
r.client.SolveGroupJoinRequest(r, false)
|
||||
func (r *GroupInvitedRequest) Reject(block bool, reason string) {
|
||||
r.client.SolveGroupJoinRequest(r, false, block, reason)
|
||||
}
|
||||
|
||||
func (r *NewFriendRequest) Accept() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user