-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: 群打卡 * ... * ... * ...
- Loading branch information
Showing
4 changed files
with
130 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package oidb | ||
|
||
import ( | ||
"errors" | ||
"strconv" | ||
|
||
"github.com/LagrangeDev/LagrangeGo/client/packets/pb/service/oidb" | ||
) | ||
|
||
// 群打卡 | ||
|
||
type BotGroupClockInResult struct { | ||
Title string // 今日已成功打卡 | ||
KeepDayText string // 已打卡N天 | ||
GroupRankText string // 群内排名第N位 | ||
ClockInUtcTime int64 // 打卡时间 | ||
DetailURL string // Detail info url https://qun.qq.com/v2/signin/detail?... | ||
} | ||
|
||
func BuildGroupSignPacket(botUin, groupUin uint32, appVersion string) (*Packet, error) { | ||
body := &oidb.OidbSvcTrpcTcp0XEB7_1_ReqBody{ | ||
SignInWriteReq: &oidb.StSignInWriteReq{ | ||
Uin: strconv.Itoa(int(botUin)), | ||
GroupUin: strconv.Itoa(int(groupUin)), | ||
AppVersion: appVersion, | ||
}, | ||
} | ||
return BuildOidbPacket(0xEB7, 1, body, false, false) | ||
} | ||
|
||
func ParseGroupSignResp(data []byte) (*BotGroupClockInResult, error) { | ||
var rsp oidb.OidbSvcTrpcTcp0XEB7_1_RspBody | ||
_, err := ParseOidbPacket(data, &rsp) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
if rsp.SignInWriteRsp == nil || rsp.SignInWriteRsp.DoneInfo == nil { | ||
return nil, errors.New("SignInWriteRsp or SignInWriteRsp.DoneInfo nil") | ||
} | ||
|
||
ret := &BotGroupClockInResult{ | ||
Title: rsp.SignInWriteRsp.DoneInfo.Title, | ||
KeepDayText: rsp.SignInWriteRsp.DoneInfo.KeepDayText, | ||
DetailURL: rsp.SignInWriteRsp.DoneInfo.DetailUrl, | ||
} | ||
if size := len(rsp.SignInWriteRsp.DoneInfo.ClockInInfo); size > 0 { | ||
ret.GroupRankText = rsp.SignInWriteRsp.DoneInfo.ClockInInfo[0] | ||
if size > 1 { | ||
ret.ClockInUtcTime, _ = strconv.ParseInt(rsp.SignInWriteRsp.DoneInfo.ClockInInfo[1], 10, 64) | ||
} | ||
} | ||
return ret, nil | ||
} |
33 changes: 33 additions & 0 deletions
33
client/packets/pb/service/oidb/OidbSvcTrpcTcp0xEB7_1.pb.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
30 changes: 30 additions & 0 deletions
30
client/packets/pb/service/oidb/OidbSvcTrpcTcp0xEB7_1.proto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
syntax = "proto3"; | ||
|
||
option go_package = "github.com/LagrangeDev/LagrangeGo/client/packets/pb/service/oidb"; | ||
|
||
// see https://github.com/LagrangeDev/Lagrange.Core/blob/47b819d43ad101a1a066a3f8afa094d000fe19f5/Lagrange.Core/Internal/Packets/Service/Oidb/Request/OidbSvcTrpcTcp0xEB7_1.cs | ||
|
||
message OidbSvcTrpcTcp0xEB7_1_ReqBody { | ||
optional StSignInWriteReq signInWriteReq = 2; | ||
} | ||
|
||
message StSignInWriteReq { | ||
string Uin = 1; | ||
string GroupUin = 2; | ||
string AppVersion = 3; // 不确定要不要加,测试过没有这个参数也是可以的 | ||
} | ||
|
||
message OidbSvcTrpcTcp0xEB7_1_RspBody { | ||
optional StSignInWriteRsp signInWriteRsp = 2; | ||
} | ||
|
||
message StSignInWriteRsp { | ||
optional SignInStatusDoneInfo doneInfo = 2; | ||
} | ||
|
||
message SignInStatusDoneInfo { | ||
string Title = 1; // 今日已成功打卡 | ||
string KeepDayText = 2; // 已打卡N天 | ||
repeated string ClockInInfo = 3; // ["群内排名第N位", "[clock in timestamp (second)]"] | ||
string DetailUrl = 4; // https://qun.qq.com/v2/signin/detail?... | ||
} |