mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-01-14 04:00:35 +00:00
fix: use allSettled instead of all when parsing raw message
This commit is contained in:
parent
89b69bbdf8
commit
7bb57cd78a
@ -707,7 +707,7 @@ export class OneBotMsgApi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const msgSegments = (await Promise.all(msg.elements.map(
|
const msgSegments = (await Promise.allSettled(msg.elements.map(
|
||||||
async (element) => {
|
async (element) => {
|
||||||
for (const key in element) {
|
for (const key in element) {
|
||||||
if (keyCanBeParsed(key, this.rawToOb11Converters) && element[key]) {
|
if (keyCanBeParsed(key, this.rawToOb11Converters) && element[key]) {
|
||||||
@ -721,7 +721,14 @@ export class OneBotMsgApi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
))).filter(entry => !!entry);
|
))).filter(entry => {
|
||||||
|
if (entry.status === 'fulfilled') {
|
||||||
|
return !!entry.value;
|
||||||
|
} else {
|
||||||
|
this.core.context.logger.logError('消息段解析失败', entry.reason);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}).map((entry) => (<PromiseFulfilledResult<OB11MessageData>>entry).value);
|
||||||
|
|
||||||
const msgAsCQCode = msgSegments.map(msg => encodeCQCode(msg)).join('').trim();
|
const msgAsCQCode = msgSegments.map(msg => encodeCQCode(msg)).join('').trim();
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user