1
0
mirror of https://github.com/Mrs4s/MiraiGo.git synced 2025-05-04 11:07:40 +08:00

Merge pull request #30 from Logiase/groupMemo

add GroupInfo.UpdateMemo
This commit is contained in:
Mrs4s 2020-08-22 19:39:02 +08:00 committed by GitHub
commit 2c7ab5f2e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 2 deletions

View File

@ -6,6 +6,8 @@ import (
"math/rand" "math/rand"
"strconv" "strconv"
"github.com/golang/protobuf/proto"
"github.com/Mrs4s/MiraiGo/binary" "github.com/Mrs4s/MiraiGo/binary"
"github.com/Mrs4s/MiraiGo/binary/jce" "github.com/Mrs4s/MiraiGo/binary/jce"
"github.com/Mrs4s/MiraiGo/client/pb" "github.com/Mrs4s/MiraiGo/client/pb"
@ -20,7 +22,6 @@ import (
"github.com/Mrs4s/MiraiGo/protocol/packets" "github.com/Mrs4s/MiraiGo/protocol/packets"
"github.com/Mrs4s/MiraiGo/protocol/tlv" "github.com/Mrs4s/MiraiGo/protocol/tlv"
"github.com/Mrs4s/MiraiGo/utils" "github.com/Mrs4s/MiraiGo/utils"
"github.com/golang/protobuf/proto"
) )
var ( var (
@ -846,6 +847,16 @@ func (c *QQClient) buildGroupNameUpdatePacket(groupCode int64, newName string) (
return c.buildGroupOperationPacket(body) return c.buildGroupOperationPacket(body)
} }
func (c *QQClient) buildGroupMemoUpdatePacket(groupCode int64, newMemo string) (uint16, []byte) {
body := &oidb.D89AReqBody{
GroupCode: groupCode,
StGroupInfo: &oidb.D89AGroupinfo{
IngGroupMemo: []byte(newMemo),
},
}
return c.buildGroupOperationPacket(body)
}
// OidbSvc.0x89a_0 // OidbSvc.0x89a_0
func (c *QQClient) buildGroupMuteAllPacket(groupCode int64, mute bool) (uint16, []byte) { func (c *QQClient) buildGroupMuteAllPacket(groupCode int64, mute bool) (uint16, []byte) {
body := &oidb.D89AReqBody{ body := &oidb.D89AReqBody{

View File

@ -16,6 +16,8 @@ import (
"sync/atomic" "sync/atomic"
"time" "time"
"github.com/golang/protobuf/proto"
"github.com/Mrs4s/MiraiGo/binary" "github.com/Mrs4s/MiraiGo/binary"
"github.com/Mrs4s/MiraiGo/client/pb/longmsg" "github.com/Mrs4s/MiraiGo/client/pb/longmsg"
"github.com/Mrs4s/MiraiGo/client/pb/msg" "github.com/Mrs4s/MiraiGo/client/pb/msg"
@ -23,7 +25,6 @@ import (
"github.com/Mrs4s/MiraiGo/message" "github.com/Mrs4s/MiraiGo/message"
"github.com/Mrs4s/MiraiGo/protocol/packets" "github.com/Mrs4s/MiraiGo/protocol/packets"
"github.com/Mrs4s/MiraiGo/utils" "github.com/Mrs4s/MiraiGo/utils"
"github.com/golang/protobuf/proto"
) )
type QQClient struct { type QQClient struct {
@ -754,6 +755,10 @@ func (c *QQClient) updateGroupName(groupCode int64, newName string) {
_, _ = c.sendAndWait(c.buildGroupNameUpdatePacket(groupCode, newName)) _, _ = c.sendAndWait(c.buildGroupNameUpdatePacket(groupCode, newName))
} }
func (c *QQClient) updateGroupMemo(groupCode int64, newMemo string) {
_, _ = c.sendAndWait(c.buildGroupMemoUpdatePacket(groupCode, newMemo))
}
func (c *QQClient) groupMuteAll(groupCode int64, mute bool) { func (c *QQClient) groupMuteAll(groupCode int64, mute bool) {
_, _ = c.sendAndWait(c.buildGroupMuteAllPacket(groupCode, mute)) _, _ = c.sendAndWait(c.buildGroupMuteAllPacket(groupCode, mute))
} }

View File

@ -208,6 +208,13 @@ func (g *GroupInfo) UpdateName(newName string) {
} }
} }
func (g *GroupInfo) UpdateMemo(newMemo string) {
if g.AdministratorOrOwner() {
g.client.updateGroupMemo(g.Code, newMemo)
g.Memo = newMemo
}
}
func (g *GroupInfo) MuteAll(mute bool) { func (g *GroupInfo) MuteAll(mute bool) {
if g.AdministratorOrOwner() { if g.AdministratorOrOwner() {
g.client.groupMuteAll(g.Code, mute) g.client.groupMuteAll(g.Code, mute)