diff --git a/src/onebot/api/msg.ts b/src/onebot/api/msg.ts index cd6a5e98..0a3be50d 100644 --- a/src/onebot/api/msg.ts +++ b/src/onebot/api/msg.ts @@ -1124,10 +1124,13 @@ export class OneBotMsgApi { if (ignoreTypes.includes(sendMsg.type)) { continue; } - const converter = this.ob11ToRawConverters[sendMsg.type] as ( + const converter = this.ob11ToRawConverters[sendMsg.type] as (( sendMsg: Extract, context: SendMessageContext, - ) => Promise; + ) => Promise) | undefined; + if (converter == undefined) { + throw new Error('未知的消息类型:' + sendMsg.type); + } const callResult = converter( sendMsg, { peer, deleteAfterSentFiles },