mirror of
https://github.com/Mrs4s/MiraiGo.git
synced 2025-05-04 11:07:40 +08:00
feat: GetGuildMembers
This commit is contained in:
parent
5e371689e6
commit
606ad69679
97
binary/protobuf.go
Normal file
97
binary/protobuf.go
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
package binary
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"encoding/binary"
|
||||||
|
"math"
|
||||||
|
)
|
||||||
|
|
||||||
|
type DynamicProtoMessage map[uint64]interface{}
|
||||||
|
|
||||||
|
type encoder struct {
|
||||||
|
bytes.Buffer
|
||||||
|
}
|
||||||
|
|
||||||
|
func EncodeDynamicProtoMessage(msg DynamicProtoMessage) []byte {
|
||||||
|
en := &encoder{}
|
||||||
|
for id, value := range msg {
|
||||||
|
key := id << 3
|
||||||
|
switch v := value.(type) {
|
||||||
|
case bool:
|
||||||
|
en.uvarint(key | 0)
|
||||||
|
vi := uint64(0)
|
||||||
|
if v {
|
||||||
|
vi = 1
|
||||||
|
}
|
||||||
|
en.uvarint(vi)
|
||||||
|
case int:
|
||||||
|
en.uvarint(key | 0)
|
||||||
|
en.svarint(int64(v))
|
||||||
|
case int32:
|
||||||
|
en.uvarint(key | 0)
|
||||||
|
en.svarint(int64(v))
|
||||||
|
case int64:
|
||||||
|
en.uvarint(key | 0)
|
||||||
|
en.svarint(v)
|
||||||
|
case uint32:
|
||||||
|
en.uvarint(key | 0)
|
||||||
|
en.uvarint(uint64(v))
|
||||||
|
case uint64:
|
||||||
|
en.uvarint(key | 0)
|
||||||
|
en.uvarint(v)
|
||||||
|
case float32:
|
||||||
|
en.uvarint(key | 5)
|
||||||
|
en.u32(math.Float32bits(v))
|
||||||
|
case float64:
|
||||||
|
en.uvarint(key | 1)
|
||||||
|
en.u64(math.Float64bits(v))
|
||||||
|
case string:
|
||||||
|
en.uvarint(key | 2)
|
||||||
|
b := []byte(v)
|
||||||
|
en.uvarint(uint64(len(b)))
|
||||||
|
_, _ = en.Write(b)
|
||||||
|
case DynamicProtoMessage:
|
||||||
|
en.uvarint(key | 2)
|
||||||
|
b := EncodeDynamicProtoMessage(v)
|
||||||
|
en.uvarint(uint64(len(b)))
|
||||||
|
_, _ = en.Write(b)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return en.Bytes()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (en *encoder) uvarint(v uint64) {
|
||||||
|
var b [binary.MaxVarintLen64]byte
|
||||||
|
n := binary.PutUvarint(b[:], v)
|
||||||
|
_, _ = en.Write(b[:n])
|
||||||
|
}
|
||||||
|
|
||||||
|
func (en *encoder) svarint(v int64) {
|
||||||
|
if v >= 0 {
|
||||||
|
en.uvarint(uint64(v) << 1)
|
||||||
|
} else {
|
||||||
|
en.uvarint(^uint64(v << 1))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (en *encoder) u32(v uint32) {
|
||||||
|
var b [4]byte
|
||||||
|
b[0] = byte(v)
|
||||||
|
b[1] = byte(v >> 8)
|
||||||
|
b[2] = byte(v >> 16)
|
||||||
|
b[3] = byte(v >> 24)
|
||||||
|
_, _ = en.Write(b[:])
|
||||||
|
}
|
||||||
|
|
||||||
|
func (en *encoder) u64(v uint64) {
|
||||||
|
var b [8]byte
|
||||||
|
b[0] = byte(v)
|
||||||
|
b[1] = byte(v >> 8)
|
||||||
|
b[2] = byte(v >> 16)
|
||||||
|
b[3] = byte(v >> 24)
|
||||||
|
b[4] = byte(v >> 32)
|
||||||
|
b[5] = byte(v >> 40)
|
||||||
|
b[6] = byte(v >> 48)
|
||||||
|
b[7] = byte(v >> 56)
|
||||||
|
_, _ = en.Write(b[:])
|
||||||
|
}
|
@ -1,42 +1,58 @@
|
|||||||
package client
|
package client
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/Mrs4s/MiraiGo/binary"
|
||||||
"github.com/Mrs4s/MiraiGo/client/pb/channel"
|
"github.com/Mrs4s/MiraiGo/client/pb/channel"
|
||||||
|
"github.com/Mrs4s/MiraiGo/client/pb/oidb"
|
||||||
"github.com/Mrs4s/MiraiGo/internal/packets"
|
"github.com/Mrs4s/MiraiGo/internal/packets"
|
||||||
"github.com/Mrs4s/MiraiGo/utils"
|
"github.com/Mrs4s/MiraiGo/utils"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ChannelSelfInfo 频道模块内自身的信息
|
type (
|
||||||
type ChannelSelfInfo struct {
|
// ChannelService 频道模块内自身的信息
|
||||||
TinyId uint64
|
ChannelService struct {
|
||||||
ChannelCount uint32
|
TinyId uint64
|
||||||
// Guilds 由服务器推送的频道列表
|
ChannelCount uint32
|
||||||
Guilds []*GuildInfo
|
// Guilds 由服务器推送的频道列表
|
||||||
}
|
Guilds []*GuildInfo
|
||||||
|
}
|
||||||
|
|
||||||
// GuildInfo 频道信息
|
// GuildInfo 频道信息
|
||||||
type GuildInfo struct {
|
GuildInfo struct {
|
||||||
GuildId uint64
|
GuildId uint64
|
||||||
GuildCode uint64
|
GuildCode uint64
|
||||||
GuildName string
|
GuildName string
|
||||||
Channels []*ChannelInfo
|
Channels []*ChannelInfo
|
||||||
}
|
Bots []*GuildMemberInfo
|
||||||
|
Members []*GuildMemberInfo
|
||||||
|
Admins []*GuildMemberInfo
|
||||||
|
}
|
||||||
|
|
||||||
// ChannelInfo 子频道信息
|
GuildMemberInfo struct {
|
||||||
type ChannelInfo struct {
|
TinyId uint64
|
||||||
ChannelId uint64
|
Title string
|
||||||
ChannelName string
|
Nickname string
|
||||||
Time uint64
|
LastSpeakTime int64
|
||||||
EventTime uint32
|
Role int32 // 0 = member 1 = admin 2 = owner ?
|
||||||
NotifyType uint32
|
}
|
||||||
ChannelType uint32
|
|
||||||
AtAllSeq uint64
|
// ChannelInfo 子频道信息
|
||||||
}
|
ChannelInfo struct {
|
||||||
|
ChannelId uint64
|
||||||
|
ChannelName string
|
||||||
|
Time uint64
|
||||||
|
EventTime uint32
|
||||||
|
NotifyType uint32
|
||||||
|
ChannelType uint32
|
||||||
|
AtAllSeq uint64
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
decoders["trpc.group_pro.synclogic.SyncLogic.PushFirstView"] = decodeChannelPushFirstView
|
decoders["trpc.group_pro.synclogic.SyncLogic.PushFirstView"] = decodeChannelPushFirstView
|
||||||
|
decoders["MsgPush.PushGroupProMsg"] = decodeChannelMessagePushPacket
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *QQClient) syncChannelFirstView() {
|
func (c *QQClient) syncChannelFirstView() {
|
||||||
@ -49,8 +65,56 @@ func (c *QQClient) syncChannelFirstView() {
|
|||||||
if err = proto.Unmarshal(rsp, firstViewRsp); err != nil {
|
if err = proto.Unmarshal(rsp, firstViewRsp); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
c.ChannelSelf.TinyId = firstViewRsp.GetSelfTinyid()
|
c.ChannelService.TinyId = firstViewRsp.GetSelfTinyid()
|
||||||
c.ChannelSelf.ChannelCount = firstViewRsp.GetGuildCount()
|
c.ChannelService.ChannelCount = firstViewRsp.GetGuildCount()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *QQClient) GetGuildMembers(guildId uint64) (bots []*GuildMemberInfo, members []*GuildMemberInfo, admins []*GuildMemberInfo, err error) {
|
||||||
|
seq := c.nextSeq()
|
||||||
|
u1 := uint32(1)
|
||||||
|
payload := c.packOIDBPackage(3931, 1, binary.EncodeDynamicProtoMessage(binary.DynamicProtoMessage{ // todo: 可能还需要处理翻页的情况?
|
||||||
|
1: guildId, // guild id
|
||||||
|
2: uint32(3),
|
||||||
|
3: uint32(0),
|
||||||
|
4: binary.DynamicProtoMessage{ // unknown param, looks like flags
|
||||||
|
1: u1, 2: u1, 3: u1, 4: u1, 5: u1, 6: u1, 7: u1, 8: u1, 20: u1,
|
||||||
|
},
|
||||||
|
6: uint32(0),
|
||||||
|
8: uint32(500), // max response?
|
||||||
|
14: uint32(2),
|
||||||
|
}))
|
||||||
|
packet := packets.BuildUniPacket(c.Uin, seq, "OidbSvcTrpcTcp.0xf5b_1", 1, c.OutGoingPacketSessionId, []byte{}, c.sigInfo.d2Key, payload)
|
||||||
|
rsp, err := c.sendAndWaitDynamic(seq, packet)
|
||||||
|
if err != nil {
|
||||||
|
return nil, nil, nil, errors.Wrap(err, "send packet error")
|
||||||
|
}
|
||||||
|
pkg := new(oidb.OIDBSSOPkg)
|
||||||
|
oidbRsp := new(channel.ChannelOidb0Xf5BRsp)
|
||||||
|
if err = proto.Unmarshal(rsp, pkg); err != nil {
|
||||||
|
return nil, nil, nil, errors.Wrap(err, "failed to unmarshal protobuf message")
|
||||||
|
}
|
||||||
|
if err = proto.Unmarshal(pkg.Bodybuffer, oidbRsp); err != nil {
|
||||||
|
return nil, nil, nil, errors.Wrap(err, "failed to unmarshal protobuf message")
|
||||||
|
}
|
||||||
|
protoToMemberInfo := func(mem *channel.GuildMemberInfo) *GuildMemberInfo {
|
||||||
|
return &GuildMemberInfo{
|
||||||
|
TinyId: mem.GetTinyId(),
|
||||||
|
Title: mem.GetTitle(),
|
||||||
|
Nickname: mem.GetNickname(),
|
||||||
|
LastSpeakTime: mem.GetLastSpeakTime(),
|
||||||
|
Role: mem.GetRole(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for _, mem := range oidbRsp.Bots {
|
||||||
|
bots = append(bots, protoToMemberInfo(mem))
|
||||||
|
}
|
||||||
|
for _, mem := range oidbRsp.Members {
|
||||||
|
members = append(members, protoToMemberInfo(mem))
|
||||||
|
}
|
||||||
|
for _, mem := range oidbRsp.AdminInfo.Admins {
|
||||||
|
admins = append(admins, protoToMemberInfo(mem))
|
||||||
|
}
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *QQClient) buildSyncChannelFirstViewPacket() (uint16, []byte) {
|
func (c *QQClient) buildSyncChannelFirstViewPacket() (uint16, []byte) {
|
||||||
@ -65,13 +129,17 @@ func (c *QQClient) buildSyncChannelFirstViewPacket() (uint16, []byte) {
|
|||||||
return seq, packet
|
return seq, packet
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func decodeChannelMessagePushPacket(c *QQClient, _ *incomingPacketInfo, payload []byte) (interface{}, error) {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
func decodeChannelPushFirstView(c *QQClient, _ *incomingPacketInfo, payload []byte) (interface{}, error) {
|
func decodeChannelPushFirstView(c *QQClient, _ *incomingPacketInfo, payload []byte) (interface{}, error) {
|
||||||
firstViewMsg := new(channel.FirstViewMsg)
|
firstViewMsg := new(channel.FirstViewMsg)
|
||||||
if err := proto.Unmarshal(payload, firstViewMsg); err != nil {
|
if err := proto.Unmarshal(payload, firstViewMsg); err != nil {
|
||||||
return nil, errors.Wrap(err, "failed to unmarshal protobuf message")
|
return nil, errors.Wrap(err, "failed to unmarshal protobuf message")
|
||||||
}
|
}
|
||||||
if len(firstViewMsg.GuildNodes) > 0 {
|
if len(firstViewMsg.GuildNodes) > 0 {
|
||||||
c.ChannelSelf.Guilds = []*GuildInfo{}
|
c.ChannelService.Guilds = []*GuildInfo{}
|
||||||
for _, guild := range firstViewMsg.GuildNodes {
|
for _, guild := range firstViewMsg.GuildNodes {
|
||||||
info := &GuildInfo{
|
info := &GuildInfo{
|
||||||
GuildId: guild.GetGuildId(),
|
GuildId: guild.GetGuildId(),
|
||||||
@ -91,7 +159,8 @@ func decodeChannelPushFirstView(c *QQClient, _ *incomingPacketInfo, payload []by
|
|||||||
AtAllSeq: meta.GetAtAllSeq(),
|
AtAllSeq: meta.GetAtAllSeq(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
c.ChannelSelf.Guilds = append(c.ChannelSelf.Guilds, info)
|
info.Bots, info.Members, info.Admins, _ = c.GetGuildMembers(info.GuildId)
|
||||||
|
c.ChannelService.Guilds = append(c.ChannelService.Guilds, info)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if len(firstViewMsg.ChannelMsgs) > 0 { // sync msg
|
if len(firstViewMsg.ChannelMsgs) > 0 { // sync msg
|
||||||
|
@ -36,15 +36,15 @@ type QQClient struct {
|
|||||||
AllowSlider bool
|
AllowSlider bool
|
||||||
|
|
||||||
// account info
|
// account info
|
||||||
Nickname string
|
Nickname string
|
||||||
Age uint16
|
Age uint16
|
||||||
Gender uint16
|
Gender uint16
|
||||||
FriendList []*FriendInfo
|
FriendList []*FriendInfo
|
||||||
GroupList []*GroupInfo
|
GroupList []*GroupInfo
|
||||||
OnlineClients []*OtherClientInfo
|
OnlineClients []*OtherClientInfo
|
||||||
Online bool
|
Online bool
|
||||||
QiDian *QiDianAccountInfo
|
QiDian *QiDianAccountInfo
|
||||||
ChannelSelf *ChannelSelfInfo
|
ChannelService *ChannelService
|
||||||
|
|
||||||
// protocol public field
|
// protocol public field
|
||||||
SequenceId int32
|
SequenceId int32
|
||||||
@ -200,7 +200,7 @@ func NewClientMd5(uin int64, passwordMd5 [16]byte) *QQClient {
|
|||||||
RandomKey: make([]byte, 16),
|
RandomKey: make([]byte, 16),
|
||||||
OutGoingPacketSessionId: []byte{0x02, 0xB0, 0x5B, 0x8B},
|
OutGoingPacketSessionId: []byte{0x02, 0xB0, 0x5B, 0x8B},
|
||||||
TCP: &utils.TCPListener{},
|
TCP: &utils.TCPListener{},
|
||||||
ChannelSelf: &ChannelSelfInfo{},
|
ChannelService: &ChannelService{},
|
||||||
sigInfo: &loginSigInfo{},
|
sigInfo: &loginSigInfo{},
|
||||||
requestPacketRequestID: 1921334513,
|
requestPacketRequestID: 1921334513,
|
||||||
groupSeq: int32(rand.Intn(20000)),
|
groupSeq: int32(rand.Intn(20000)),
|
||||||
|
347
client/pb/channel/unknown.pb.go
Normal file
347
client/pb/channel/unknown.pb.go
Normal file
@ -0,0 +1,347 @@
|
|||||||
|
// 存放所有未知的结构体
|
||||||
|
|
||||||
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// protoc-gen-go v1.27.1
|
||||||
|
// protoc v3.14.0
|
||||||
|
// source: unknown.proto
|
||||||
|
|
||||||
|
package channel
|
||||||
|
|
||||||
|
import (
|
||||||
|
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||||
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
|
reflect "reflect"
|
||||||
|
sync "sync"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// Verify that this generated code is sufficiently up-to-date.
|
||||||
|
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||||
|
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||||
|
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||||
|
)
|
||||||
|
|
||||||
|
type ChannelOidb0Xf5BRsp struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
GuildId *uint64 `protobuf:"varint,1,opt,name=guildId" json:"guildId,omitempty"`
|
||||||
|
Bots []*GuildMemberInfo `protobuf:"bytes,4,rep,name=bots" json:"bots,omitempty"`
|
||||||
|
Members []*GuildMemberInfo `protobuf:"bytes,5,rep,name=members" json:"members,omitempty"`
|
||||||
|
AdminInfo *GuildAdminInfo `protobuf:"bytes,25,opt,name=adminInfo" json:"adminInfo,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ChannelOidb0Xf5BRsp) Reset() {
|
||||||
|
*x = ChannelOidb0Xf5BRsp{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_unknown_proto_msgTypes[0]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ChannelOidb0Xf5BRsp) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*ChannelOidb0Xf5BRsp) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *ChannelOidb0Xf5BRsp) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_unknown_proto_msgTypes[0]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use ChannelOidb0Xf5BRsp.ProtoReflect.Descriptor instead.
|
||||||
|
func (*ChannelOidb0Xf5BRsp) Descriptor() ([]byte, []int) {
|
||||||
|
return file_unknown_proto_rawDescGZIP(), []int{0}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ChannelOidb0Xf5BRsp) GetGuildId() uint64 {
|
||||||
|
if x != nil && x.GuildId != nil {
|
||||||
|
return *x.GuildId
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ChannelOidb0Xf5BRsp) GetBots() []*GuildMemberInfo {
|
||||||
|
if x != nil {
|
||||||
|
return x.Bots
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ChannelOidb0Xf5BRsp) GetMembers() []*GuildMemberInfo {
|
||||||
|
if x != nil {
|
||||||
|
return x.Members
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ChannelOidb0Xf5BRsp) GetAdminInfo() *GuildAdminInfo {
|
||||||
|
if x != nil {
|
||||||
|
return x.AdminInfo
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type GuildAdminInfo struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
Admins []*GuildMemberInfo `protobuf:"bytes,2,rep,name=admins" json:"admins,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *GuildAdminInfo) Reset() {
|
||||||
|
*x = GuildAdminInfo{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_unknown_proto_msgTypes[1]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *GuildAdminInfo) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*GuildAdminInfo) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *GuildAdminInfo) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_unknown_proto_msgTypes[1]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use GuildAdminInfo.ProtoReflect.Descriptor instead.
|
||||||
|
func (*GuildAdminInfo) Descriptor() ([]byte, []int) {
|
||||||
|
return file_unknown_proto_rawDescGZIP(), []int{1}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *GuildAdminInfo) GetAdmins() []*GuildMemberInfo {
|
||||||
|
if x != nil {
|
||||||
|
return x.Admins
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type GuildMemberInfo struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
Title *string `protobuf:"bytes,2,opt,name=title" json:"title,omitempty"`
|
||||||
|
Nickname *string `protobuf:"bytes,3,opt,name=nickname" json:"nickname,omitempty"`
|
||||||
|
LastSpeakTime *int64 `protobuf:"varint,4,opt,name=lastSpeakTime" json:"lastSpeakTime,omitempty"` // uncertainty
|
||||||
|
Role *int32 `protobuf:"varint,5,opt,name=role" json:"role,omitempty"` // uncertainty
|
||||||
|
TinyId *uint64 `protobuf:"varint,8,opt,name=tinyId" json:"tinyId,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *GuildMemberInfo) Reset() {
|
||||||
|
*x = GuildMemberInfo{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_unknown_proto_msgTypes[2]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *GuildMemberInfo) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*GuildMemberInfo) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *GuildMemberInfo) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_unknown_proto_msgTypes[2]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use GuildMemberInfo.ProtoReflect.Descriptor instead.
|
||||||
|
func (*GuildMemberInfo) Descriptor() ([]byte, []int) {
|
||||||
|
return file_unknown_proto_rawDescGZIP(), []int{2}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *GuildMemberInfo) GetTitle() string {
|
||||||
|
if x != nil && x.Title != nil {
|
||||||
|
return *x.Title
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *GuildMemberInfo) GetNickname() string {
|
||||||
|
if x != nil && x.Nickname != nil {
|
||||||
|
return *x.Nickname
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *GuildMemberInfo) GetLastSpeakTime() int64 {
|
||||||
|
if x != nil && x.LastSpeakTime != nil {
|
||||||
|
return *x.LastSpeakTime
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *GuildMemberInfo) GetRole() int32 {
|
||||||
|
if x != nil && x.Role != nil {
|
||||||
|
return *x.Role
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *GuildMemberInfo) GetTinyId() uint64 {
|
||||||
|
if x != nil && x.TinyId != nil {
|
||||||
|
return *x.TinyId
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
var File_unknown_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
|
var file_unknown_proto_rawDesc = []byte{
|
||||||
|
0x0a, 0x0d, 0x75, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12,
|
||||||
|
0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x22, 0xc8, 0x01, 0x0a, 0x13, 0x43, 0x68, 0x61,
|
||||||
|
0x6e, 0x6e, 0x65, 0x6c, 0x4f, 0x69, 0x64, 0x62, 0x30, 0x78, 0x66, 0x35, 0x62, 0x52, 0x73, 0x70,
|
||||||
|
0x12, 0x18, 0x0a, 0x07, 0x67, 0x75, 0x69, 0x6c, 0x64, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||||
|
0x04, 0x52, 0x07, 0x67, 0x75, 0x69, 0x6c, 0x64, 0x49, 0x64, 0x12, 0x2c, 0x0a, 0x04, 0x62, 0x6f,
|
||||||
|
0x74, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x63, 0x68, 0x61, 0x6e, 0x6e,
|
||||||
|
0x65, 0x6c, 0x2e, 0x47, 0x75, 0x69, 0x6c, 0x64, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x49, 0x6e,
|
||||||
|
0x66, 0x6f, 0x52, 0x04, 0x62, 0x6f, 0x74, 0x73, 0x12, 0x32, 0x0a, 0x07, 0x6d, 0x65, 0x6d, 0x62,
|
||||||
|
0x65, 0x72, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x63, 0x68, 0x61, 0x6e,
|
||||||
|
0x6e, 0x65, 0x6c, 0x2e, 0x47, 0x75, 0x69, 0x6c, 0x64, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x49,
|
||||||
|
0x6e, 0x66, 0x6f, 0x52, 0x07, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x12, 0x35, 0x0a, 0x09,
|
||||||
|
0x61, 0x64, 0x6d, 0x69, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x18, 0x19, 0x20, 0x01, 0x28, 0x0b, 0x32,
|
||||||
|
0x17, 0x2e, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x2e, 0x47, 0x75, 0x69, 0x6c, 0x64, 0x41,
|
||||||
|
0x64, 0x6d, 0x69, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x09, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x49,
|
||||||
|
0x6e, 0x66, 0x6f, 0x22, 0x42, 0x0a, 0x0e, 0x47, 0x75, 0x69, 0x6c, 0x64, 0x41, 0x64, 0x6d, 0x69,
|
||||||
|
0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x30, 0x0a, 0x06, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x73, 0x18,
|
||||||
|
0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x2e,
|
||||||
|
0x47, 0x75, 0x69, 0x6c, 0x64, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52,
|
||||||
|
0x06, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x73, 0x22, 0x95, 0x01, 0x0a, 0x0f, 0x47, 0x75, 0x69, 0x6c,
|
||||||
|
0x64, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x14, 0x0a, 0x05, 0x74,
|
||||||
|
0x69, 0x74, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c,
|
||||||
|
0x65, 0x12, 0x1a, 0x0a, 0x08, 0x6e, 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20,
|
||||||
|
0x01, 0x28, 0x09, 0x52, 0x08, 0x6e, 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x24, 0x0a,
|
||||||
|
0x0d, 0x6c, 0x61, 0x73, 0x74, 0x53, 0x70, 0x65, 0x61, 0x6b, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x04,
|
||||||
|
0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x6c, 0x61, 0x73, 0x74, 0x53, 0x70, 0x65, 0x61, 0x6b, 0x54,
|
||||||
|
0x69, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28,
|
||||||
|
0x05, 0x52, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x69, 0x6e, 0x79, 0x49,
|
||||||
|
0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x74, 0x69, 0x6e, 0x79, 0x49, 0x64, 0x42,
|
||||||
|
0x0c, 0x5a, 0x0a, 0x2e, 0x2f, 0x3b, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c,
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
file_unknown_proto_rawDescOnce sync.Once
|
||||||
|
file_unknown_proto_rawDescData = file_unknown_proto_rawDesc
|
||||||
|
)
|
||||||
|
|
||||||
|
func file_unknown_proto_rawDescGZIP() []byte {
|
||||||
|
file_unknown_proto_rawDescOnce.Do(func() {
|
||||||
|
file_unknown_proto_rawDescData = protoimpl.X.CompressGZIP(file_unknown_proto_rawDescData)
|
||||||
|
})
|
||||||
|
return file_unknown_proto_rawDescData
|
||||||
|
}
|
||||||
|
|
||||||
|
var file_unknown_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
|
||||||
|
var file_unknown_proto_goTypes = []interface{}{
|
||||||
|
(*ChannelOidb0Xf5BRsp)(nil), // 0: channel.ChannelOidb0xf5bRsp
|
||||||
|
(*GuildAdminInfo)(nil), // 1: channel.GuildAdminInfo
|
||||||
|
(*GuildMemberInfo)(nil), // 2: channel.GuildMemberInfo
|
||||||
|
}
|
||||||
|
var file_unknown_proto_depIdxs = []int32{
|
||||||
|
2, // 0: channel.ChannelOidb0xf5bRsp.bots:type_name -> channel.GuildMemberInfo
|
||||||
|
2, // 1: channel.ChannelOidb0xf5bRsp.members:type_name -> channel.GuildMemberInfo
|
||||||
|
1, // 2: channel.ChannelOidb0xf5bRsp.adminInfo:type_name -> channel.GuildAdminInfo
|
||||||
|
2, // 3: channel.GuildAdminInfo.admins:type_name -> channel.GuildMemberInfo
|
||||||
|
4, // [4:4] is the sub-list for method output_type
|
||||||
|
4, // [4:4] is the sub-list for method input_type
|
||||||
|
4, // [4:4] is the sub-list for extension type_name
|
||||||
|
4, // [4:4] is the sub-list for extension extendee
|
||||||
|
0, // [0:4] is the sub-list for field type_name
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() { file_unknown_proto_init() }
|
||||||
|
func file_unknown_proto_init() {
|
||||||
|
if File_unknown_proto != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if !protoimpl.UnsafeEnabled {
|
||||||
|
file_unknown_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*ChannelOidb0Xf5BRsp); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_unknown_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*GuildAdminInfo); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_unknown_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*GuildMemberInfo); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
type x struct{}
|
||||||
|
out := protoimpl.TypeBuilder{
|
||||||
|
File: protoimpl.DescBuilder{
|
||||||
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
|
RawDescriptor: file_unknown_proto_rawDesc,
|
||||||
|
NumEnums: 0,
|
||||||
|
NumMessages: 3,
|
||||||
|
NumExtensions: 0,
|
||||||
|
NumServices: 0,
|
||||||
|
},
|
||||||
|
GoTypes: file_unknown_proto_goTypes,
|
||||||
|
DependencyIndexes: file_unknown_proto_depIdxs,
|
||||||
|
MessageInfos: file_unknown_proto_msgTypes,
|
||||||
|
}.Build()
|
||||||
|
File_unknown_proto = out.File
|
||||||
|
file_unknown_proto_rawDesc = nil
|
||||||
|
file_unknown_proto_goTypes = nil
|
||||||
|
file_unknown_proto_depIdxs = nil
|
||||||
|
}
|
26
client/pb/channel/unknown.proto
Normal file
26
client/pb/channel/unknown.proto
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
// 存放所有未知的结构体
|
||||||
|
syntax = "proto2";
|
||||||
|
|
||||||
|
package channel;
|
||||||
|
|
||||||
|
option go_package = "./;channel";
|
||||||
|
|
||||||
|
message ChannelOidb0xf5bRsp {
|
||||||
|
optional uint64 guildId = 1;
|
||||||
|
repeated GuildMemberInfo bots = 4;
|
||||||
|
repeated GuildMemberInfo members = 5;
|
||||||
|
optional GuildAdminInfo adminInfo = 25;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GuildAdminInfo {
|
||||||
|
repeated GuildMemberInfo admins = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GuildMemberInfo {
|
||||||
|
optional string title = 2;
|
||||||
|
optional string nickname = 3;
|
||||||
|
optional int64 lastSpeakTime = 4; // uncertainty
|
||||||
|
optional int32 role = 5; // uncertainty
|
||||||
|
optional uint64 tinyId = 8;
|
||||||
|
}
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user