mirror of
https://github.com/LLOneBot/LLOneBot.git
synced 2024-11-22 01:56:33 +00:00
fix: send video filename
fix: send msg don't return message_id on Linux
This commit is contained in:
parent
aedc8cfc91
commit
e6d36dc6c3
src
@ -104,8 +104,8 @@ export class SendMsgElementConstructor {
|
|||||||
return element;
|
return element;
|
||||||
}
|
}
|
||||||
|
|
||||||
static video(filePath: string): Promise<SendFileElement> {
|
static video(filePath: string, fileName: string=""): Promise<SendFileElement> {
|
||||||
return SendMsgElementConstructor.file(filePath, true);
|
return SendMsgElementConstructor.file(filePath, true, fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
static async ptt(pttPath: string): Promise<SendPttElement> {
|
static async ptt(pttPath: string): Promise<SendPttElement> {
|
||||||
|
@ -133,6 +133,7 @@ export class SendMsg extends BaseAction<OB11PostSendMsg, ReturnDataType> {
|
|||||||
const returnMsg = await this.send(peer, sendElements, deleteAfterSentFiles)
|
const returnMsg = await this.send(peer, sendElements, deleteAfterSentFiles)
|
||||||
return {message_id: returnMsg.msgShortId}
|
return {message_id: returnMsg.msgShortId}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
log("发送消息失败", e.stack.toString())
|
||||||
throw (e.toString())
|
throw (e.toString())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -313,6 +314,9 @@ export class SendMsg extends BaseAction<OB11PostSendMsg, ReturnDataType> {
|
|||||||
if (sendMsg.type === OB11MessageDataType.file) {
|
if (sendMsg.type === OB11MessageDataType.file) {
|
||||||
log("发送文件", path, payloadFileName || fileName)
|
log("发送文件", path, payloadFileName || fileName)
|
||||||
sendElements.push(await SendMsgElementConstructor.file(path, false, payloadFileName || fileName));
|
sendElements.push(await SendMsgElementConstructor.file(path, false, payloadFileName || fileName));
|
||||||
|
} else if (sendMsg.type === OB11MessageDataType.video) {
|
||||||
|
log("发送视频", path, payloadFileName || fileName)
|
||||||
|
sendElements.push(await SendMsgElementConstructor.video(path, payloadFileName || fileName));
|
||||||
} else {
|
} else {
|
||||||
sendElements.push(await constructorMap[sendMsg.type](path));
|
sendElements.push(await constructorMap[sendMsg.type](path));
|
||||||
}
|
}
|
||||||
@ -336,7 +340,7 @@ export class SendMsg extends BaseAction<OB11PostSendMsg, ReturnDataType> {
|
|||||||
}
|
}
|
||||||
const returnMsg = await NTQQApi.sendMsg(peer, sendElements, waitComplete, 20000);
|
const returnMsg = await NTQQApi.sendMsg(peer, sendElements, waitComplete, 20000);
|
||||||
log("消息发送结果", returnMsg)
|
log("消息发送结果", returnMsg)
|
||||||
await dbUtil.addMsg(returnMsg)
|
returnMsg.msgShortId = await dbUtil.addMsg(returnMsg)
|
||||||
deleteAfterSentFiles.map(f => fs.unlink(f, () => {
|
deleteAfterSentFiles.map(f => fs.unlink(f, () => {
|
||||||
}))
|
}))
|
||||||
return returnMsg
|
return returnMsg
|
||||||
|
Loading…
x
Reference in New Issue
Block a user