Skip to content

Commit

Permalink
[OneBot] Re-fix the retCode
Browse files Browse the repository at this point in the history
  • Loading branch information
Linwenxuan authored and Linwenxuan committed Feb 14, 2024
1 parent 757c319 commit 57dfc92
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Lagrange.OneBot/Core/Operation/Ability/CanSendImage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ namespace Lagrange.OneBot.Core.Operation.Ability;
public class CanSendImage : IOperation
{
public Task<OneBotResult> HandleOperation(BotContext context, JsonObject? payload) =>
Task.FromResult(new OneBotResult(new JsonObject { { "yes", true } }, 200, "ok"));
Task.FromResult(new OneBotResult(new JsonObject { { "yes", true } }, 0, "ok"));
}
2 changes: 1 addition & 1 deletion Lagrange.OneBot/Core/Operation/Ability/CanSendRecord.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ namespace Lagrange.OneBot.Core.Operation.Ability;
public class CanSendRecord : IOperation
{
public Task<OneBotResult> HandleOperation(BotContext context, JsonObject? payload) =>
Task.FromResult(new OneBotResult(new JsonObject { { "yes", false } }, 200, "ok"));
Task.FromResult(new OneBotResult(new JsonObject { { "yes", false } }, 0, "ok"));
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public async Task<OneBotResult> HandleOperation(BotContext context, JsonObject?
if (payload?["domain"]?.ToString() is { } domain)
{
var cookies = await context.FetchCookies([domain]);
return new OneBotResult(new JsonObject { { "cookies", cookies[0] } }, 200, "ok");
return new OneBotResult(new JsonObject { { "cookies", cookies[0] } }, 0, "ok");
}

throw new Exception();
Expand Down
4 changes: 2 additions & 2 deletions Lagrange.OneBot/Core/Operation/Generic/SendLikeOperation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ public async Task<OneBotResult> HandleOperation(BotContext context, JsonObject?
if (payload.Deserialize<OneBotSendLike>() is { } like)
{
return await context.Like(like.UserId) // the times is ignored to simulate the real user behaviour
? new OneBotResult(null, 200, "ok")
: new OneBotResult(null, 200, "user not found in the buffer");
? new OneBotResult(null, 0, "ok")
: new OneBotResult(null, 0, "user not found in the buffer");
}

throw new Exception();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public async Task<OneBotResult> HandleOperation(BotContext context, JsonObject?
{
try
{
return new OneBotResult(null, 200, "ok");
return new OneBotResult(null, 0, "ok");
}
finally
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ public async Task<OneBotResult> HandleOperation(BotContext context, JsonObject?
UserId = x.Uin,
NickName = x.Nickname,
Remark = x.Remarks
}).ToArray(), 200, "ok");
}).ToArray(), 0, "ok");
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public async Task<OneBotResult> HandleOperation(BotContext context, JsonObject?
var record = database.GetCollection<MessageRecord>().FindOne(x => x.MessageHash == getMsg.MessageId);
var chain = (MessageChain)record;

if (chain.IsGroup && await context.RecallGroupMessage(chain)) return new OneBotResult(null, 200, "ok");
if (chain.IsGroup && await context.RecallGroupMessage(chain)) return new OneBotResult(null, 0, "ok");
}

throw new Exception();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public Task<OneBotResult> HandleOperation(BotContext context, JsonObject? payloa
var elements = service.Convert(chain);
var response = new OneBotGetMessageResponse(chain.Time, chain.IsGroup ? "group" : "private", record.MessageHash, elements);

return Task.FromResult(new OneBotResult(response, 200, "ok"));
return Task.FromResult(new OneBotResult(response, 0, "ok"));
}

throw new Exception();
Expand Down

0 comments on commit 57dfc92

Please sign in to comment.