mirror of
https://github.com/LLOneBot/LLOneBot.git
synced 2024-11-22 01:56:33 +00:00
fix: 发送file://文件时会误删除原文件
This commit is contained in:
parent
05c4d693e0
commit
7dde7cbc2b
@ -1,7 +1,6 @@
|
|||||||
import {log} from "./utils";
|
import {log} from "./utils";
|
||||||
|
|
||||||
const express = require("express");
|
const express = require("express");
|
||||||
const bodyParser = require('body-parser');
|
|
||||||
import {sendIPCRecallQQMsg, sendIPCSendQQMsg} from "./IPCSend";
|
import {sendIPCRecallQQMsg, sendIPCSendQQMsg} from "./IPCSend";
|
||||||
import {OnebotGroupMemberRole, PostDataAction, PostDataSendMsg, SendMessage} from "../common/types";
|
import {OnebotGroupMemberRole, PostDataAction, PostDataSendMsg, SendMessage} from "../common/types";
|
||||||
import {friends, groups, selfInfo} from "./data";
|
import {friends, groups, selfInfo} from "./data";
|
||||||
@ -146,8 +145,7 @@ export function startExpress(port: number) {
|
|||||||
const app = express();
|
const app = express();
|
||||||
// 中间件,用于解析POST请求的请求体
|
// 中间件,用于解析POST请求的请求体
|
||||||
app.use(express.urlencoded({extended: true, limit: "500mb"}));
|
app.use(express.urlencoded({extended: true, limit: "500mb"}));
|
||||||
app.use(bodyParser({limit: '500mb'}))
|
app.use(express.json({limit: '500mb'}));
|
||||||
app.use(express.json());
|
|
||||||
|
|
||||||
function parseToOnebot12(action: PostDataAction) {
|
function parseToOnebot12(action: PostDataAction) {
|
||||||
app.post('/' + action, (req: any, res: any) => {
|
app.post('/' + action, (req: any, res: any) => {
|
||||||
|
@ -245,9 +245,9 @@ async function listenSendMessage(postData: PostDataSendMsg) {
|
|||||||
localFilePath = url.split("file://")[1]
|
localFilePath = url.split("file://")[1]
|
||||||
} else {
|
} else {
|
||||||
localFilePath = await window.llonebot.downloadFile({uri: url, localFilePath: localFilePath})
|
localFilePath = await window.llonebot.downloadFile({uri: url, localFilePath: localFilePath})
|
||||||
|
sendFiles.push(localFilePath);
|
||||||
}
|
}
|
||||||
message.file = localFilePath
|
message.file = localFilePath
|
||||||
sendFiles.push(localFilePath);
|
|
||||||
} else if (message.type == "reply") {
|
} else if (message.type == "reply") {
|
||||||
let msgId = message.data?.id || message.msgId
|
let msgId = message.data?.id || message.msgId
|
||||||
let replyMessage = msgHistory.find(msg => msg.raw.msgId == msgId)
|
let replyMessage = msgHistory.find(msg => msg.raw.msgId == msgId)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user