Skip to content

Commit 59fb29e

Browse files
LinwenxuanLinwenxuan
authored andcommitted
[OneBot] Fixed retCode for Operations
1 parent bf0b93b commit 59fb29e

16 files changed

+17
-17
lines changed

Lagrange.OneBot/Core/Operation/Group/SetGroupAdminOperation.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public async Task<OneBotResult> HandleOperation(BotContext context, JsonObject?
1616
if (message != null)
1717
{
1818
bool _ = await context.SetGroupAdmin(message.GroupId, message.UserId, message.Enable);
19-
return new OneBotResult(null, 0, "ok");
19+
return new OneBotResult(null, 200, "ok");
2020
}
2121

2222
throw new Exception();

Lagrange.OneBot/Core/Operation/Group/SetGroupBanOperation.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public async Task<OneBotResult> HandleOperation(BotContext context, JsonObject?
1616
if (message != null)
1717
{
1818
bool _ = await context.MuteGroupMember(message.GroupId, message.UserId, message.Duration);
19-
return new OneBotResult(null, 0, "ok");
19+
return new OneBotResult(null, 200, "ok");
2020
}
2121

2222
throw new Exception();

Lagrange.OneBot/Core/Operation/Group/SetGroupCardOperation.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public async Task<OneBotResult> HandleOperation(BotContext context, JsonObject?
1616
if (message != null)
1717
{
1818
bool _ = await context.RenameGroupMember(message.GroupId, message.UserId, message.Card);
19-
return new OneBotResult(null, 0, "ok");
19+
return new OneBotResult(null, 200, "ok");
2020
}
2121

2222
throw new Exception();

Lagrange.OneBot/Core/Operation/Group/SetGroupKickOperation.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public async Task<OneBotResult> HandleOperation(BotContext context, JsonObject?
1616
if (message != null)
1717
{
1818
bool _ = await context.KickGroupMember(message.GroupId, message.UserId, message.RejectAddRequest);
19-
return new OneBotResult(null, 0, "ok");
19+
return new OneBotResult(null, 200, "ok");
2020
}
2121

2222
throw new Exception();

Lagrange.OneBot/Core/Operation/Group/SetGroupLeaveOperation.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public async Task<OneBotResult> HandleOperation(BotContext context, JsonObject?
1616
if (message != null)
1717
{
1818
bool _ = await context.LeaveGroup(message.GroupId); // TODO: Figure out is_dismiss
19-
return new OneBotResult(null, 0, "ok");
19+
return new OneBotResult(null, 200, "ok");
2020
}
2121

2222
throw new Exception();

Lagrange.OneBot/Core/Operation/Group/SetGroupNameOperation.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public async Task<OneBotResult> HandleOperation(BotContext context, JsonObject?
1616
if (message != null)
1717
{
1818
bool _ = await context.RenameGroup(message.GroupId, message.GroupName);
19-
return new OneBotResult(null, 0, "ok");
19+
return new OneBotResult(null, 200, "ok");
2020
}
2121

2222
throw new Exception();

Lagrange.OneBot/Core/Operation/Group/SetGroupWholeBanOperation.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public async Task<OneBotResult> HandleOperation(BotContext context, JsonObject?
1616
if (message != null)
1717
{
1818
bool _ = await context.MuteGroupGlobal(message.GroupId, message.Enable);
19-
return new OneBotResult(null, 0, "ok");
19+
return new OneBotResult(null, 200, "ok");
2020
}
2121

2222
throw new Exception();

Lagrange.OneBot/Core/Operation/Info/GetGroupInfoOperation.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public async Task<OneBotResult> HandleOperation(BotContext context, JsonObject?
1818

1919
return result == null
2020
? new OneBotResult(null, -1, "failed")
21-
: new OneBotResult(new OneBotGroup(result.GroupUin, result.GroupName), 0, "ok");
21+
: new OneBotResult(new OneBotGroup(result.GroupUin, result.GroupName), 200, "ok");
2222
}
2323

2424
throw new Exception();

Lagrange.OneBot/Core/Operation/Info/GetGroupListOperation.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ public async Task<OneBotResult> HandleOperation(BotContext context, JsonObject?
1515
if (payload.Deserialize<OneBotGetGroupInfo>() is { } message)
1616
{
1717
var result = await context.FetchGroups(message.NoCache);
18-
return new OneBotResult(result.Select(x => new OneBotGroup(x.GroupUin, x.GroupName)), 0, "ok");
18+
return new OneBotResult(result.Select(x => new OneBotGroup(x.GroupUin, x.GroupName)), 200, "ok");
1919
}
2020
else
2121
{
2222
var result = await context.FetchGroups();
23-
return new OneBotResult(result.Select(x => new OneBotGroup(x.GroupUin, x.GroupName)), 0, "ok");
23+
return new OneBotResult(result.Select(x => new OneBotGroup(x.GroupUin, x.GroupName)), 200, "ok");
2424
}
2525
}
2626
}

Lagrange.OneBot/Core/Operation/Info/GetGroupMemberListOperation.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public async Task<OneBotResult> HandleOperation(BotContext context, JsonObject?
1515
if (payload.Deserialize<OneBotGetGroupMemberInfo>() is { } message)
1616
{
1717
var result = await context.FetchMembers(message.GroupId, message.NoCache);
18-
return new OneBotResult(result.Select(x => new OneBotGroupMember(message.GroupId, x.Uin, x.Permission.ToString().ToLower(), x.GroupLevel.ToString(), x.MemberCard, x.MemberName, (uint)new DateTimeOffset(x.JoinTime).ToUnixTimeSeconds(), (uint)new DateTimeOffset(x.LastMsgTime).ToUnixTimeSeconds())), 0, "ok");
18+
return new OneBotResult(result.Select(x => new OneBotGroupMember(message.GroupId, x.Uin, x.Permission.ToString().ToLower(), x.GroupLevel.ToString(), x.MemberCard, x.MemberName, (uint)new DateTimeOffset(x.JoinTime).ToUnixTimeSeconds(), (uint)new DateTimeOffset(x.LastMsgTime).ToUnixTimeSeconds())), 200, "ok");
1919
}
2020

2121
throw new Exception();

Lagrange.OneBot/Core/Operation/Info/GetLoginInfoOperation.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ public Task<OneBotResult> HandleOperation(BotContext context, JsonObject? payloa
1212
{
1313
var keystore = context.ContextCollection.Keystore;
1414
var result = new OneBotLoginInfoResponse(keystore.Uin, keystore.Info?.Name ?? "");
15-
return Task.FromResult(new OneBotResult(result, 0, "ok"));
15+
return Task.FromResult(new OneBotResult(result, 200, "ok"));
1616
}
1717
}

Lagrange.OneBot/Core/Operation/Info/GetVersionInfoOperation.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ public Task<OneBotResult> HandleOperation(BotContext context, JsonObject? payloa
1313
var appInfo = context.ContextCollection.AppInfo;
1414
string version = $"{appInfo.Os} | {appInfo.CurrentVersion}";
1515

16-
return Task.FromResult(new OneBotResult(new OneBotVersionInfoResponse(version), 0, "ok"));
16+
return Task.FromResult(new OneBotResult(new OneBotVersionInfoResponse(version), 200, "ok"));
1717
}
1818
}

Lagrange.OneBot/Core/Operation/Message/GetForwardMsgOperation.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public async Task<OneBotResult> HandleOperation(BotContext context, JsonObject?
2727
nodes.Add(new OneBotSegment("node", node));
2828
}
2929

30-
return new OneBotResult(new OneBotGetForwardMsgResponse(nodes), 0, "ok");
30+
return new OneBotResult(new OneBotGetForwardMsgResponse(nodes), 200, "ok");
3131
}
3232

3333
throw new Exception();

Lagrange.OneBot/Core/Operation/Message/SendGroupMessageOperation.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ public async Task<OneBotResult> HandleOperation(BotContext context, JsonObject?
2020
_ => throw new Exception()
2121
};
2222

23-
return new OneBotResult(new OneBotMessageResponse(0), 0, "ok");
23+
return new OneBotResult(new OneBotMessageResponse(0), 200, "ok");
2424
}
2525
}

Lagrange.OneBot/Core/Operation/Message/SendMessageOperation.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ public async Task<OneBotResult> HandleOperation(BotContext context, JsonObject?
2020
_ => throw new Exception()
2121
};
2222

23-
return new OneBotResult(new OneBotMessageResponse(0), 0, "ok");
23+
return new OneBotResult(new OneBotMessageResponse(0), 200, "ok");
2424
}
2525
}

Lagrange.OneBot/Core/Operation/Message/SendPrivateMessageOperation.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ public async Task<OneBotResult> HandleOperation(BotContext context, JsonObject?
2121
_ => throw new Exception()
2222
};
2323

24-
return new OneBotResult(new OneBotMessageResponse(0), 0, "ok");
24+
return new OneBotResult(new OneBotMessageResponse(0), 200, "ok");
2525
}
2626
}

0 commit comments

Comments
 (0)