🎈 fix: V1.6.6 修复上传文件函数

This commit is contained in:
zhiyu1998 2024-04-03 19:11:05 +08:00
parent cf14286c97
commit c4eaf682c2

View File

@ -328,7 +328,7 @@ export class tools extends plugin {
"os_version": "9", "os_version": "9",
"aweme_id": tiktokVideoId "aweme_id": tiktokVideoId
}) })
console.log(`${TIKTOK_INFO}?${params.toString()}`) // console.log(`${TIKTOK_INFO}?${params.toString()}`)
await fetch(`${TIKTOK_INFO}?${params.toString()}`, config) await fetch(`${TIKTOK_INFO}?${params.toString()}`, config)
.then(async resp => { .then(async resp => {
const respJson = await resp.json(); const respJson = await resp.json();
@ -506,9 +506,10 @@ export class tools extends plugin {
e.reply(`正在下载${ height }p ${ Math.trunc(frameRate) }帧数 视频,请稍候...`); e.reply(`正在下载${ height }p ${ Math.trunc(frameRate) }帧数 视频,请稍候...`);
const path = `${ this.getCurDownloadPath(e) }/`; const path = `${ this.getCurDownloadPath(e) }/`;
// 添加下载任务到并发队列 // 添加下载任务到并发队列
this.queue.add(() => this.downBili(`${ path }${ videoId }`, videoBaseUrl, audioBaseUrl) this.queue.add(() =>
this.downBili(`${ path }${ videoId }`, videoBaseUrl, audioBaseUrl)
.then(_ => { .then(_ => {
Bot.acquireGfs(e.group_id).upload(fs.readFileSync(`${ path }${ videoId }.mp4`)) e.group.sendFile(fs.readFileSync(`${ path }${ videoId }.mp4`));
}) })
.then(_ => { .then(_ => {
// 清除文件 // 清除文件
@ -1028,7 +1029,7 @@ export class tools extends plugin {
// e.reply(segment.video(path + "/temp.mp4")); // e.reply(segment.video(path + "/temp.mp4"));
// }); // });
downloadMp3(url, 'follow').then(path => { downloadMp3(url, 'follow').then(path => {
Bot.acquireGfs(e.group_id).upload(fs.readFileSync(path), '/', `${title.replace(/[\/\?<>\\:\*\|".… ]/g, '')}.mp3`) e.group.sendFile(fs.readFileSync(path), '/', `${ title.replace(/[\/\?<>\\:\*\|".… ]/g, '') }.mp3`);
}) })
.catch(err => { .catch(err => {
console.error(`下载音乐失败,错误信息为: ${err.message}`); console.error(`下载音乐失败,错误信息为: ${err.message}`);