Skip to content

Commit 81259e4

Browse files
committed
2 parents 6d11220 + 5b2987a commit 81259e4

1 file changed

Lines changed: 2 additions & 11 deletions

File tree

Lagrange.Milky/Api/Handler/Message/GetHistoryMessagesHandler.cs

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,7 @@ public class GetHistoryMessagesHandler(BotContext bot, EntityConvert convert) :
1616
public async Task<GetHistoryMessagesResult> HandleAsync(GetHistoryMessagesParameter parameter, CancellationToken token)
1717
{
1818
int start;
19-
if (parameter.StartMessageSeq.HasValue) start = parameter.Direction switch
20-
{
21-
"newer" => (int)parameter.StartMessageSeq.Value,
22-
"older" => (int)parameter.StartMessageSeq.Value - parameter.Limit,
23-
_ => throw new NotSupportedException(),
24-
};
19+
if (parameter.StartMessageSeq.HasValue) start = (int)(parameter.StartMessageSeq.Value - parameter.Limit);
2520
// TODO: No start sequence
2621
else throw new NotImplementedException();
2722

@@ -39,7 +34,7 @@ public async Task<GetHistoryMessagesResult> HandleAsync(GetHistoryMessagesParame
3934
}
4035
}
4136

42-
public class GetHistoryMessagesParameter(string messageScene, long peerId, long? startMessageSeq, string direction, int limit = 20)
37+
public class GetHistoryMessagesParameter(string messageScene, long peerId, long? startMessageSeq, int limit = 20)
4338
{
4439
[JsonRequired]
4540
[JsonPropertyName("message_scene")]
@@ -52,10 +47,6 @@ public class GetHistoryMessagesParameter(string messageScene, long peerId, long?
5247
[JsonPropertyName("start_message_seq")]
5348
public long? StartMessageSeq { get; } = startMessageSeq;
5449

55-
[JsonRequired]
56-
[JsonPropertyName("direction")]
57-
public string Direction { get; init; } = direction;
58-
5950
[JsonPropertyName("limit")]
6051
public int Limit { get; } = limit;
6152
}

0 commit comments

Comments
 (0)