Refactor event handling to use async/await across adapters
Build Action / Build-LiteLoader (push) Canceled after 0s
Build Action / Build-Shell (push) Canceled after 0s
Build Release / check-version (push) Canceled after 0s
Build Release / Build-LiteLoader (push) Canceled after 0s
Build Release / Build-Shell (push) Canceled after 0s
Build Release / release-napcat (push) Canceled after 0s
Build Release / build-docker (push) Canceled after 0s

Updated all network adapters' onEvent methods to be asynchronous and return Promises, ensuring consistent async event emission and handling. Adjusted related methods and event emission logic to properly await asynchronous operations, improving reliability for streaming, plugin, HTTP, and WebSocket event flows. Also improved error handling and messaging in stream and WebSocket actions.
This commit is contained in:
手瓜一十雪 committed 2025-09-20 15:55:37 +08:00
1 parent a36ae315b0
commit 42d50014a1
11 files changed
+89 -46

No files matched your search

@@ -87,7 +87,7 @@ export class DownloadFileStream extends OneBotAction<Payload, StreamPacket<Downl
const totalSize = fileSize || stats.size;
// 发送文件信息
req.send({
await req.send({
type: StreamStatus.Stream,
data_type: 'file_info',
file_name: fileName,
@@ -104,7 +104,7 @@ export class DownloadFileStream extends OneBotAction<Payload, StreamPacket<Downl
const base64Chunk = chunk.toString('base64');
bytesRead += chunk.length;
req.send({
await req.send({
type: StreamStatus.Stream,
data_type: 'file_chunk',
index: chunkIndex,