Skip to content

Commit

Permalink
update submodule
Browse files Browse the repository at this point in the history
  • Loading branch information
DarkRRb committed Oct 13, 2024
1 parent 999b88e commit 638acba
Show file tree
Hide file tree
Showing 11 changed files with 88 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Lagrange.Core
8 changes: 8 additions & 0 deletions Lagrange.Kritor/src/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
using Lagrange.Kritor.Services.Kritor.Grpc.Group;
using Lagrange.Kritor.Services.Kritor.Grpc.Guild;
using Lagrange.Kritor.Services.Kritor.Grpc.Message;
using Lagrange.Kritor.Services.Kritor.Grpc.Friend;
using Lagrange.Kritor.Services.Kritor.Grpc.Process;
using Lagrange.Kritor.Services.Kritor.Grpc.Reverse;
using Lagrange.Kritor.Services.Kritor.Grpc.Web;

namespace Lagrange.Kritor;
internal class Program {
Expand Down Expand Up @@ -76,9 +80,13 @@ private static void Main(string[] args) {
app.MapGrpcService<KritorCoreService>();
app.MapGrpcService<KritorEventService>();
app.MapGrpcService<KritorGroupFileService>();
app.MapGrpcService<KritorFriendService>();
app.MapGrpcService<KritorGroupService>();
app.MapGrpcService<KritorGuildService>();
app.MapGrpcService<KritorMessageService>();
app.MapGrpcService<KritorProcessService>();
app.MapGrpcService<KritorReverseService>();
app.MapGrpcService<KritorWebService>();
app.MapGet("/", () => "Hey kid, you're supposed to use gRPC to access it, not a browser.");

app.Run();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,12 @@ public override Task<GetTicketResponse> GetTicket(GetTicketRequest request, Serv
});
}

// WONTSUPPORTED
public override Task<AddTicketResponse> AddTicket(AddTicketRequest request, ServerCallContext context) {
return base.AddTicket(request, context);
}

// WONTSUPPORTED
public override Task<DeleteTicketResponse> DeleteTicket(DeleteTicketRequest request, ServerCallContext context) {
return base.DeleteTicket(request, context);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public override Task<GetVersionResponse> GetVersion(GetVersionRequest request, S
});
}

//
public override Task<DownloadFileResponse> DownloadFile(DownloadFileRequest request, ServerCallContext context) {
return base.DownloadFile(request, context);
}
Expand All @@ -31,6 +32,7 @@ public override Task<GetCurrentAccountResponse> GetCurrentAccount(GetCurrentAcco
});
}

// WONTSUPPORTED
public override Task<SwitchAccountResponse> SwitchAccount(SwitchAccountRequest request, ServerCallContext context) {
return base.SwitchAccount(request, context);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,16 @@ public KritorEventService(BotContext bot, IHostApplicationLifetime lifetime) {
bot.Invoker.OnFriendRecallEvent += async (_, e) => {
OnKritorNoticeEvent?.Invoke(await e.ToNoticeEvent(bot, lifetime.ApplicationStopping));
};
// bot.Invoker.On // TODO: PrivateFileUploadedNotice
// PrivateFileUploadedNotice // TODO: Lagrange
bot.Invoker.OnGroupPokeEvent += async (_, e) => {
OnKritorNoticeEvent?.Invoke(await e.ToNoticeEvent(bot, lifetime.ApplicationStopping));
};
bot.Invoker.OnGroupRecallEvent += async (_, e) => {
OnKritorNoticeEvent?.Invoke(await e.ToNoticeEvent(bot, lifetime.ApplicationStopping));
};
// bot.Invoker.On // TODO: GroupFileUploadedNotice
// bot.Invoker.On // TODO: GroupCardChangedNotice
// bot.Invoker.On // TODO: GroupUniqueTitleChangedNotice
// GroupFileUploadedNotice // TODO: Lagrange
// GroupCardChangedNotice // WONTSUPPORTED
// GroupUniqueTitleChangedNotice // TODO: Lagrange
bot.Invoker.OnGroupEssenceEvent += async (_, e) => {
OnKritorNoticeEvent?.Invoke(await e.ToNoticeEvent(bot, lifetime.ApplicationStopping));
};
Expand All @@ -59,7 +59,7 @@ public KritorEventService(BotContext bot, IHostApplicationLifetime lifetime) {
bot.Invoker.OnGroupAdminChangedEvent += async (_, e) => {
OnKritorNoticeEvent?.Invoke(await e.ToNoticeEvent(bot, lifetime.ApplicationStopping));
};
// bot.Invoker.On // TODO: GroupSignInNotice
// GroupSignInNotice // TODO: Lagrange
bot.Invoker.OnGroupMemberMuteEvent += async (_, e) => {
OnKritorNoticeEvent?.Invoke(await e.ToNoticeEvent(bot, lifetime.ApplicationStopping));
};
Expand All @@ -69,9 +69,9 @@ public KritorEventService(BotContext bot, IHostApplicationLifetime lifetime) {
bot.Invoker.OnGroupReactionEvent += async (_, e) => {
OnKritorNoticeEvent?.Invoke(await e.ToNoticeEvent(bot, lifetime.ApplicationStopping));
};
// bot.Invoker.On // TODO: GroupTransferNotice
// bot.Invoker.On // TODO: FriendIncreasedNotice
// bot.Invoker.On // TODO: FriendDecreasedNotice
// GroupTransferNotice // TODO: Lagrange
// FriendIncreasedNotice // TODO: Lagrange
// FriendDecreasedNotice // TODO: Lagrange

// RequestEvent
bot.Invoker.OnFriendRequestEvent += (_, e) => OnKritorRequestEvent?.Invoke(e.ToRequestEvent());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@ namespace Lagrange.Kritor.Services.Kritor.Grpc.File;
public class KritorGroupFileService(BotContext bot) : GroupFileServiceBase {
private readonly BotContext _bot = bot;

// TODO: Lagrange
public override Task<CreateFolderResponse> CreateFolder(CreateFolderRequest request, ServerCallContext context) {
// (int retCode, string retMsg) = await _bot.GroupFSCreateFolder((uint)request.GroupId, request.Name);

return base.CreateFolder(request, context);
}

// TODO: Lagrange
public override Task<RenameFolderResponse> RenameFolder(RenameFolderRequest request, ServerCallContext context) {
// (int retCode, string retMsg) = await _bot.GroupFSRenameFolder((uint)request.GroupId, request.FolderId, request.Name);

Expand Down Expand Up @@ -74,8 +76,10 @@ public override async Task<GetFileSystemInfoResponse> GetFileSystemInfo(GetFileS

return new GetFileSystemInfoResponse {
FileCount = count,
// TODO: Lagrange
// TotalCount =
UsedSpace = space,
// TODO: Lagrange
// TotalCount =
};
}
Expand All @@ -91,15 +95,20 @@ public override async Task<GetFileListResponse> GetFileList(GetFileListRequest r
FileId = entry.FileId,
FileName = entry.FileName,
FileSize = entry.FileSize,
// TODO: Lagrange
// BusId =
UploadTime = (ulong)new DateTimeOffset(entry.UploadedTime).ToUnixTimeSeconds(),
ExpireTime = (ulong)new DateTimeOffset(entry.ExpireTime).ToUnixTimeSeconds(),
ModifyTime = (ulong)new DateTimeOffset(entry.ModifiedTime).ToUnixTimeSeconds(),
DownloadTimes = entry.DownloadedTimes,
Uploader = entry.UploaderUin,
// TODO: Lagrange
// UploaderName =
// TODO: Lagrange
// Sha =
// TODO: Lagrange
// Sha3 =
// TODO: Lagrange
// Md5 =
});

Expand All @@ -110,6 +119,7 @@ public override async Task<GetFileListResponse> GetFileList(GetFileListRequest r
TotalFileCount = entry.TotalFileCount,
CreateTime = (ulong)new DateTimeOffset(entry.CreateTime).ToUnixTimeSeconds(),
Creator = entry.CreatorUin,
// TODO: Lagrange
// CreatorName = entry.
});
return new GetFileListResponse {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace Lagrange.Kritor.Services.Kritor.Grpc.Friend;

public class KritorFirendService(BotContext bot) : FriendServiceBase {
public class KritorFriendService(BotContext bot) : FriendServiceBase {
private readonly BotContext _bot = bot;

public override async Task<GetFriendListResponse> GetFriendList(GetFriendListRequest request, ServerCallContext context) {
Expand All @@ -22,9 +22,13 @@ public override async Task<GetFriendListResponse> GetFriendList(GetFriendListReq
Qid = friend.Qid,
Nick = friend.Nickname,
Remark = friend.Remarks,
// TODO: Lagrange
// Level =
// TODO: Lagrange
// Age =
// TODO: Lagrange
// VoteCnt =
// TODO: Lagrange
// Gender =
FriendGroupId = (int)friend.Group.GroupId
});
Expand All @@ -43,10 +47,15 @@ public override async Task<GetFriendProfileCardResponse> GetFriendProfileCard(Ge
Qid = friend.Qid,
Nick = friend.Nickname,
Remark = friend.Remarks,
// TODO: Lagrange
// Level =
// TODO: Lagrange
// Birthday =
// TODO: Lagrange
// LoginDay =
// TODO: Lagrange
// VoteCnt =
// TODO: Lagrange
// IsSchoolVerified =
});

Expand All @@ -64,10 +73,13 @@ public override async Task<GetStrangerProfileCardResponse> GetStrangerProfileCar
Uin = user.Uin,
Qid = user.Qid,
Nick = user.Nickname,
// TODO: Lagrange
// Remark =
Level = user.Level,
Birthday = (ulong)new DateTimeOffset(user.Birthday).ToUnixTimeSeconds(),
// TODO: Lagrange
// LoginDay =
// TODO: Lagrange
// VoteCnt =
IsSchoolVerified = string.IsNullOrWhiteSpace(user.School)
});
Expand All @@ -78,10 +90,12 @@ public override async Task<GetStrangerProfileCardResponse> GetStrangerProfileCar
};
}

// TODO: Lagrange
public override Task<SetProfileCardResponse> SetProfileCard(SetProfileCardRequest request, ServerCallContext context) {
return base.SetProfileCard(request, context);
}

// TODO: Lagrange
public override Task<IsBlackListUserResponse> IsBlackListUser(IsBlackListUserRequest request, ServerCallContext context) {
return base.IsBlackListUser(request, context);
}
Expand All @@ -94,14 +108,17 @@ public override async Task<VoteUserResponse> VoteUser(VoteUserRequest request, S
return new VoteUserResponse { };
}

// WONTSUPPORTED
public override Task<GetUidByUinResponse> GetUidByUin(GetUidByUinRequest request, ServerCallContext context) {
return base.GetUidByUin(request, context);
}

// WONTSUPPORTED
public override Task<GetUinByUidResponse> GetUinByUid(GetUinByUidRequest request, ServerCallContext context) {
return base.GetUinByUid(request, context);
}

// TODO: Lagrange
public override Task<UploadPrivateChatFileResponse> UploadPrivateFile(PrivateChatFileRequest request, ServerCallContext context) {
// bool v = await _bot.UploadFriendFile((uint)request.TargetUin, new FileEntity(request.File));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,11 @@ public override async Task<GetGroupInfoResponse> GetGroupInfo(GetGroupInfoReques
GroupInfo = new GroupInfo {
GroupId = group.GroupUin,
GroupName = group.GroupName,
// TODO: Lagrange
// GroupRemark =
// TODO: Lagrange
// Owner =
// TODO: Lagrange
// Admins =
MaxMemberCount = group.MaxMember,
MemberCount = group.MemberCount,
Expand All @@ -152,8 +155,11 @@ public override async Task<GetGroupListResponse> GetGroupList(GetGroupListReques
IEnumerable<GroupInfo> infos = groups.Select(group => new GroupInfo {
GroupId = group.GroupUin,
GroupName = group.GroupName,
// TODO: Lagrange
// GroupRemark =
// TODO: Lagrange
// Owner =
// TODO: Lagrange
// Admins =
MaxMemberCount = group.MaxMember,
MemberCount = group.MemberCount,
Expand Down Expand Up @@ -186,17 +192,25 @@ public override async Task<GetGroupMemberInfoResponse> GetGroupMemberInfo(GetGro
GroupMemberInfo = new GroupMemberInfo {
Uin = member.Uin,
Nick = member.MemberName,
// TODO: Lagrange
// Age =
// TODO: Lagrange
// UniqueTitle =
// TODO: Lagrange
// UniqueTitleExpireTime =
Card = member.MemberCard,
JoinTime = (ulong)new DateTimeOffset(member.JoinTime).ToUnixTimeSeconds(),
LastActiveTime = (ulong)new DateTimeOffset(member.LastMsgTime).ToUnixTimeSeconds(),
Level = member.GroupLevel,
// TODO: Lagrange
// ShutUpTime =
// TODO: Lagrange
// Distance =
// TODO: Lagrange
// Honors =
// TODO: Lagrange
// Unfriendly =
// TODO: Lagrange
// CardChangeable =
}
};
Expand All @@ -211,17 +225,25 @@ public override async Task<GetGroupMemberListResponse> GetGroupMemberList(GetGro
IEnumerable<GroupMemberInfo> infos = members.Select(member => new GroupMemberInfo {
Uin = member.Uin,
Nick = member.MemberName,
// TODO: Lagrange
// Age =
// TODO: Lagrange
// UniqueTitle =
// TODO: Lagrange
// UniqueTitleExpireTime =
Card = member.MemberCard,
JoinTime = (ulong)new DateTimeOffset(member.JoinTime).ToUnixTimeSeconds(),
LastActiveTime = (ulong)new DateTimeOffset(member.LastMsgTime).ToUnixTimeSeconds(),
Level = member.GroupLevel,
// TODO: Lagrange
// ShutUpTime =
// TODO: Lagrange
// Distance =
// TODO: Lagrange
// Honors =
// TODO: Lagrange
// Unfriendly =
// TODO: Lagrange
// CardChangeable =
});

Expand All @@ -230,22 +252,32 @@ public override async Task<GetGroupMemberListResponse> GetGroupMemberList(GetGro
};
}

// TODO: Lagrange
public override Task<GetProhibitedUserListResponse> GetProhibitedUserList(GetProhibitedUserListRequest request, ServerCallContext context) {
return base.GetProhibitedUserList(request, context);
}

public override Task<GetRemainCountAtAllResponse> GetRemainCountAtAll(GetRemainCountAtAllRequest request, ServerCallContext context) {
return base.GetRemainCountAtAll(request, context);
public override async Task<GetRemainCountAtAllResponse> GetRemainCountAtAll(GetRemainCountAtAllRequest request, ServerCallContext context) {
(uint forPrivate, uint forGroup) = await _bot.GroupRemainAtAll((uint)request.GroupId);

return new GetRemainCountAtAllResponse {
AccessAtAll = forPrivate != 0 && forGroup != 0,
RemainCountForGroup = forGroup,
RemainCountForSelf = forPrivate,
};
}

// TODO: Lagrange
public override Task<GetNotJoinedGroupInfoResponse> GetNotJoinedGroupInfo(GetNotJoinedGroupInfoRequest request, ServerCallContext context) {
return base.GetNotJoinedGroupInfo(request, context);
}

// TODO: Lagrange
public override Task<GetGroupHonorResponse> GetGroupHonor(GetGroupHonorRequest request, ServerCallContext context) {
return base.GetGroupHonor(request, context);
}

// TODO: Lagrange
public override Task<UploadGroupFileResponse> UploadGroupFile(UploadGroupFileRequest request, ServerCallContext context) {
// await _bot.GroupFSUpload((uint)request.GroupId, new FileEntity(MSFile.ReadAllBytes(request.File), request.Name));
return base.UploadGroupFile(request, context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ public override async Task<SendMessageByResIdResponse> SendMessageByResId(SendMe
};
}

// TODO: Lagrange
public override Task<SetMessageReadResponse> SetMessageReaded(SetMessageReadRequest request, ServerCallContext context) {
return base.SetMessageReaded(request, context);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@
namespace Lagrange.Kritor.Services.Kritor.Grpc.Process;

public class KritorProcessService : ProcessServiceBase {
// WAITIMPL: Kritor RequestId
// WAITIMPL: Kritor No RequestId
public override Task<SetFriendApplyResultResponse> SetFriendApplyResult(SetFriendApplyResultRequest request, ServerCallContext context) {
return base.SetFriendApplyResult(request, context);
}

// WAITIMPL: Kritor RequestId
// WAITIMPL: Kritor No RequestId
public override Task<SetGroupApplyResultResponse> SetGroupApplyResult(SetGroupApplyResultRequest request, ServerCallContext context) {
return base.SetGroupApplyResult(request, context);
}

// WAITIMPL: Kritor RequestId
// WAITIMPL: Kritor No RequestId
public override Task<SetInvitedJoinGroupResultResponse> SetInvitedJoinGroupResult(SetInvitedJoinGroupResultRequest request, ServerCallContext context) {
return base.SetInvitedJoinGroupResult(request, context);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
namespace Lagrange.Kritor.Services.Kritor.Grpc.Reverse;

public class KritorReverseService : ReverseServiceBase {
// WONTSUPPORTED
public override Task ReverseStream(IAsyncStreamReader<Response> requestStream, IServerStreamWriter<Request> responseStream, ServerCallContext context) {
return base.ReverseStream(requestStream, responseStream, context);
}
Expand Down

0 comments on commit 638acba

Please sign in to comment.