mirror of
https://github.com/Jerryplusy/rc-plugin.git
synced 2025-10-14 08:09:19 +00:00
🌟 feat: 小飞机增加保存能力
This commit is contained in:
parent
823e9ddbb5
commit
6f3e27acdc
@ -79,7 +79,7 @@ import { contentEstimator } from "../utils/link-share-summary-util.js";
|
|||||||
import { getDS } from "../utils/mihoyo.js";
|
import { getDS } from "../utils/mihoyo.js";
|
||||||
import { OpenaiBuilder } from "../utils/openai-builder.js";
|
import { OpenaiBuilder } from "../utils/openai-builder.js";
|
||||||
import { redisExistKey, redisGetKey, redisSetKey } from "../utils/redis-util.js";
|
import { redisExistKey, redisGetKey, redisSetKey } from "../utils/redis-util.js";
|
||||||
import { startTDL } from "../utils/tdl-util.js";
|
import { saveTDL, startTDL } from "../utils/tdl-util.js";
|
||||||
import Translate from "../utils/trans-strategy.js";
|
import Translate from "../utils/trans-strategy.js";
|
||||||
import { mid2id } from "../utils/weibo.js";
|
import { mid2id } from "../utils/weibo.js";
|
||||||
import { dy2b } from "../utils/yt-dlp-util.js";
|
import { dy2b } from "../utils/yt-dlp-util.js";
|
||||||
@ -1780,6 +1780,12 @@ export class tools extends plugin {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const url = urlRex.exec(e.msg)[0];
|
const url = urlRex.exec(e.msg)[0];
|
||||||
|
if (e.msg.startsWith("保存")) {
|
||||||
|
// 发送文件到 SaveMessages
|
||||||
|
await saveTDL(url, isOversea, this.myProxy);
|
||||||
|
e.reply("文件已保存到 Save Messages!");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
e.reply(`识别:小飞机(学习版)`);
|
e.reply(`识别:小飞机(学习版)`);
|
||||||
const tgSavePath = `${this.getCurDownloadPath(e)}/tg`;
|
const tgSavePath = `${this.getCurDownloadPath(e)}/tg`;
|
||||||
// 如果没有文件夹则创建
|
// 如果没有文件夹则创建
|
||||||
|
@ -29,4 +29,22 @@ export async function startTDL(url, curPath, isOversea, proxyAddr, videoDownload
|
|||||||
resolve(stdout);
|
resolve(stdout);
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function saveTDL(urk, isOversea, proxyAddr) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const proxyStr = isOversea ? `` : `--proxy ${ proxyAddr }`;
|
||||||
|
const command = `tdl forward --from ${urk} ${proxyStr}`
|
||||||
|
exec(command, (error, stdout, stderr) => {
|
||||||
|
if (error) {
|
||||||
|
reject(`[R插件][TDL]执行出错: ${error.message}`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (stderr) {
|
||||||
|
reject(`[R插件][TDL]错误信息: ${stderr}`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
resolve(stdout);
|
||||||
|
})
|
||||||
|
})
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user