Skip to content

Commit

Permalink
Merge branch 'main' into enchant
Browse files Browse the repository at this point in the history
  • Loading branch information
h5mcbox committed Jun 25, 2024
2 parents 880e169 + bb77257 commit ab42101
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions docs/develop/碎碎的研究记录.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
getMsgUniqueId 传入时间 产出一个唯一ID 发送消息作为一个参数
11 changes: 9 additions & 2 deletions src/onebot11/action/msg/SendMsg/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,14 @@ export async function sendMsg(peer: Peer, sendElements: SendMessageElement[], de
logDebug('发送消息id获取失败', e);
returnMsg.id = 0;
}
deleteAfterSentFiles.map(f => fs.unlinkSync(f));

deleteAfterSentFiles.map((f) => {
try {
fs.unlinkSync(f);
} catch (e) {
logError('发送消息删除文件失败', e);
}
});
return returnMsg;
}

Expand Down Expand Up @@ -154,7 +161,7 @@ export class SendMsg extends BaseAction<OB11PostSendMsg, ReturnDataType> {
// }
}
// log("send msg:", peer, sendElements)

const { sendElements, deleteAfterSentFiles } = await createSendElements(messages, group);
//console.log(peer, JSON.stringify(sendElements,null,2));
const returnMsg = await sendMsg(peer, sendElements, deleteAfterSentFiles);
Expand Down
4 changes: 2 additions & 2 deletions src/onebot11/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,8 @@ export class NapCatOnebot11 {
//console.log('ob11 onRecvMsg', JSON.stringify(msg, null, 2));
// logDebug('收到消息', msg);
for (const m of msg) {
// try: 减掉3s 试图修复消息半天收不到
if (this.bootTime - 3 > parseInt(m.msgTime)) {
// try: 减掉3s 试图修复消息半天收不到(不减了不减了 会出大问题)
if (this.bootTime > parseInt(m.msgTime)) {
logDebug(`消息时间${m.msgTime}早于启动时间${this.bootTime},忽略上报`);
continue;
}
Expand Down

0 comments on commit ab42101

Please sign in to comment.