diff --git a/client/client.go b/client/client.go index 13a10c86..a2af4213 100644 --- a/client/client.go +++ b/client/client.go @@ -153,10 +153,10 @@ func NewClientMd5(uin int64, passwordMd5 [16]byte) *QQClient { "OidbSvc.0x88d_0": decodeGroupInfoResponse, "OidbSvc.0xe07_0": decodeImageOcrResponse, "OidbSvc.0xd79": decodeWordSegmentation, + "OidbSvc.0x990": decodeTranslateResponse, "SummaryCard.ReqSummaryCard": decodeSummaryCardResponse, "PttCenterSvr.ShortVideoDownReq": decodePttShortVideoDownResponse, "LightAppSvc.mini_app_info.GetAppInfoById": decodeAppInfoResponse, - "OidbSvc.0x990": decodeTranslateResponse, }, sigInfo: &loginSigInfo{}, requestPacketRequestId: 1921334513, diff --git a/client/decoders.go b/client/decoders.go index 6928c7d8..a4f23be7 100644 --- a/client/decoders.go +++ b/client/decoders.go @@ -356,6 +356,7 @@ func decodeGroupMessagePacket(c *QQClient, _ uint16, payload []byte) (interface{ c.dispatchGroupMessageReceiptEvent(&groupMessageReceiptEvent{ Rand: pkt.Message.Body.RichText.Attr.Random, Seq: pkt.Message.Head.MsgSeq, + Msg: c.parseGroupMessage(pkt.Message), }) return nil, nil } diff --git a/client/entities.go b/client/entities.go index 1611e31e..b085c2d9 100644 --- a/client/entities.go +++ b/client/entities.go @@ -3,6 +3,7 @@ package client import ( "errors" "github.com/Mrs4s/MiraiGo/binary/jce" + "github.com/Mrs4s/MiraiGo/message" "strings" "sync" ) @@ -245,6 +246,7 @@ type ( groupMessageReceiptEvent struct { Rand int32 Seq int32 + Msg *message.GroupMessage } ) diff --git a/client/pb/oidb/oidb.pb.go b/client/pb/oidb/oidb.pb.go index 7f3e3dfa..b0e615cd 100644 --- a/client/pb/oidb/oidb.pb.go +++ b/client/pb/oidb/oidb.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.25.0 -// protoc v3.13.0 +// protoc v3.11.4 // source: oidb.proto package oidb diff --git a/client/pb/oidb/oidb0x8fc.pb.go b/client/pb/oidb/oidb0x8fc.pb.go index 0485eda5..4e392c8e 100644 --- a/client/pb/oidb/oidb0x8fc.pb.go +++ b/client/pb/oidb/oidb0x8fc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.25.0 -// protoc v3.13.0 +// protoc v3.11.4 // source: oidb0x8fc.proto package oidb diff --git a/client/pb/oidb/oidb0x990.pb.go b/client/pb/oidb/oidb0x990.pb.go index 1d0391b1..2ab01935 100644 --- a/client/pb/oidb/oidb0x990.pb.go +++ b/client/pb/oidb/oidb0x990.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.25.0 -// protoc v3.13.0 +// protoc v3.11.4 // source: oidb0x990.proto package oidb diff --git a/client/pb/oidb/oidb0xb77.pb.go b/client/pb/oidb/oidb0xb77.pb.go new file mode 100644 index 00000000..3dcc9954 --- /dev/null +++ b/client/pb/oidb/oidb0xb77.pb.go @@ -0,0 +1,579 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.25.0 +// protoc v3.11.4 +// source: oidb0xb77.proto + +package oidb + +import ( + proto "github.com/golang/protobuf/proto" + 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) +) + +// This is a compile-time assertion that a sufficiently up-to-date version +// of the legacy proto package is being used. +const _ = proto.ProtoPackageIsVersion4 + +type DB77ReqBody struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + AppId uint64 `protobuf:"varint,1,opt,name=appId,proto3" json:"appId,omitempty"` + AppType uint32 `protobuf:"varint,2,opt,name=appType,proto3" json:"appType,omitempty"` + MsgStyle uint32 `protobuf:"varint,3,opt,name=msgStyle,proto3" json:"msgStyle,omitempty"` + SenderUin uint64 `protobuf:"varint,4,opt,name=senderUin,proto3" json:"senderUin,omitempty"` + ClientInfo *DB77ClientInfo `protobuf:"bytes,5,opt,name=clientInfo,proto3" json:"clientInfo,omitempty"` + TextMsg string `protobuf:"bytes,6,opt,name=textMsg,proto3" json:"textMsg,omitempty"` + ExtInfo *DB77ExtInfo `protobuf:"bytes,7,opt,name=extInfo,proto3" json:"extInfo,omitempty"` + SendType uint32 `protobuf:"varint,10,opt,name=sendType,proto3" json:"sendType,omitempty"` + RecvUin uint64 `protobuf:"varint,11,opt,name=recvUin,proto3" json:"recvUin,omitempty"` + RichMsgBody *DB77RichMsgBody `protobuf:"bytes,12,opt,name=richMsgBody,proto3" json:"richMsgBody,omitempty"` +} + +func (x *DB77ReqBody) Reset() { + *x = DB77ReqBody{} + if protoimpl.UnsafeEnabled { + mi := &file_oidb0xb77_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DB77ReqBody) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DB77ReqBody) ProtoMessage() {} + +func (x *DB77ReqBody) ProtoReflect() protoreflect.Message { + mi := &file_oidb0xb77_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 DB77ReqBody.ProtoReflect.Descriptor instead. +func (*DB77ReqBody) Descriptor() ([]byte, []int) { + return file_oidb0xb77_proto_rawDescGZIP(), []int{0} +} + +func (x *DB77ReqBody) GetAppId() uint64 { + if x != nil { + return x.AppId + } + return 0 +} + +func (x *DB77ReqBody) GetAppType() uint32 { + if x != nil { + return x.AppType + } + return 0 +} + +func (x *DB77ReqBody) GetMsgStyle() uint32 { + if x != nil { + return x.MsgStyle + } + return 0 +} + +func (x *DB77ReqBody) GetSenderUin() uint64 { + if x != nil { + return x.SenderUin + } + return 0 +} + +func (x *DB77ReqBody) GetClientInfo() *DB77ClientInfo { + if x != nil { + return x.ClientInfo + } + return nil +} + +func (x *DB77ReqBody) GetTextMsg() string { + if x != nil { + return x.TextMsg + } + return "" +} + +func (x *DB77ReqBody) GetExtInfo() *DB77ExtInfo { + if x != nil { + return x.ExtInfo + } + return nil +} + +func (x *DB77ReqBody) GetSendType() uint32 { + if x != nil { + return x.SendType + } + return 0 +} + +func (x *DB77ReqBody) GetRecvUin() uint64 { + if x != nil { + return x.RecvUin + } + return 0 +} + +func (x *DB77ReqBody) GetRichMsgBody() *DB77RichMsgBody { + if x != nil { + return x.RichMsgBody + } + return nil +} + +type DB77ClientInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Platform uint32 `protobuf:"varint,1,opt,name=platform,proto3" json:"platform,omitempty"` + SdkVersion string `protobuf:"bytes,2,opt,name=sdkVersion,proto3" json:"sdkVersion,omitempty"` + AndroidPackageName string `protobuf:"bytes,3,opt,name=androidPackageName,proto3" json:"androidPackageName,omitempty"` + AndroidSignature string `protobuf:"bytes,4,opt,name=androidSignature,proto3" json:"androidSignature,omitempty"` + IosBundleId string `protobuf:"bytes,5,opt,name=iosBundleId,proto3" json:"iosBundleId,omitempty"` + PcSign string `protobuf:"bytes,6,opt,name=pcSign,proto3" json:"pcSign,omitempty"` +} + +func (x *DB77ClientInfo) Reset() { + *x = DB77ClientInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_oidb0xb77_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DB77ClientInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DB77ClientInfo) ProtoMessage() {} + +func (x *DB77ClientInfo) ProtoReflect() protoreflect.Message { + mi := &file_oidb0xb77_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 DB77ClientInfo.ProtoReflect.Descriptor instead. +func (*DB77ClientInfo) Descriptor() ([]byte, []int) { + return file_oidb0xb77_proto_rawDescGZIP(), []int{1} +} + +func (x *DB77ClientInfo) GetPlatform() uint32 { + if x != nil { + return x.Platform + } + return 0 +} + +func (x *DB77ClientInfo) GetSdkVersion() string { + if x != nil { + return x.SdkVersion + } + return "" +} + +func (x *DB77ClientInfo) GetAndroidPackageName() string { + if x != nil { + return x.AndroidPackageName + } + return "" +} + +func (x *DB77ClientInfo) GetAndroidSignature() string { + if x != nil { + return x.AndroidSignature + } + return "" +} + +func (x *DB77ClientInfo) GetIosBundleId() string { + if x != nil { + return x.IosBundleId + } + return "" +} + +func (x *DB77ClientInfo) GetPcSign() string { + if x != nil { + return x.PcSign + } + return "" +} + +type DB77ExtInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + CustomFeatureId []uint32 `protobuf:"varint,11,rep,packed,name=customFeatureId,proto3" json:"customFeatureId,omitempty"` + ApnsWording string `protobuf:"bytes,12,opt,name=apnsWording,proto3" json:"apnsWording,omitempty"` + GroupSaveDbFlag uint32 `protobuf:"varint,13,opt,name=groupSaveDbFlag,proto3" json:"groupSaveDbFlag,omitempty"` + ReceiverAppId uint32 `protobuf:"varint,14,opt,name=receiverAppId,proto3" json:"receiverAppId,omitempty"` + MsgSeq uint64 `protobuf:"varint,15,opt,name=msgSeq,proto3" json:"msgSeq,omitempty"` +} + +func (x *DB77ExtInfo) Reset() { + *x = DB77ExtInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_oidb0xb77_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DB77ExtInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DB77ExtInfo) ProtoMessage() {} + +func (x *DB77ExtInfo) ProtoReflect() protoreflect.Message { + mi := &file_oidb0xb77_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 DB77ExtInfo.ProtoReflect.Descriptor instead. +func (*DB77ExtInfo) Descriptor() ([]byte, []int) { + return file_oidb0xb77_proto_rawDescGZIP(), []int{2} +} + +func (x *DB77ExtInfo) GetCustomFeatureId() []uint32 { + if x != nil { + return x.CustomFeatureId + } + return nil +} + +func (x *DB77ExtInfo) GetApnsWording() string { + if x != nil { + return x.ApnsWording + } + return "" +} + +func (x *DB77ExtInfo) GetGroupSaveDbFlag() uint32 { + if x != nil { + return x.GroupSaveDbFlag + } + return 0 +} + +func (x *DB77ExtInfo) GetReceiverAppId() uint32 { + if x != nil { + return x.ReceiverAppId + } + return 0 +} + +func (x *DB77ExtInfo) GetMsgSeq() uint64 { + if x != nil { + return x.MsgSeq + } + return 0 +} + +type DB77RichMsgBody struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Title string `protobuf:"bytes,10,opt,name=title,proto3" json:"title,omitempty"` + Summary string `protobuf:"bytes,11,opt,name=summary,proto3" json:"summary,omitempty"` + Brief string `protobuf:"bytes,12,opt,name=brief,proto3" json:"brief,omitempty"` + Url string `protobuf:"bytes,13,opt,name=url,proto3" json:"url,omitempty"` + PictureUrl string `protobuf:"bytes,14,opt,name=pictureUrl,proto3" json:"pictureUrl,omitempty"` + Action string `protobuf:"bytes,15,opt,name=action,proto3" json:"action,omitempty"` + MusicUrl string `protobuf:"bytes,16,opt,name=musicUrl,proto3" json:"musicUrl,omitempty"` //ImageInfo imageInfo = 17; +} + +func (x *DB77RichMsgBody) Reset() { + *x = DB77RichMsgBody{} + if protoimpl.UnsafeEnabled { + mi := &file_oidb0xb77_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DB77RichMsgBody) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DB77RichMsgBody) ProtoMessage() {} + +func (x *DB77RichMsgBody) ProtoReflect() protoreflect.Message { + mi := &file_oidb0xb77_proto_msgTypes[3] + 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 DB77RichMsgBody.ProtoReflect.Descriptor instead. +func (*DB77RichMsgBody) Descriptor() ([]byte, []int) { + return file_oidb0xb77_proto_rawDescGZIP(), []int{3} +} + +func (x *DB77RichMsgBody) GetTitle() string { + if x != nil { + return x.Title + } + return "" +} + +func (x *DB77RichMsgBody) GetSummary() string { + if x != nil { + return x.Summary + } + return "" +} + +func (x *DB77RichMsgBody) GetBrief() string { + if x != nil { + return x.Brief + } + return "" +} + +func (x *DB77RichMsgBody) GetUrl() string { + if x != nil { + return x.Url + } + return "" +} + +func (x *DB77RichMsgBody) GetPictureUrl() string { + if x != nil { + return x.PictureUrl + } + return "" +} + +func (x *DB77RichMsgBody) GetAction() string { + if x != nil { + return x.Action + } + return "" +} + +func (x *DB77RichMsgBody) GetMusicUrl() string { + if x != nil { + return x.MusicUrl + } + return "" +} + +var File_oidb0xb77_proto protoreflect.FileDescriptor + +var file_oidb0xb77_proto_rawDesc = []byte{ + 0x0a, 0x0f, 0x6f, 0x69, 0x64, 0x62, 0x30, 0x78, 0x62, 0x37, 0x37, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x22, 0xd4, 0x02, 0x0a, 0x0b, 0x44, 0x42, 0x37, 0x37, 0x52, 0x65, 0x71, 0x42, 0x6f, 0x64, + 0x79, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x70, 0x70, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, + 0x52, 0x05, 0x61, 0x70, 0x70, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x70, 0x70, 0x54, 0x79, + 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x61, 0x70, 0x70, 0x54, 0x79, 0x70, + 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x73, 0x67, 0x53, 0x74, 0x79, 0x6c, 0x65, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x0d, 0x52, 0x08, 0x6d, 0x73, 0x67, 0x53, 0x74, 0x79, 0x6c, 0x65, 0x12, 0x1c, 0x0a, + 0x09, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x55, 0x69, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, + 0x52, 0x09, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x55, 0x69, 0x6e, 0x12, 0x2f, 0x0a, 0x0a, 0x63, + 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x0f, 0x2e, 0x44, 0x42, 0x37, 0x37, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x6e, 0x66, 0x6f, + 0x52, 0x0a, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x18, 0x0a, 0x07, + 0x74, 0x65, 0x78, 0x74, 0x4d, 0x73, 0x67, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x74, + 0x65, 0x78, 0x74, 0x4d, 0x73, 0x67, 0x12, 0x26, 0x0a, 0x07, 0x65, 0x78, 0x74, 0x49, 0x6e, 0x66, + 0x6f, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x44, 0x42, 0x37, 0x37, 0x45, 0x78, + 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x07, 0x65, 0x78, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1a, + 0x0a, 0x08, 0x73, 0x65, 0x6e, 0x64, 0x54, 0x79, 0x70, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0d, + 0x52, 0x08, 0x73, 0x65, 0x6e, 0x64, 0x54, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, + 0x63, 0x76, 0x55, 0x69, 0x6e, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x72, 0x65, 0x63, + 0x76, 0x55, 0x69, 0x6e, 0x12, 0x32, 0x0a, 0x0b, 0x72, 0x69, 0x63, 0x68, 0x4d, 0x73, 0x67, 0x42, + 0x6f, 0x64, 0x79, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x44, 0x42, 0x37, 0x37, + 0x52, 0x69, 0x63, 0x68, 0x4d, 0x73, 0x67, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x0b, 0x72, 0x69, 0x63, + 0x68, 0x4d, 0x73, 0x67, 0x42, 0x6f, 0x64, 0x79, 0x22, 0xe2, 0x01, 0x0a, 0x0e, 0x44, 0x42, 0x37, + 0x37, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1a, 0x0a, 0x08, 0x70, + 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x70, + 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x64, 0x6b, 0x56, 0x65, + 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x64, 0x6b, + 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x2e, 0x0a, 0x12, 0x61, 0x6e, 0x64, 0x72, 0x6f, + 0x69, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x12, 0x61, 0x6e, 0x64, 0x72, 0x6f, 0x69, 0x64, 0x50, 0x61, 0x63, 0x6b, + 0x61, 0x67, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x2a, 0x0a, 0x10, 0x61, 0x6e, 0x64, 0x72, 0x6f, + 0x69, 0x64, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x10, 0x61, 0x6e, 0x64, 0x72, 0x6f, 0x69, 0x64, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, + 0x75, 0x72, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x69, 0x6f, 0x73, 0x42, 0x75, 0x6e, 0x64, 0x6c, 0x65, + 0x49, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x69, 0x6f, 0x73, 0x42, 0x75, 0x6e, + 0x64, 0x6c, 0x65, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x63, 0x53, 0x69, 0x67, 0x6e, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x63, 0x53, 0x69, 0x67, 0x6e, 0x22, 0xc1, 0x01, + 0x0a, 0x0b, 0x44, 0x42, 0x37, 0x37, 0x45, 0x78, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x28, 0x0a, + 0x0f, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x49, 0x64, + 0x18, 0x0b, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x0f, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x46, 0x65, + 0x61, 0x74, 0x75, 0x72, 0x65, 0x49, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x61, 0x70, 0x6e, 0x73, 0x57, + 0x6f, 0x72, 0x64, 0x69, 0x6e, 0x67, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x61, 0x70, + 0x6e, 0x73, 0x57, 0x6f, 0x72, 0x64, 0x69, 0x6e, 0x67, 0x12, 0x28, 0x0a, 0x0f, 0x67, 0x72, 0x6f, + 0x75, 0x70, 0x53, 0x61, 0x76, 0x65, 0x44, 0x62, 0x46, 0x6c, 0x61, 0x67, 0x18, 0x0d, 0x20, 0x01, + 0x28, 0x0d, 0x52, 0x0f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x53, 0x61, 0x76, 0x65, 0x44, 0x62, 0x46, + 0x6c, 0x61, 0x67, 0x12, 0x24, 0x0a, 0x0d, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x72, 0x41, + 0x70, 0x70, 0x49, 0x64, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0d, 0x72, 0x65, 0x63, 0x65, + 0x69, 0x76, 0x65, 0x72, 0x41, 0x70, 0x70, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x6d, 0x73, 0x67, + 0x53, 0x65, 0x71, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x6d, 0x73, 0x67, 0x53, 0x65, + 0x71, 0x22, 0xbd, 0x01, 0x0a, 0x0f, 0x44, 0x42, 0x37, 0x37, 0x52, 0x69, 0x63, 0x68, 0x4d, 0x73, + 0x67, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x0a, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, + 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x75, + 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x72, 0x69, 0x65, 0x66, 0x18, 0x0c, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x62, 0x72, 0x69, 0x65, 0x66, 0x12, 0x10, 0x0a, 0x03, 0x75, + 0x72, 0x6c, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x1e, 0x0a, + 0x0a, 0x70, 0x69, 0x63, 0x74, 0x75, 0x72, 0x65, 0x55, 0x72, 0x6c, 0x18, 0x0e, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0a, 0x70, 0x69, 0x63, 0x74, 0x75, 0x72, 0x65, 0x55, 0x72, 0x6c, 0x12, 0x16, 0x0a, + 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x75, 0x73, 0x69, 0x63, 0x55, 0x72, + 0x6c, 0x18, 0x10, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6d, 0x75, 0x73, 0x69, 0x63, 0x55, 0x72, + 0x6c, 0x42, 0x08, 0x5a, 0x06, 0x2e, 0x3b, 0x6f, 0x69, 0x64, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, +} + +var ( + file_oidb0xb77_proto_rawDescOnce sync.Once + file_oidb0xb77_proto_rawDescData = file_oidb0xb77_proto_rawDesc +) + +func file_oidb0xb77_proto_rawDescGZIP() []byte { + file_oidb0xb77_proto_rawDescOnce.Do(func() { + file_oidb0xb77_proto_rawDescData = protoimpl.X.CompressGZIP(file_oidb0xb77_proto_rawDescData) + }) + return file_oidb0xb77_proto_rawDescData +} + +var file_oidb0xb77_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_oidb0xb77_proto_goTypes = []interface{}{ + (*DB77ReqBody)(nil), // 0: DB77ReqBody + (*DB77ClientInfo)(nil), // 1: DB77ClientInfo + (*DB77ExtInfo)(nil), // 2: DB77ExtInfo + (*DB77RichMsgBody)(nil), // 3: DB77RichMsgBody +} +var file_oidb0xb77_proto_depIdxs = []int32{ + 1, // 0: DB77ReqBody.clientInfo:type_name -> DB77ClientInfo + 2, // 1: DB77ReqBody.extInfo:type_name -> DB77ExtInfo + 3, // 2: DB77ReqBody.richMsgBody:type_name -> DB77RichMsgBody + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_oidb0xb77_proto_init() } +func file_oidb0xb77_proto_init() { + if File_oidb0xb77_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_oidb0xb77_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DB77ReqBody); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_oidb0xb77_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DB77ClientInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_oidb0xb77_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DB77ExtInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_oidb0xb77_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DB77RichMsgBody); 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_oidb0xb77_proto_rawDesc, + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_oidb0xb77_proto_goTypes, + DependencyIndexes: file_oidb0xb77_proto_depIdxs, + MessageInfos: file_oidb0xb77_proto_msgTypes, + }.Build() + File_oidb0xb77_proto = out.File + file_oidb0xb77_proto_rawDesc = nil + file_oidb0xb77_proto_goTypes = nil + file_oidb0xb77_proto_depIdxs = nil +} diff --git a/client/pb/oidb/oidb0xb77.proto b/client/pb/oidb/oidb0xb77.proto new file mode 100644 index 00000000..240a8422 --- /dev/null +++ b/client/pb/oidb/oidb0xb77.proto @@ -0,0 +1,44 @@ +syntax = "proto3"; + +option go_package = ".;oidb"; + +message DB77ReqBody { + uint64 appId = 1; + uint32 appType = 2; + uint32 msgStyle = 3; + uint64 senderUin = 4; + DB77ClientInfo clientInfo = 5; + string textMsg = 6; + DB77ExtInfo extInfo = 7; + uint32 sendType = 10; + uint64 recvUin = 11; + DB77RichMsgBody richMsgBody = 12; +} + +message DB77ClientInfo { + uint32 platform = 1; + string sdkVersion = 2; + string androidPackageName = 3; + string androidSignature = 4; + string iosBundleId = 5; + string pcSign = 6; +} + +message DB77ExtInfo { + repeated uint32 customFeatureId = 11; + string apnsWording = 12; + uint32 groupSaveDbFlag = 13; + uint32 receiverAppId = 14; + uint64 msgSeq = 15; +} + +message DB77RichMsgBody { + string title = 10; + string summary = 11; + string brief = 12; + string url = 13; + string pictureUrl = 14; + string action = 15; + string musicUrl = 16; + //ImageInfo imageInfo = 17; +} \ No newline at end of file diff --git a/client/pb/oidb/oidb0xd79.pb.go b/client/pb/oidb/oidb0xd79.pb.go index 18540289..4c6dab9c 100644 --- a/client/pb/oidb/oidb0xd79.pb.go +++ b/client/pb/oidb/oidb0xd79.pb.go @@ -1,8 +1,8 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.25.0 -// protoc v3.13.0 -// source: oidb0xD79.proto +// protoc v3.11.4 +// source: oidb0xd79.proto package oidb @@ -42,7 +42,7 @@ type D79ReqBody struct { func (x *D79ReqBody) Reset() { *x = D79ReqBody{} if protoimpl.UnsafeEnabled { - mi := &file_oidb0xD79_proto_msgTypes[0] + mi := &file_oidb0xd79_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -55,7 +55,7 @@ func (x *D79ReqBody) String() string { func (*D79ReqBody) ProtoMessage() {} func (x *D79ReqBody) ProtoReflect() protoreflect.Message { - mi := &file_oidb0xD79_proto_msgTypes[0] + mi := &file_oidb0xd79_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -68,7 +68,7 @@ func (x *D79ReqBody) ProtoReflect() protoreflect.Message { // Deprecated: Use D79ReqBody.ProtoReflect.Descriptor instead. func (*D79ReqBody) Descriptor() ([]byte, []int) { - return file_oidb0xD79_proto_rawDescGZIP(), []int{0} + return file_oidb0xd79_proto_rawDescGZIP(), []int{0} } func (x *D79ReqBody) GetSeq() uint64 { @@ -135,7 +135,7 @@ type D79RspBody struct { func (x *D79RspBody) Reset() { *x = D79RspBody{} if protoimpl.UnsafeEnabled { - mi := &file_oidb0xD79_proto_msgTypes[1] + mi := &file_oidb0xd79_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -148,7 +148,7 @@ func (x *D79RspBody) String() string { func (*D79RspBody) ProtoMessage() {} func (x *D79RspBody) ProtoReflect() protoreflect.Message { - mi := &file_oidb0xD79_proto_msgTypes[1] + mi := &file_oidb0xd79_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -161,7 +161,7 @@ func (x *D79RspBody) ProtoReflect() protoreflect.Message { // Deprecated: Use D79RspBody.ProtoReflect.Descriptor instead. func (*D79RspBody) Descriptor() ([]byte, []int) { - return file_oidb0xD79_proto_rawDescGZIP(), []int{1} + return file_oidb0xd79_proto_rawDescGZIP(), []int{1} } func (x *D79RspBody) GetRet() uint32 { @@ -210,7 +210,7 @@ type D79Content struct { func (x *D79Content) Reset() { *x = D79Content{} if protoimpl.UnsafeEnabled { - mi := &file_oidb0xD79_proto_msgTypes[2] + mi := &file_oidb0xd79_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -223,7 +223,7 @@ func (x *D79Content) String() string { func (*D79Content) ProtoMessage() {} func (x *D79Content) ProtoReflect() protoreflect.Message { - mi := &file_oidb0xD79_proto_msgTypes[2] + mi := &file_oidb0xd79_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -236,7 +236,7 @@ func (x *D79Content) ProtoReflect() protoreflect.Message { // Deprecated: Use D79Content.ProtoReflect.Descriptor instead. func (*D79Content) Descriptor() ([]byte, []int) { - return file_oidb0xD79_proto_rawDescGZIP(), []int{2} + return file_oidb0xd79_proto_rawDescGZIP(), []int{2} } func (x *D79Content) GetSliceContent() [][]byte { @@ -246,10 +246,10 @@ func (x *D79Content) GetSliceContent() [][]byte { return nil } -var File_oidb0xD79_proto protoreflect.FileDescriptor +var File_oidb0xd79_proto protoreflect.FileDescriptor -var file_oidb0xD79_proto_rawDesc = []byte{ - 0x0a, 0x0f, 0x6f, 0x69, 0x64, 0x62, 0x30, 0x78, 0x44, 0x37, 0x39, 0x2e, 0x70, 0x72, 0x6f, 0x74, +var file_oidb0xd79_proto_rawDesc = []byte{ + 0x0a, 0x0f, 0x6f, 0x69, 0x64, 0x62, 0x30, 0x78, 0x64, 0x37, 0x39, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xbb, 0x01, 0x0a, 0x0a, 0x44, 0x37, 0x39, 0x52, 0x65, 0x71, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x65, 0x71, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x73, 0x65, 0x71, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, @@ -279,24 +279,24 @@ var file_oidb0xD79_proto_rawDesc = []byte{ } var ( - file_oidb0xD79_proto_rawDescOnce sync.Once - file_oidb0xD79_proto_rawDescData = file_oidb0xD79_proto_rawDesc + file_oidb0xd79_proto_rawDescOnce sync.Once + file_oidb0xd79_proto_rawDescData = file_oidb0xd79_proto_rawDesc ) -func file_oidb0xD79_proto_rawDescGZIP() []byte { - file_oidb0xD79_proto_rawDescOnce.Do(func() { - file_oidb0xD79_proto_rawDescData = protoimpl.X.CompressGZIP(file_oidb0xD79_proto_rawDescData) +func file_oidb0xd79_proto_rawDescGZIP() []byte { + file_oidb0xd79_proto_rawDescOnce.Do(func() { + file_oidb0xd79_proto_rawDescData = protoimpl.X.CompressGZIP(file_oidb0xd79_proto_rawDescData) }) - return file_oidb0xD79_proto_rawDescData + return file_oidb0xd79_proto_rawDescData } -var file_oidb0xD79_proto_msgTypes = make([]protoimpl.MessageInfo, 3) -var file_oidb0xD79_proto_goTypes = []interface{}{ +var file_oidb0xd79_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_oidb0xd79_proto_goTypes = []interface{}{ (*D79ReqBody)(nil), // 0: D79ReqBody (*D79RspBody)(nil), // 1: D79RspBody (*D79Content)(nil), // 2: D79Content } -var file_oidb0xD79_proto_depIdxs = []int32{ +var file_oidb0xd79_proto_depIdxs = []int32{ 2, // 0: D79RspBody.content:type_name -> D79Content 1, // [1:1] is the sub-list for method output_type 1, // [1:1] is the sub-list for method input_type @@ -305,13 +305,13 @@ var file_oidb0xD79_proto_depIdxs = []int32{ 0, // [0:1] is the sub-list for field type_name } -func init() { file_oidb0xD79_proto_init() } -func file_oidb0xD79_proto_init() { - if File_oidb0xD79_proto != nil { +func init() { file_oidb0xd79_proto_init() } +func file_oidb0xd79_proto_init() { + if File_oidb0xd79_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_oidb0xD79_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_oidb0xd79_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*D79ReqBody); i { case 0: return &v.state @@ -323,7 +323,7 @@ func file_oidb0xD79_proto_init() { return nil } } - file_oidb0xD79_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_oidb0xd79_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*D79RspBody); i { case 0: return &v.state @@ -335,7 +335,7 @@ func file_oidb0xD79_proto_init() { return nil } } - file_oidb0xD79_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_oidb0xd79_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*D79Content); i { case 0: return &v.state @@ -352,18 +352,18 @@ func file_oidb0xD79_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_oidb0xD79_proto_rawDesc, + RawDescriptor: file_oidb0xd79_proto_rawDesc, NumEnums: 0, NumMessages: 3, NumExtensions: 0, NumServices: 0, }, - GoTypes: file_oidb0xD79_proto_goTypes, - DependencyIndexes: file_oidb0xD79_proto_depIdxs, - MessageInfos: file_oidb0xD79_proto_msgTypes, + GoTypes: file_oidb0xd79_proto_goTypes, + DependencyIndexes: file_oidb0xd79_proto_depIdxs, + MessageInfos: file_oidb0xd79_proto_msgTypes, }.Build() - File_oidb0xD79_proto = out.File - file_oidb0xD79_proto_rawDesc = nil - file_oidb0xD79_proto_goTypes = nil - file_oidb0xD79_proto_depIdxs = nil + File_oidb0xd79_proto = out.File + file_oidb0xd79_proto_rawDesc = nil + file_oidb0xd79_proto_goTypes = nil + file_oidb0xd79_proto_depIdxs = nil } diff --git a/client/pb/oidb/oidb0xdad.pb.go b/client/pb/oidb/oidb0xdad.pb.go index 6323f1d6..7f91cb3e 100644 --- a/client/pb/oidb/oidb0xdad.pb.go +++ b/client/pb/oidb/oidb0xdad.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.25.0 -// protoc v3.13.0 +// protoc v3.11.4 // source: oidb0xdad.proto package oidb diff --git a/client/richmsg.go b/client/richmsg.go new file mode 100644 index 00000000..dac0f84d --- /dev/null +++ b/client/richmsg.go @@ -0,0 +1,76 @@ +package client + +import ( + "errors" + "github.com/Mrs4s/MiraiGo/client/pb/oidb" + "github.com/Mrs4s/MiraiGo/message" + "github.com/Mrs4s/MiraiGo/protocol/packets" + "github.com/Mrs4s/MiraiGo/utils" + "google.golang.org/protobuf/proto" + "math/rand" + "time" +) + +type RichClientInfo struct { + Platform uint32 + SdkVersion string + PackageName string + Signature string +} + +func (c *QQClient) SendGroupRichMessage(target, appId int64, appType, msgStyle uint32, client RichClientInfo, msg *message.RichMessage) (*message.GroupMessage, error) { + ch := make(chan *message.GroupMessage) + eid := utils.RandomString(6) + c.onGroupMessageReceipt(eid, func(c *QQClient, e *groupMessageReceiptEvent) { + for _, elem := range e.Msg.Elements { + if elem.Type() == message.LightApp || elem.Type() == message.Service { + ch <- e.Msg + } + } + }) + defer c.onGroupMessageReceipt(eid) + _, _ = c.sendAndWait(c.buildRichMsgSendingPacket(target, appId, appType, msgStyle, client, msg)) // rsp is empty chunk + select { + case ret := <-ch: + return ret, nil + case <-time.After(time.Second * 5): + return nil, errors.New("timeout") + } +} + +// OidbSvc.0xb77_9 +func (c *QQClient) buildRichMsgSendingPacket(target, appId int64, appType, msgStyle uint32, client RichClientInfo, msg *message.RichMessage) (uint16, []byte) { + seq := c.nextSeq() + body := &oidb.DB77ReqBody{ + AppId: uint64(appId), + AppType: appType, + MsgStyle: msgStyle, + ClientInfo: &oidb.DB77ClientInfo{ + Platform: client.Platform, + SdkVersion: client.SdkVersion, + AndroidPackageName: client.PackageName, + AndroidSignature: client.Signature, + }, + ExtInfo: &oidb.DB77ExtInfo{MsgSeq: rand.Uint64()}, + SendType: 1, + RecvUin: uint64(target), + RichMsgBody: &oidb.DB77RichMsgBody{ + Title: msg.Title, + Summary: msg.Summary, + Brief: msg.Brief, + Url: msg.Url, + PictureUrl: msg.PictureUrl, + MusicUrl: msg.MusicUrl, + }, + } + b, _ := proto.Marshal(body) + req := &oidb.OIDBSSOPkg{ + Command: 2935, + ServiceType: 9, + Bodybuffer: b, + ClientVersion: "android 8.4.8", + } + payload, _ := proto.Marshal(req) + packet := packets.BuildUniPacket(c.Uin, seq, "OidbSvc.0xb77_9", 1, c.OutGoingPacketSessionId, EmptyBytes, c.sigInfo.d2Key, payload) + return seq, packet +} diff --git a/message/message.go b/message/message.go index a6827c6a..c9e9821a 100644 --- a/message/message.go +++ b/message/message.go @@ -58,6 +58,15 @@ type ( Message []IMessageElement } + RichMessage struct { + Title string + Summary string + Brief string + Url string + PictureUrl string + MusicUrl string + } + Sender struct { Uin int64 Nickname string