增加方法

This commit is contained in:
cpdl
2025-03-03 14:50:37 +08:00
parent 50bf41df51
commit 9998f9b99c
4 changed files with 47 additions and 1 deletions

View File

@@ -816,6 +816,31 @@ class MessageManager {
}));
}
/// Fetch Surrounding Messages
/// [message] Message content
/// [before] message index - before
/// [after] message index - after
/// [operationID] Operation ID
Future<List<Message>> FetchSurroundingMessages({
required Message message,
int? before,
int? after,
String? operationID,
}) =>
_channel
.invokeMethod(
'fetchSurroundingMessages',
_buildParam({
'message': message.toJson(),
'before': before ?? 0,
'after': after ?? 0,
'operationID': Utils.checkOperationID(operationID),
}))
.then((value) {
final result = Utils.toListMap(value);
return List<Message>.from(result);
});
static Map _buildParam(Map<String, dynamic> param) {
param["ManagerName"] = "messageManager";
param = Utils.cleanMap(param);