mirror of
https://github.com/Mrs4s/MiraiGo.git
synced 2025-05-04 19:17:38 +08:00
kick supported.
This commit is contained in:
parent
569bcdc7b1
commit
39aac304f5
@ -771,27 +771,26 @@ func (c *QQClient) buildGroupMuteAllPacket(groupCode int64, mute bool) (uint16,
|
|||||||
return c.buildGroupOperationPacket(body)
|
return c.buildGroupOperationPacket(body)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// OidbSvc.0x8a0_0
|
||||||
func (c *QQClient) buildMultiMsgDownRequestPacket() (uint16, []byte){
|
func (c *QQClient) buildGroupKickPacket(groupCode, memberUin int64, kickMsg string) (uint16, []byte) {
|
||||||
seq := c.nextSeq()
|
seq := c.nextSeq()
|
||||||
req := &multimsg.ReqBody{
|
body := &oidb.D8A0ReqBody{
|
||||||
Subcmd: 2,
|
OptUint64GroupCode: groupCode,
|
||||||
TermType: 5,
|
MsgKickList: []*oidb.D8A0KickMemberInfo{
|
||||||
PlatformType: 9,
|
|
||||||
NetType: 3,
|
|
||||||
BuildVer: "8.2.0.1296",
|
|
||||||
MultimsgApplydownReq: []*multimsg.MultiMsgApplyDownReq{
|
|
||||||
{
|
{
|
||||||
MsgResid: []byte("xxx"),
|
OptUint32Operate: 5,
|
||||||
MsgType: 3,
|
OptUint64MemberUin: memberUin,
|
||||||
SrcUin: 000,
|
OptUint32Flag: 1,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
BuType: 2,
|
KickMsg: []byte(kickMsg),
|
||||||
ReqChannelType: 2,
|
}
|
||||||
|
b, _ := proto.Marshal(body)
|
||||||
|
req := &oidb.OIDBSSOPkg{
|
||||||
|
Command: 2208,
|
||||||
|
Bodybuffer: b,
|
||||||
}
|
}
|
||||||
payload, _ := proto.Marshal(req)
|
payload, _ := proto.Marshal(req)
|
||||||
packet := packets.BuildUniPacket(c.Uin, seq, "MultiMsg.ApplyDown", 1, c.OutGoingPacketSessionId, EmptyBytes, c.sigInfo.d2Key, payload)
|
packet := packets.BuildUniPacket(c.Uin, seq, "OidbSvc.0x8a0_0", 1, c.OutGoingPacketSessionId, EmptyBytes, c.sigInfo.d2Key, payload)
|
||||||
return seq, packet
|
return seq, packet
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
@ -432,7 +432,7 @@ func (c *QQClient) SolveFriendRequest(req *NewFriendRequest, accept bool) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (g *GroupInfo) SelfPermission() MemberPermission {
|
func (g *GroupInfo) SelfPermission() MemberPermission {
|
||||||
return g.FindMember(g.bot.Uin).Permission
|
return g.FindMember(g.client.Uin).Permission
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *GroupInfo) AdministratorOrOwner() bool {
|
func (g *GroupInfo) AdministratorOrOwner() bool {
|
||||||
@ -465,6 +465,10 @@ func (c *QQClient) groupMuteAll(groupCode int64, mute bool) {
|
|||||||
_, _ = c.sendAndWait(c.buildGroupMuteAllPacket(groupCode, mute))
|
_, _ = c.sendAndWait(c.buildGroupMuteAllPacket(groupCode, mute))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *QQClient) kickGroupMember(groupCode, memberUin int64, msg string) {
|
||||||
|
_, _ = c.sendAndWait(c.buildGroupKickPacket(groupCode, memberUin, msg))
|
||||||
|
}
|
||||||
|
|
||||||
func (g *GroupInfo) removeMember(uin int64) {
|
func (g *GroupInfo) removeMember(uin int64) {
|
||||||
if g.memLock == nil {
|
if g.memLock == nil {
|
||||||
g.memLock = new(sync.Mutex)
|
g.memLock = new(sync.Mutex)
|
||||||
|
@ -329,7 +329,7 @@ func decodeGroupListResponse(c *QQClient, _ uint16, payload []byte) (interface{}
|
|||||||
OwnerUin: g.GroupOwnerUin,
|
OwnerUin: g.GroupOwnerUin,
|
||||||
MemberCount: uint16(g.MemberNum),
|
MemberCount: uint16(g.MemberNum),
|
||||||
MaxMemberCount: uint16(g.MaxGroupMemberNum),
|
MaxMemberCount: uint16(g.MaxGroupMemberNum),
|
||||||
bot: c,
|
client: c,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return l, nil
|
return l, nil
|
||||||
|
@ -52,7 +52,7 @@ type (
|
|||||||
MaxMemberCount uint16
|
MaxMemberCount uint16
|
||||||
Members []*GroupMemberInfo
|
Members []*GroupMemberInfo
|
||||||
|
|
||||||
bot *QQClient
|
client *QQClient
|
||||||
memLock *sync.Mutex
|
memLock *sync.Mutex
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -177,14 +177,14 @@ const (
|
|||||||
|
|
||||||
func (g *GroupInfo) UpdateName(newName string) {
|
func (g *GroupInfo) UpdateName(newName string) {
|
||||||
if g.AdministratorOrOwner() && newName != "" && strings.Count(newName, "") <= 20 {
|
if g.AdministratorOrOwner() && newName != "" && strings.Count(newName, "") <= 20 {
|
||||||
g.bot.updateGroupName(g.Code, newName)
|
g.client.updateGroupName(g.Code, newName)
|
||||||
g.Name = newName
|
g.Name = newName
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *GroupInfo) MuteAll(mute bool) {
|
func (g *GroupInfo) MuteAll(mute bool) {
|
||||||
if g.AdministratorOrOwner() {
|
if g.AdministratorOrOwner() {
|
||||||
g.bot.groupMuteAll(g.Code, mute)
|
g.client.groupMuteAll(g.Code, mute)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -197,20 +197,26 @@ func (m *GroupMemberInfo) DisplayName() string {
|
|||||||
|
|
||||||
func (m *GroupMemberInfo) EditCard(card string) {
|
func (m *GroupMemberInfo) EditCard(card string) {
|
||||||
if m.Manageable() && strings.Count(card, "") <= 20 {
|
if m.Manageable() && strings.Count(card, "") <= 20 {
|
||||||
m.Group.bot.editMemberCard(m.Group.Code, m.Uin, card)
|
m.Group.client.editMemberCard(m.Group.Code, m.Uin, card)
|
||||||
m.CardName = card
|
m.CardName = card
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *GroupMemberInfo) EditSpecialTitle(title string) {
|
func (m *GroupMemberInfo) EditSpecialTitle(title string) {
|
||||||
if m.Group.SelfPermission() == Owner && strings.Count(title, "") <= 6 {
|
if m.Group.SelfPermission() == Owner && strings.Count(title, "") <= 6 {
|
||||||
m.Group.bot.editMemberSpecialTitle(m.Group.Code, m.Uin, title)
|
m.Group.client.editMemberSpecialTitle(m.Group.Code, m.Uin, title)
|
||||||
m.SpecialTitle = title
|
m.SpecialTitle = title
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *GroupMemberInfo) Kick(msg string) {
|
||||||
|
if m.Uin != m.Group.client.Uin && m.Manageable() {
|
||||||
|
m.Group.client.kickGroupMember(m.Group.Code, m.Uin, msg)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (m *GroupMemberInfo) Manageable() bool {
|
func (m *GroupMemberInfo) Manageable() bool {
|
||||||
if m.Uin == m.Group.bot.Uin {
|
if m.Uin == m.Group.client.Uin {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
self := m.Group.SelfPermission()
|
self := m.Group.SelfPermission()
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -11,6 +11,29 @@ message OIDBSSOPkg {
|
|||||||
string clientVersion = 6;
|
string clientVersion = 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message D8A0RspBody {
|
||||||
|
int64 optUint64GroupCode = 1;
|
||||||
|
repeated D8A0KickResult msgKickResult = 2;
|
||||||
|
}
|
||||||
|
message D8A0KickResult {
|
||||||
|
int32 optUint32Result = 1;
|
||||||
|
int64 optUint64MemberUin = 2;
|
||||||
|
}
|
||||||
|
message D8A0KickMemberInfo {
|
||||||
|
int32 optUint32Operate = 1;
|
||||||
|
int64 optUint64MemberUin = 2;
|
||||||
|
int32 optUint32Flag = 3;
|
||||||
|
bytes optBytesMsg = 4;
|
||||||
|
}
|
||||||
|
message D8A0ReqBody {
|
||||||
|
int64 optUint64GroupCode = 1;
|
||||||
|
repeated D8A0KickMemberInfo msgKickList = 2;
|
||||||
|
repeated int64 kickList = 3;
|
||||||
|
int32 kickFlag = 4;
|
||||||
|
bytes kickMsg = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
message D8FCReqBody {
|
message D8FCReqBody {
|
||||||
int64 groupCode = 1;
|
int64 groupCode = 1;
|
||||||
int32 showFlag = 2;
|
int32 showFlag = 2;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user