Merge pull request #48 from nikoyoke1/master

🐞 fix: 修复解析后发送语音错误
This commit is contained in:
Zhiyu 2024-11-08 21:04:11 +08:00 committed by GitHub
commit b287cfa535
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 157 additions and 157 deletions

View File

@ -19,7 +19,7 @@ export class songRequest extends plugin {
priority: 300, priority: 300,
rule: [ rule: [
{ {
reg: '^#?点歌|#?听[1-9][0-9]*|#?听[1-9]*$', reg: '^#点歌|#?听[1-9][0-9]*|#?听[1-9]*$',
fnc: 'pickSong' fnc: 'pickSong'
}, },
{ {
@ -362,12 +362,12 @@ export class songRequest extends plugin {
} }
// 发送群文件 // 发送群文件
await this.uploadGroupFile(e, path); await this.uploadGroupFile(e, path);
// 删除文件
await checkAndRemoveFile(path);
// 发送语音 // 发送语音
if (musicExt != 'mp4' && this.isSendVocal) { if (musicExt != 'mp4' && this.isSendVocal) {
await e.reply(segment.record(path)); await e.reply(segment.record(path));
} }
// 删除文件
await checkAndRemoveFile(path);
} }
}).catch(err => { }).catch(err => {
logger.error(`下载音乐失败,错误信息为: ${err}`); logger.error(`下载音乐失败,错误信息为: ${err}`);

View File

@ -347,7 +347,7 @@ export class tools extends plugin {
const urlRex = /(http:\/\/|https:\/\/)(v|live).douyin.com\/[A-Za-z\d._?%&+\-=\/#]*/; const urlRex = /(http:\/\/|https:\/\/)(v|live).douyin.com\/[A-Za-z\d._?%&+\-=\/#]*/;
// 检测无效链接例如v.douyin.com // 检测无效链接例如v.douyin.com
if (!urlRex.test(e.msg)) { if (!urlRex.test(e.msg)) {
e.reply(`检测到这是一个无效链接,无法解析抖音${ HELP_DOC }`); e.reply(`检测到这是一个无效链接,无法解析抖音${HELP_DOC}`);
return; return;
} }
// 获取链接 // 获取链接
@ -371,7 +371,7 @@ export class tools extends plugin {
/webcast.amemv.com\/douyin\/webcast\/reflow\/(\d+)/.exec(douUrl)?.[1]; /webcast.amemv.com\/douyin\/webcast\/reflow\/(\d+)/.exec(douUrl)?.[1];
// 当前版本需要填入cookie // 当前版本需要填入cookie
if (_.isEmpty(this.douyinCookie) || _.isEmpty(douId)) { if (_.isEmpty(this.douyinCookie) || _.isEmpty(douId)) {
e.reply(`检测到没有Cookie 或者 这是一个无效链接,无法解析抖音${ HELP_DOC }`); e.reply(`检测到没有Cookie 或者 这是一个无效链接,无法解析抖音${HELP_DOC}`);
return; return;
} }
// 以下是更新了很多次的抖音API历史且用且珍惜 // 以下是更新了很多次的抖音API历史且用且珍惜
@ -390,13 +390,13 @@ export class tools extends plugin {
dyApi = DY_LIVE_INFO.replaceAll("{}", douId) dyApi = DY_LIVE_INFO.replaceAll("{}", douId)
} else if (douUrl.includes("webcast.amemv.com")) { } else if (douUrl.includes("webcast.amemv.com")) {
// 第二类直播类型,这里必须使用客户端的 fetch 请求 // 第二类直播类型,这里必须使用客户端的 fetch 请求
dyApi = DY_LIVE_INFO_2.replace("{}", douId) + `&verifyFp=${ genVerifyFp() }` + `&msToken=${ ttwid }`; dyApi = DY_LIVE_INFO_2.replace("{}", douId) + `&verifyFp=${genVerifyFp()}` + `&msToken=${ttwid}`;
const webcastResp = await fetch(dyApi); const webcastResp = await fetch(dyApi);
const webcastData = await webcastResp.json(); const webcastData = await webcastResp.json();
const item = webcastData.data.room; const item = webcastData.data.room;
const { title, cover, user_count, stream_url } = item; const { title, cover, user_count, stream_url } = item;
const dySendContent = `${ this.identifyPrefix }识别:抖音直播,${ title }` const dySendContent = `${this.identifyPrefix}识别:抖音直播,${title}`
e.reply([segment.image(cover?.url_list?.[0]), dySendContent, `\n🏄‍♂️在线人数:${ user_count }人正在观看`]); e.reply([segment.image(cover?.url_list?.[0]), dySendContent, `\n🏄‍♂️在线人数:${user_count}人正在观看`]);
// 下载10s的直播流 // 下载10s的直播流
await this.sendStreamSegment(e, stream_url?.flv_pull_url?.HD1 || stream_url?.flv_pull_url?.FULL_HD1 || stream_url?.flv_pull_url?.SD1 || stream_url?.flv_pull_url?.SD2); await this.sendStreamSegment(e, stream_url?.flv_pull_url?.HD1 || stream_url?.flv_pull_url?.FULL_HD1 || stream_url?.flv_pull_url?.SD1 || stream_url?.flv_pull_url?.SD2);
return; return;
@ -410,7 +410,7 @@ export class tools extends plugin {
headers["User-Agent"], headers["User-Agent"],
); );
// const param = resp.data.result[0].paramsencode; // const param = resp.data.result[0].paramsencode;
const resDyApi = `${ dyApi }&a_bogus=${ abParam }`; const resDyApi = `${dyApi}&a_bogus=${abParam}`;
headers['Referer'] = `https://www.douyin.com/` headers['Referer'] = `https://www.douyin.com/`
// 定义一个dy请求 // 定义一个dy请求
const dyResponse = () => axios.get(resDyApi, { const dyResponse = () => axios.get(resDyApi, {
@ -424,8 +424,8 @@ export class tools extends plugin {
if (douUrl.includes("live")) { if (douUrl.includes("live")) {
const item = await data.data.data?.[0]; const item = await data.data.data?.[0];
const { title, cover, user_count_str, stream_url } = item; const { title, cover, user_count_str, stream_url } = item;
const dySendContent = `${ this.identifyPrefix }识别:抖音直播,${ title }` const dySendContent = `${this.identifyPrefix}识别:抖音直播,${title}`
e.reply([segment.image(cover?.url_list?.[0]), dySendContent, `\n🏄‍♂️在线人数:${ user_count_str }人正在观看`]); e.reply([segment.image(cover?.url_list?.[0]), dySendContent, `\n🏄‍♂️在线人数:${user_count_str}人正在观看`]);
// 下载10s的直播流 // 下载10s的直播流
await this.sendStreamSegment(e, stream_url?.flv_pull_url?.HD1 || stream_url?.flv_pull_url?.FULL_HD1 || stream_url?.flv_pull_url?.SD1 || stream_url?.flv_pull_url?.SD2); await this.sendStreamSegment(e, stream_url?.flv_pull_url?.HD1 || stream_url?.flv_pull_url?.FULL_HD1 || stream_url?.flv_pull_url?.SD1 || stream_url?.flv_pull_url?.SD2);
return; return;
@ -448,20 +448,20 @@ export class tools extends plugin {
const dyDuration = Math.trunc(duration / 1000); const dyDuration = Math.trunc(duration / 1000);
const durationThreshold = this.biliDuration; const durationThreshold = this.biliDuration;
// 一些共同发送内容 // 一些共同发送内容
let dySendContent = `${ this.identifyPrefix }识别:抖音,${ item.author.nickname }\n📝 简介:${ item.desc }`; let dySendContent = `${this.identifyPrefix}识别:抖音,${item.author.nickname}\n📝 简介:${item.desc}`;
if (dyDuration >= durationThreshold) { if (dyDuration >= durationThreshold) {
// 超过阈值,不发送的情况 // 超过阈值,不发送的情况
// 封面 // 封面
const dyCover = cover.url_list?.pop(); const dyCover = cover.url_list?.pop();
// logger.info(cover.url_list); // logger.info(cover.url_list);
dySendContent += `\n dySendContent += `\n
${ DIVIDING_LINE.replace('{}', '限制说明') }\n当前视频时长约${(dyDuration / 60).toFixed(2).replace(/\.00$/, '')} 分钟\n大于管理员设置的最大时长 ${(durationThreshold / 60).toFixed(2).replace(/\.00$/, '')} 分钟`; ${DIVIDING_LINE.replace('{}', '限制说明')}\n当前视频时长约${(dyDuration / 60).toFixed(2).replace(/\.00$/, '')} 分钟\n大于管理员设置的最大时长 ${(durationThreshold / 60).toFixed(2).replace(/\.00$/, '')} 分钟`;
e.reply([segment.image(dyCover), dySendContent]); e.reply([segment.image(dyCover), dySendContent]);
// 如果开启评论的就调用 // 如果开启评论的就调用
await this.douyinComment(e, douId, headers); await this.douyinComment(e, douId, headers);
return; return;
} }
e.reply(`${ dySendContent }`); e.reply(`${dySendContent}`);
// 分辨率判断是否压缩 // 分辨率判断是否压缩
const resolution = this.douyinCompression ? "720p" : "1080p"; const resolution = this.douyinCompression ? "720p" : "1080p";
// 使用今日头条 CDN 进一步加快解析速度 // 使用今日头条 CDN 进一步加快解析速度
@ -480,14 +480,14 @@ export class tools extends plugin {
}*/ }*/
// logger.info(resUrl); // logger.info(resUrl);
const path = `${ this.getCurDownloadPath(e) }/temp.mp4`; const path = `${this.getCurDownloadPath(e)}/temp.mp4`;
// 加入队列 // 加入队列
await this.downloadVideo(resUrl).then(() => { await this.downloadVideo(resUrl).then(() => {
this.sendVideoToUpload(e, path) this.sendVideoToUpload(e, path)
}); });
} else if (urlType === "image") { } else if (urlType === "image") {
// 发送描述 // 发送描述
e.reply(`${ this.identifyPrefix }识别:抖音, ${ item.desc }`); e.reply(`${this.identifyPrefix}识别:抖音, ${item.desc}`);
// 无水印图片列表 // 无水印图片列表
let no_watermark_image_list = []; let no_watermark_image_list = [];
// 有水印图片列表 // 有水印图片列表
@ -510,7 +510,7 @@ export class tools extends plugin {
await this.douyinComment(e, douId, headers); await this.douyinComment(e, douId, headers);
} catch (err) { } catch (err) {
logger.error(err); logger.error(err);
logger.mark(`Cookie 过期或者 Cookie 没有填写,请参考\n${ HELP_DOC }\n尝试无效后可以到官方QQ群[575663150]提出 bug 等待解决`) logger.mark(`Cookie 过期或者 Cookie 没有填写,请参考\n${HELP_DOC}\n尝试无效后可以到官方QQ群[575663150]提出 bug 等待解决`)
} }
return true; return true;
} }
@ -522,7 +522,7 @@ export class tools extends plugin {
* @param second * @param second
*/ */
async sendStreamSegment(e, stream_url, second = this.streamDuration) { async sendStreamSegment(e, stream_url, second = this.streamDuration) {
let outputFilePath = `${ this.getCurDownloadPath(e) }/stream_${ second }s.flv`; let outputFilePath = `${this.getCurDownloadPath(e)}/stream_${second}s.flv`;
// 删除临时文件 // 删除临时文件
if (this.streamCompatibility) { if (this.streamCompatibility) {
await checkAndRemoveFile(outputFilePath.replace("flv", "mp4")); await checkAndRemoveFile(outputFilePath.replace("flv", "mp4"));
@ -546,7 +546,7 @@ export class tools extends plugin {
// 设置 streamDuration 秒后停止下载 // 设置 streamDuration 秒后停止下载
setTimeout(async () => { setTimeout(async () => {
logger.info(`[R插件][发送直播流] 直播下载 ${ second } 秒钟到,停止下载!`); logger.info(`[R插件][发送直播流] 直播下载 ${second} 秒钟到,停止下载!`);
// 取消请求 // 取消请求
source.cancel('[R插件][发送直播流] 下载时间到,停止请求'); source.cancel('[R插件][发送直播流] 下载时间到,停止请求');
response.data.unpipe(file); // 取消管道连接 response.data.unpipe(file); // 取消管道连接
@ -574,7 +574,7 @@ export class tools extends plugin {
if (axios.isCancel(error)) { if (axios.isCancel(error)) {
logger.info('请求已取消:', error.message); logger.info('请求已取消:', error.message);
} else { } else {
logger.error(`下载失败: ${ error.message }`); logger.error(`下载失败: ${error.message}`);
} }
await fs.promises.unlink(outputFilePath); // 下载失败时删除文件 await fs.promises.unlink(outputFilePath); // 下载失败时删除文件
} }
@ -595,7 +595,7 @@ export class tools extends plugin {
new URLSearchParams(new URL(dyCommentUrl).search).toString(), new URLSearchParams(new URL(dyCommentUrl).search).toString(),
headers["User-Agent"], headers["User-Agent"],
); );
const commentsResp = await axios.get(`${ dyCommentUrl }&a_bogus=${ abParam }`, { const commentsResp = await axios.get(`${dyCommentUrl}&a_bogus=${abParam}`, {
headers headers
}) })
// logger.info(headers) // logger.info(headers)
@ -630,9 +630,9 @@ export class tools extends plugin {
const path = this.getCurDownloadPath(e); const path = this.getCurDownloadPath(e);
await checkAndRemoveFile(path + "/temp.mp4"); await checkAndRemoveFile(path + "/temp.mp4");
const title = ytDlpGetTilt(url, isOversea, this.myProxy); const title = ytDlpGetTilt(url, isOversea, this.myProxy);
e.reply(`${ this.identifyPrefix }识别TikTok视频下载中请耐心等待 \n${ title }`); e.reply(`${this.identifyPrefix}识别TikTok视频下载中请耐心等待 \n${title}`);
await ytDlpHelper(path, cleanedTiktokUrl, isOversea, this.myProxy, this.videoDownloadConcurrency); await ytDlpHelper(path, cleanedTiktokUrl, isOversea, this.myProxy, this.videoDownloadConcurrency);
await this.sendVideoToUpload(e, `${ path }/temp.mp4`); await this.sendVideoToUpload(e, `${path}/temp.mp4`);
return true; return true;
} }
@ -647,7 +647,7 @@ export class tools extends plugin {
// 检查路径是否存在文件夹 // 检查路径是否存在文件夹
await mkdirIfNotExists(this.defaultPath); await mkdirIfNotExists(this.defaultPath);
// 发送请求 // 发送请求
const saveCodePath = `${ this.defaultPath }qrcode.png`; const saveCodePath = `${this.defaultPath}qrcode.png`;
const { SESSDATA, refresh_token } = await getScanCodeData(saveCodePath, 8, () => imgSendHook(e, saveCodePath)) const { SESSDATA, refresh_token } = await getScanCodeData(saveCodePath, 8, () => imgSendHook(e, saveCodePath))
@ -720,7 +720,7 @@ export class tools extends plugin {
let url = e.msg === undefined ? e.message.shift().data.replaceAll("\\", "") : e.msg.trim().replaceAll("\\", ""); let url = e.msg === undefined ? e.message.shift().data.replaceAll("\\", "") : e.msg.trim().replaceAll("\\", "");
// 直接发送BV号的处理 // 直接发送BV号的处理
if (/^BV[1-9a-zA-Z]{10}$/.exec(url)?.[0]) { if (/^BV[1-9a-zA-Z]{10}$/.exec(url)?.[0]) {
url = `https://www.bilibili.com/video/${ url }`; url = `https://www.bilibili.com/video/${url}`;
logger.info(url) logger.info(url)
} }
// 短号处理 // 短号处理
@ -765,11 +765,11 @@ export class tools extends plugin {
e.reply([ e.reply([
segment.image(user_cover), segment.image(user_cover),
segment.image(keyframe), segment.image(keyframe),
[`${ this.identifyPrefix }识别:哔哩哔哩直播,${ title }`, [`${this.identifyPrefix}识别:哔哩哔哩直播,${title}`,
`${ description ? `📝 简述:${ description.replace(`<p>`, '').replace(`</p>`, '') }` : '' }`, `${description ? `📝 简述:${description.replace(`<p>`, '').replace(`</p>`, '')}` : ''}`,
`${ tags ? `🔖 标签:${ tags }` : '' }`, `${tags ? `🔖 标签:${tags}` : ''}`,
`📍 分区:${ parent_area_name ? `${ parent_area_name }` : '' }${ area_name ? `-${ area_name }` : '' }`, `📍 分区:${parent_area_name ? `${parent_area_name}` : ''}${area_name ? `-${area_name}` : ''}`,
`${ live_time ? `⏰ 直播时间:${ live_time }` : '' }`, `${live_time ? `⏰ 直播时间:${live_time}` : ''}`,
].filter(item => item.trim() !== "").join("\n") ].filter(item => item.trim() !== "").join("\n")
]); ]);
const streamData = await this.getBiliStream(streamId); const streamData = await this.getBiliStream(streamId);
@ -792,7 +792,7 @@ export class tools extends plugin {
return true; return true;
} }
// 创建文件,如果不存在, // 创建文件,如果不存在,
const path = `${ this.getCurDownloadPath(e) }/`; const path = `${this.getCurDownloadPath(e)}/`;
await mkdirIfNotExists(path); await mkdirIfNotExists(path);
// 处理番剧 // 处理番剧
if (url.includes("play\/ep") || url.includes("play\/ss")) { if (url.includes("play\/ep") || url.includes("play\/ss")) {
@ -800,7 +800,7 @@ export class tools extends plugin {
// 如果使用了BBDown && 没有填写session 就放开下载 // 如果使用了BBDown && 没有填写session 就放开下载
if (this.biliUseBBDown) { if (this.biliUseBBDown) {
// 下载文件 // 下载文件
await this.biliDownloadStrategy(e, `https://www.bilibili.com/bangumi/play/ep${ ep }`, path); await this.biliDownloadStrategy(e, `https://www.bilibili.com/bangumi/play/ep${ep}`, path);
} }
return true; return true;
} }
@ -824,7 +824,7 @@ export class tools extends plugin {
// 限制视频解析 // 限制视频解析
if (isLimitDuration) { if (isLimitDuration) {
const durationInMinutes = (curDuration / 60).toFixed(0); const durationInMinutes = (curDuration / 60).toFixed(0);
biliInfo.push(`${ DIVIDING_LINE.replace('{}', '限制说明') }\n当前视频时长约:${ durationInMinutes }分钟,\n大于管理员设置的最大时长 ${(this.biliDuration / 60).toFixed(2).replace(/\.00$/, '')} 分钟!`); biliInfo.push(`${DIVIDING_LINE.replace('{}', '限制说明')}\n当前视频时长约:${durationInMinutes}分钟,\n大于管理员设置的最大时长 ${(this.biliDuration / 60).toFixed(2).replace(/\.00$/, '')} 分钟!`);
e.reply(biliInfo); e.reply(biliInfo);
return true; return true;
} else { } else {
@ -893,21 +893,21 @@ export class tools extends plugin {
"弹幕数量": danmaku, "弹幕数量": danmaku,
"评论": reply "评论": reply
}; };
combineContent += `\n${ formatBiliInfo(dataProcessMap) }`; combineContent += `\n${formatBiliInfo(dataProcessMap)}`;
} }
// 是否显示简介 // 是否显示简介
if (this.biliDisplayIntro) { if (this.biliDisplayIntro) {
// 过滤简介中的一些链接 // 过滤简介中的一些链接
const filteredDesc = await filterBiliDescLink(desc); const filteredDesc = await filterBiliDescLink(desc);
combineContent += `\n📝 简介:${ truncateString(filteredDesc, this.toolsConfig.biliIntroLenLimit || BILI_DEFAULT_INTRO_LEN_LIMIT) }`; combineContent += `\n📝 简介:${truncateString(filteredDesc, this.toolsConfig.biliIntroLenLimit || BILI_DEFAULT_INTRO_LEN_LIMIT)}`;
} }
// 是否显示在线人数 // 是否显示在线人数
if (this.biliDisplayOnline) { if (this.biliDisplayOnline) {
// 拼接在线人数 // 拼接在线人数
const onlineTotal = await this.biliOnlineTotal(bvid, cid); const onlineTotal = await this.biliOnlineTotal(bvid, cid);
combineContent += `\n🏄‍♂️️ 当前视频有 ${ onlineTotal.total } 人在观看,其中 ${ onlineTotal.count } 人在网页端观看`; combineContent += `\n🏄‍♂️️ 当前视频有 ${onlineTotal.total} 人在观看,其中 ${onlineTotal.count} 人在网页端观看`;
} }
let biliInfo = [`${ this.identifyPrefix }识别:哔哩哔哩,${ title }`, combineContent] let biliInfo = [`${this.identifyPrefix}识别:哔哩哔哩,${title}`, combineContent]
// 是否显示封面 // 是否显示封面
if (this.biliDisplayCover) { if (this.biliDisplayCover) {
// 加入图片 // 加入图片
@ -954,10 +954,10 @@ export class tools extends plugin {
const title = result.title; const title = result.title;
e.reply([ e.reply([
segment.image(resp.result.cover), segment.image(resp.result.cover),
`${ this.identifyPrefix }识别:哔哩哔哩番剧,${ title }\n🎯 评分: ${ result?.rating?.score ?? '-' } / ${ result?.rating?.count ?? '-' }\n📺 ${ result.new_ep.desc }, ${ result.seasons[0].new_ep.index_show }\n`, `${this.identifyPrefix}识别:哔哩哔哩番剧,${title}\n🎯 评分: ${result?.rating?.score ?? '-'} / ${result?.rating?.count ?? '-'}\n📺 ${result.new_ep.desc}, ${result.seasons[0].new_ep.index_show}\n`,
`${ formatBiliInfo(dataProcessMap) }`, `${formatBiliInfo(dataProcessMap)}`,
`\n\n🪶 在线观看: ${ await urlTransformShortLink(ANIME_SERIES_SEARCH_LINK + title) }`, `\n\n🪶 在线观看: ${await urlTransformShortLink(ANIME_SERIES_SEARCH_LINK + title)}`,
`\n🌸 在线观看: ${ await urlTransformShortLink(ANIME_SERIES_SEARCH_LINK2 + title) }` `\n🌸 在线观看: ${await urlTransformShortLink(ANIME_SERIES_SEARCH_LINK2 + title)}`
], true); ], true);
return ep; return ep;
} }
@ -973,7 +973,7 @@ export class tools extends plugin {
return this.queue.add(async () => { return this.queue.add(async () => {
// =================以下是调用BBDown的逻辑===================== // =================以下是调用BBDown的逻辑=====================
// 下载视频和音频 // 下载视频和音频
const tempPath = `${ path }temp`; const tempPath = `${path}temp`;
// 检测是否开启BBDown // 检测是否开启BBDown
if (this.biliUseBBDown) { if (this.biliUseBBDown) {
// 检测环境的 BBDown // 检测环境的 BBDown
@ -981,7 +981,7 @@ export class tools extends plugin {
// 存在 BBDown // 存在 BBDown
if (isExistBBDown) { if (isExistBBDown) {
// 删除之前的文件 // 删除之前的文件
await checkAndRemoveFile(`${ tempPath }.mp4`); await checkAndRemoveFile(`${tempPath}.mp4`);
// 下载视频 // 下载视频
await startBBDown(url, path, { await startBBDown(url, path, {
biliSessData: this.biliSessData, biliSessData: this.biliSessData,
@ -990,7 +990,7 @@ export class tools extends plugin {
biliResolution: this.biliResolution, biliResolution: this.biliResolution,
}); });
// 发送视频 // 发送视频
return this.sendVideoToUpload(e, `${ tempPath }.mp4`); return this.sendVideoToUpload(e, `${tempPath}.mp4`);
} }
e.reply("🚧 R插件提醒你开启但未检测到当前环境有【BBDown】即将使用默认下载方式 ( ◡̀_◡́)ᕤ"); e.reply("🚧 R插件提醒你开启但未检测到当前环境有【BBDown】即将使用默认下载方式 ( ◡̀_◡́)ᕤ");
} }
@ -1003,7 +1003,7 @@ export class tools extends plugin {
await this.downBili(tempPath, data.videoUrl, data.audioUrl); await this.downBili(tempPath, data.videoUrl, data.audioUrl);
} else { } else {
// 处理无音频的情况 // 处理无音频的情况
await downloadBFile(data.videoUrl, `${ tempPath }.mp4`, _.throttle( await downloadBFile(data.videoUrl, `${tempPath}.mp4`, _.throttle(
value => value =>
logger.mark("视频下载进度", { logger.mark("视频下载进度", {
data: value, data: value,
@ -1013,7 +1013,7 @@ export class tools extends plugin {
} }
// 上传视频 // 上传视频
return this.sendVideoToUpload(e, `${ tempPath }.mp4`); return this.sendVideoToUpload(e, `${tempPath}.mp4`);
} catch (err) { } catch (err) {
// 错误处理 // 错误处理
logger.error('[R插件][哔哩哔哩视频发送]下载错误,具体原因为:', err); logger.error('[R插件][哔哩哔哩视频发送]下载错误,具体原因为:', err);
@ -1062,7 +1062,7 @@ export class tools extends plugin {
const dynamicId = /[^/]+(?!.*\/)/.exec(url)[0]; const dynamicId = /[^/]+(?!.*\/)/.exec(url)[0];
getDynamic(dynamicId, session).then(async resp => { getDynamic(dynamicId, session).then(async resp => {
if (resp.dynamicSrc.length > 0 || resp.dynamicDesc) { if (resp.dynamicSrc.length > 0 || resp.dynamicDesc) {
e.reply(`${ this.identifyPrefix }识别:哔哩哔哩动态\n${ resp.dynamicDesc }`); e.reply(`${this.identifyPrefix}识别:哔哩哔哩动态\n${resp.dynamicDesc}`);
let dynamicSrcMsg = []; let dynamicSrcMsg = [];
resp.dynamicSrc.forEach(item => { resp.dynamicSrc.forEach(item => {
dynamicSrcMsg.push({ dynamicSrcMsg.push({
@ -1095,7 +1095,7 @@ export class tools extends plugin {
wbi = await getWbi({ bvid, cid, up_mid }, this.biliSessData); wbi = await getWbi({ bvid, cid, up_mid }, this.biliSessData);
} }
// 构造API // 构造API
const summaryUrl = `${ BILI_SUMMARY }?${ wbi }`; const summaryUrl = `${BILI_SUMMARY}?${wbi}`;
logger.info(summaryUrl) logger.info(summaryUrl)
// 构造结果https://api.bilibili.com/x/web-interface/view/conclusion/get?bvid=BV1L94y1H7CV&cid=1335073288&up_mid=297242063&wts=1701546363&w_rid=1073871926b3ccd99bd790f0162af634 // 构造结果https://api.bilibili.com/x/web-interface/view/conclusion/get?bvid=BV1L94y1H7CV&cid=1335073288&up_mid=297242063&wts=1701546363&w_rid=1073871926b3ccd99bd790f0162af634
return axios.get(summaryUrl) return axios.get(summaryUrl)
@ -1107,7 +1107,7 @@ export class tools extends plugin {
let resReply = ""; let resReply = "";
// 总体总结 // 总体总结
if (summary) { if (summary) {
resReply = `\n摘要:${ summary }\n` resReply = `\n摘要:${summary}\n`
} }
// 分段总结 // 分段总结
if (outline) { if (outline) {
@ -1118,9 +1118,9 @@ export class tools extends plugin {
const specificContent = keyPoint.map(point => { const specificContent = keyPoint.map(point => {
const { timestamp, content } = point const { timestamp, content } = point
const specificTime = secondsToTime(timestamp) const specificTime = secondsToTime(timestamp)
return `${ specificTime } ${ content }\n`; return `${specificTime} ${content}\n`;
}).join(""); }).join("");
return `- ${ smallTitle }\n${ specificContent }\n`; return `- ${smallTitle}\n${specificContent}\n`;
}); });
resReply += specificTimeSummary.join(""); resReply += specificTimeSummary.join("");
} }
@ -1134,7 +1134,7 @@ export class tools extends plugin {
* @returns {Promise<*>} * @returns {Promise<*>}
*/ */
async getBiliStreamInfo(liveId) { async getBiliStreamInfo(liveId) {
return axios.get(`${ BILI_STREAM_INFO }?room_id=${ liveId }`, { return axios.get(`${BILI_STREAM_INFO}?room_id=${liveId}`, {
headers: { headers: {
'User-Agent': COMMON_USER_AGENT, 'User-Agent': COMMON_USER_AGENT,
} }
@ -1147,7 +1147,7 @@ export class tools extends plugin {
* @returns {Promise<*>} * @returns {Promise<*>}
*/ */
async getBiliStream(liveId) { async getBiliStream(liveId) {
return axios.get(`${ BILI_STREAM_FLV }?cid=${ liveId }`, { return axios.get(`${BILI_STREAM_FLV}?cid=${liveId}`, {
headers: { headers: {
'User-Agent': COMMON_USER_AGENT, 'User-Agent': COMMON_USER_AGENT,
} }
@ -1176,14 +1176,14 @@ export class tools extends plugin {
await fetch(TWITTER_TWEET_INFO.replace("{}", id), { await fetch(TWITTER_TWEET_INFO.replace("{}", id), {
headers: { headers: {
"User-Agent": "v2TweetLookupJS", "User-Agent": "v2TweetLookupJS",
"authorization": `Bearer ${ Buffer.from(TWITTER_BEARER_TOKEN, "base64").toString() }` "authorization": `Bearer ${Buffer.from(TWITTER_BEARER_TOKEN, "base64").toString()}`
}, },
...params, ...params,
agent: !isOversea ? '' : new HttpsProxyAgent(this.myProxy), agent: !isOversea ? '' : new HttpsProxyAgent(this.myProxy),
}).then(async resp => { }).then(async resp => {
logger.info(resp) logger.info(resp)
e.reply(`${ this.identifyPrefix }识别:小蓝鸟学习版,${ resp.data.text }`); e.reply(`${this.identifyPrefix}识别:小蓝鸟学习版,${resp.data.text}`);
const downloadPath = `${ this.getCurDownloadPath(e) }`; const downloadPath = `${this.getCurDownloadPath(e)}`;
// 创建文件夹(如果没有过这个群) // 创建文件夹(如果没有过这个群)
if (!fs.existsSync(downloadPath)) { if (!fs.existsSync(downloadPath)) {
mkdirsSync(downloadPath); mkdirsSync(downloadPath);
@ -1198,7 +1198,7 @@ export class tools extends plugin {
// 视频 // 视频
await this.downloadVideo(resp.includes.media[0].variants[0].url, true).then( await this.downloadVideo(resp.includes.media[0].variants[0].url, true).then(
_ => { _ => {
e.reply(segment.video(`${ downloadPath }/temp.mp4`)); e.reply(segment.video(`${downloadPath}/temp.mp4`));
}, },
); );
} }
@ -1248,7 +1248,7 @@ export class tools extends plugin {
} }
// 提取视频 // 提取视频
let videoUrl = GENERAL_REQ_LINK.link.replace("{}", twitterUrl); let videoUrl = GENERAL_REQ_LINK.link.replace("{}", twitterUrl);
e.reply(`${ this.identifyPrefix }识别:小蓝鸟学习版`); e.reply(`${this.identifyPrefix}识别:小蓝鸟学习版`);
const config = { const config = {
headers: { headers: {
'Accept': 'ext/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7', 'Accept': 'ext/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7',
@ -1298,24 +1298,24 @@ export class tools extends plugin {
// acfun解析 // acfun解析
async acfun(e) { async acfun(e) {
const path = `${ this.getCurDownloadPath(e) }/temp/`; const path = `${this.getCurDownloadPath(e)}/temp/`;
await mkdirIfNotExists(path); await mkdirIfNotExists(path);
let inputMsg = e.msg; let inputMsg = e.msg;
// 适配手机分享https://m.acfun.cn/v/?ac=32838812&sid=d2b0991bd6ad9c09 // 适配手机分享https://m.acfun.cn/v/?ac=32838812&sid=d2b0991bd6ad9c09
if (inputMsg.includes("m.acfun.cn")) { if (inputMsg.includes("m.acfun.cn")) {
inputMsg = `https://www.acfun.cn/v/ac${ /ac=([^&?]*)/.exec(inputMsg)[1] }`; inputMsg = `https://www.acfun.cn/v/ac${/ac=([^&?]*)/.exec(inputMsg)[1]}`;
} else if (inputMsg.includes("ac")) { } else if (inputMsg.includes("ac")) {
// 如果是 // 如果是
inputMsg = "https://www.acfun.cn/v/" + /ac\d+/.exec(inputMsg)[0]; inputMsg = "https://www.acfun.cn/v/" + /ac\d+/.exec(inputMsg)[0];
} }
parseUrl(inputMsg).then(res => { parseUrl(inputMsg).then(res => {
e.reply(`${ this.identifyPrefix }识别:猴山,${ res.videoName }`); e.reply(`${this.identifyPrefix}识别:猴山,${res.videoName}`);
parseM3u8(res.urlM3u8s[res.urlM3u8s.length - 1]).then(res2 => { parseM3u8(res.urlM3u8s[res.urlM3u8s.length - 1]).then(res2 => {
downloadM3u8Videos(res2.m3u8FullUrls, path).then(_ => { downloadM3u8Videos(res2.m3u8FullUrls, path).then(_ => {
mergeAcFileToMp4(res2.tsNames, path, `${ path }out.mp4`).then(_ => { mergeAcFileToMp4(res2.tsNames, path, `${path}out.mp4`).then(_ => {
this.sendVideoToUpload(e, `${ path }out.mp4`) this.sendVideoToUpload(e, `${path}out.mp4`)
}); });
}); });
}); });
@ -1371,14 +1371,14 @@ export class tools extends plugin {
xsecSource = parsedUrl.searchParams.get("xsec_source") ?? "pc_feed"; xsecSource = parsedUrl.searchParams.get("xsec_source") ?? "pc_feed";
xsecToken = parsedUrl.searchParams.get("xsec_token"); xsecToken = parsedUrl.searchParams.get("xsec_token");
} }
const downloadPath = `${ this.getCurDownloadPath(e) }`; const downloadPath = `${this.getCurDownloadPath(e)}`;
// 检测没有 cookie 则退出 // 检测没有 cookie 则退出
if (_.isEmpty(this.xiaohongshuCookie) || _.isEmpty(id) || _.isEmpty(xsecToken) || _.isEmpty(xsecSource)) { if (_.isEmpty(this.xiaohongshuCookie) || _.isEmpty(id) || _.isEmpty(xsecToken) || _.isEmpty(xsecSource)) {
e.reply(`请检查以下问题:\n1. 是否填写 Cookie\n2. 链接是否有id\n3. 链接是否有 xsec_token 和 xsec_source\n${ HELP_DOC }`); e.reply(`请检查以下问题:\n1. 是否填写 Cookie\n2. 链接是否有id\n3. 链接是否有 xsec_token 和 xsec_source\n${HELP_DOC}`);
return; return;
} }
// 获取信息 // 获取信息
const resp = await fetch(`${ XHS_REQ_LINK }${ id }?xsec_token=${xsecToken}&xsec_source=${xsecSource}`, { const resp = await fetch(`${XHS_REQ_LINK}${id}?xsec_token=${xsecToken}&xsec_source=${xsecSource}`, {
headers: XHS_NO_WATERMARK_HEADER, headers: XHS_NO_WATERMARK_HEADER,
}); });
// 从网页获取数据 // 从网页获取数据
@ -1389,7 +1389,7 @@ export class tools extends plugin {
// saveJsonToFile(resJson); // saveJsonToFile(resJson);
// 检测无效 Cookie // 检测无效 Cookie
if (resJson?.note === undefined || resJson?.note?.noteDetailMap?.[id]?.note === undefined) { if (resJson?.note === undefined || resJson?.note?.noteDetailMap?.[id]?.note === undefined) {
e.reply(`检测到无效的小红书 Cookie可以尝试清除缓存和cookie 或者 换一个浏览器进行获取\n${ HELP_DOC }`); e.reply(`检测到无效的小红书 Cookie可以尝试清除缓存和cookie 或者 换一个浏览器进行获取\n${HELP_DOC}`);
return; return;
} }
// 提取出数据 // 提取出数据
@ -1398,7 +1398,7 @@ export class tools extends plugin {
if (type === "video") { if (type === "video") {
// 封面 // 封面
const cover = noteData.imageList?.[0].urlDefault; const cover = noteData.imageList?.[0].urlDefault;
e.reply([segment.image(cover), `${ this.identifyPrefix }识别:小红书, ${ title }\n${ desc }`]); e.reply([segment.image(cover), `${this.identifyPrefix}识别:小红书, ${title}\n${desc}`]);
// ⚠️ 暂时废弃构造xhs视频链接有水印 // ⚠️ 暂时废弃构造xhs视频链接有水印
const xhsVideoUrl = noteData.video.media.stream.h264?.[0]?.masterUrl; const xhsVideoUrl = noteData.video.media.stream.h264?.[0]?.masterUrl;
@ -1408,20 +1408,20 @@ export class tools extends plugin {
this.downloadVideo(xhsVideoUrl).then(path => { this.downloadVideo(xhsVideoUrl).then(path => {
if (path === undefined) { if (path === undefined) {
// 创建文件,如果不存在 // 创建文件,如果不存在
path = `${ this.getCurDownloadPath(e) }/`; path = `${this.getCurDownloadPath(e)}/`;
} }
this.sendVideoToUpload(e, `${ path }/temp.mp4`) this.sendVideoToUpload(e, `${path}/temp.mp4`)
}); });
return true; return true;
} else if (type === "normal") { } else if (type === "normal") {
e.reply(`${ this.identifyPrefix }识别:小红书, ${ title }\n${ desc }`); e.reply(`${this.identifyPrefix}识别:小红书, ${title}\n${desc}`);
const imagePromises = []; const imagePromises = [];
// 使用 for..of 循环处理异步下载操作 // 使用 for..of 循环处理异步下载操作
for (let [index, item] of noteData.imageList.entries()) { for (let [index, item] of noteData.imageList.entries()) {
imagePromises.push(downloadImg({ imagePromises.push(downloadImg({
img: item.urlDefault, img: item.urlDefault,
dir: downloadPath, dir: downloadPath,
fileName: `${ index }.png`, fileName: `${index}.png`,
downloadMethod: this.biliDownloadMethod, downloadMethod: this.biliDownloadMethod,
})); }));
} }
@ -1455,14 +1455,14 @@ export class tools extends plugin {
/(?=mvId).*?(?=&)/.exec(e.msg.trim())?.[0].replace("mvId=", ""); /(?=mvId).*?(?=&)/.exec(e.msg.trim())?.[0].replace("mvId=", "");
const { name, album, artist, albumPic120, categorys } = await getBodianMusicInfo(id); const { name, album, artist, albumPic120, categorys } = await getBodianMusicInfo(id);
e.reply([ e.reply([
`${ this.identifyPrefix }识别:波点音乐,${ name }-${ album }-${ artist }\n标签:${ categorys `${this.identifyPrefix}识别:波点音乐,${name}-${album}-${artist}\n标签:${categorys
.map(item => item.name) .map(item => item.name)
.join(" | ") }`, .join(" | ")}`,
segment.image(albumPic120), segment.image(albumPic120),
]); ]);
if (e.msg.includes("musicId")) { if (e.msg.includes("musicId")) {
const path = `${ this.getCurDownloadPath(e) }`; const path = `${this.getCurDownloadPath(e)}`;
await getBodianAudio(id, path, `${ name }-${ artist }`).then(sendPath => { await getBodianAudio(id, path, `${name}-${artist}`).then(sendPath => {
// 发送语音 // 发送语音
e.reply(segment.record(sendPath)); e.reply(segment.record(sendPath));
// 上传群文件 // 上传群文件
@ -1841,12 +1841,12 @@ export class tools extends plugin {
downloadAudio(url, this.getCurDownloadPath(e), title, 'follow', musicExt).then(async path => { downloadAudio(url, this.getCurDownloadPath(e), title, 'follow', musicExt).then(async path => {
// 发送群文件 // 发送群文件
await this.uploadGroupFile(e, path); await this.uploadGroupFile(e, path);
// 删除文件
await checkAndRemoveFile(path);
// 发送语音 // 发送语音
if (musicExt != 'mp4' && this.isSendVocal) { if (musicExt != 'mp4' && this.isSendVocal) {
await e.reply(segment.record(path)); await e.reply(segment.record(path));
} }
// 删除文件
await checkAndRemoveFile(path);
}).catch(err => { }).catch(err => {
logger.error(`下载音乐失败,错误信息为: ${err}`); logger.error(`下载音乐失败,错误信息为: ${err}`);
}); });
@ -1975,7 +1975,7 @@ export class tools extends plugin {
"accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9", "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
"referer": "https://weibo.com/", "referer": "https://weibo.com/",
}, 1).then(path => { }, 1).then(path => {
this.sendVideoToUpload(e, `${ path }/temp.mp4`) this.sendVideoToUpload(e, `${path}/temp.mp4`)
}); });
} catch (err) { } catch (err) {
e.reply("视频资源获取失败"); e.reply("视频资源获取失败");
@ -1994,7 +1994,7 @@ export class tools extends plugin {
async general(e) { async general(e) {
try { try {
const adapter = await GeneralLinkAdapter.create(e.msg); const adapter = await GeneralLinkAdapter.create(e.msg);
e.reply(`${ this.identifyPrefix }识别:${ adapter.name }${ adapter.desc ? `, ${ adapter.desc }` : '' }`); e.reply(`${this.identifyPrefix}识别:${adapter.name}${adapter.desc ? `, ${adapter.desc}` : ''}`);
logger.mark(adapter); logger.mark(adapter);
if (adapter.images && adapter.images.length > 0) { if (adapter.images && adapter.images.length > 0) {
const images = adapter.images.map(item => { const images = adapter.images.map(item => {
@ -2010,7 +2010,7 @@ export class tools extends plugin {
const url = adapter.video; const url = adapter.video;
this.downloadVideo(url).then(path => { this.downloadVideo(url).then(path => {
logger.info(path); logger.info(path);
this.sendVideoToUpload(e, `${ path }/temp.mp4`) this.sendVideoToUpload(e, `${path}/temp.mp4`)
}); });
} else { } else {
e.reply("解析失败:无法获取到资源"); e.reply("解析失败:无法获取到资源");
@ -2042,7 +2042,7 @@ export class tools extends plugin {
//非最高画质,就按照设定的来 //非最高画质,就按照设定的来
let graphics = "" let graphics = ""
if (this.youtubeGraphicsOptions != 0) { if (this.youtubeGraphicsOptions != 0) {
graphics = `[height<=${ this.youtubeGraphicsOptions }]` graphics = `[height<=${this.youtubeGraphicsOptions}]`
} }
const path = this.getCurDownloadPath(e); const path = this.getCurDownloadPath(e);
@ -2059,8 +2059,8 @@ export class tools extends plugin {
`${this.identifyPrefix}识别:油管音乐\n视频标题:${title}` `${this.identifyPrefix}识别:油管音乐\n视频标题:${title}`
]); ]);
await ytDlpHelper(path, url, isOversea, this.myProxy, this.videoDownloadConcurrency, true, graphics, timeRange, this.youtubeCookiePath); await ytDlpHelper(path, url, isOversea, this.myProxy, this.videoDownloadConcurrency, true, graphics, timeRange, this.youtubeCookiePath);
e.reply(segment.record(`${ path }/temp.mp3`)); e.reply(segment.record(`${path}/temp.mp3`));
this.uploadGroupFile(e, `${ path }/temp.mp3`); this.uploadGroupFile(e, `${path}/temp.mp3`);
// 发送完就截断 // 发送完就截断
return; return;
} }
@ -2130,7 +2130,7 @@ export class tools extends plugin {
} catch (e) { } catch (e) {
realContent = content; realContent = content;
} }
const normalMsg = `${ this.identifyPrefix }识别:米游社,${ subject }\n${ realContent?.describe || "" }`; const normalMsg = `${this.identifyPrefix}识别:米游社,${subject}\n${realContent?.describe || ""}`;
const replyMsg = cover ? [segment.image(cover), normalMsg] : normalMsg; const replyMsg = cover ? [segment.image(cover), normalMsg] : normalMsg;
e.reply(replyMsg); e.reply(replyMsg);
// 图片 // 图片
@ -2154,7 +2154,7 @@ export class tools extends plugin {
// 暂时选取分辨率较低的video进行解析 // 暂时选取分辨率较低的video进行解析
const videoUrl = resolutions[i].url; const videoUrl = resolutions[i].url;
this.downloadVideo(videoUrl).then(path => { this.downloadVideo(videoUrl).then(path => {
this.sendVideoToUpload(e, `${ path }/temp.mp4`) this.sendVideoToUpload(e, `${path}/temp.mp4`)
}); });
break; break;
} }
@ -2199,10 +2199,10 @@ export class tools extends plugin {
const cover = firstFeed.images[0].url; const cover = firstFeed.images[0].url;
const noWatermarkDownloadUrl = firstFeed.video_url; const noWatermarkDownloadUrl = firstFeed.video_url;
e.reply([segment.image(cover), `${ this.identifyPrefix }识别:微视,${ title }`]); e.reply([segment.image(cover), `${this.identifyPrefix}识别:微视,${title}`]);
this.downloadVideo(noWatermarkDownloadUrl).then(path => { this.downloadVideo(noWatermarkDownloadUrl).then(path => {
this.sendVideoToUpload(e, `${ path }/temp.mp4`) this.sendVideoToUpload(e, `${path}/temp.mp4`)
}); });
} catch (err) { } catch (err) {
logger.error(err); logger.error(err);
@ -2251,7 +2251,7 @@ export class tools extends plugin {
images, images,
}; };
e.reply(`${ this.identifyPrefix }识别:最右,${ shortVideoInfo.authorName }\n${ shortVideoInfo.title }`) e.reply(`${this.identifyPrefix}识别:最右,${shortVideoInfo.authorName}\n${shortVideoInfo.title}`)
if (shortVideoInfo.images.length > 0) { if (shortVideoInfo.images.length > 0) {
const replyImages = shortVideoInfo.images.map(item => { const replyImages = shortVideoInfo.images.map(item => {
@ -2265,7 +2265,7 @@ export class tools extends plugin {
} }
if (shortVideoInfo.noWatermarkDownloadUrl) { if (shortVideoInfo.noWatermarkDownloadUrl) {
this.downloadVideo(shortVideoInfo.noWatermarkDownloadUrl).then(path => { this.downloadVideo(shortVideoInfo.noWatermarkDownloadUrl).then(path => {
this.sendVideoToUpload(e, `${ path }/temp.mp4`) this.sendVideoToUpload(e, `${path}/temp.mp4`)
}); });
} }
} catch (error) { } catch (error) {
@ -2287,17 +2287,17 @@ export class tools extends plugin {
// 检测是否存在框架 // 检测是否存在框架
const isExistFreyr = await checkToolInCurEnv("freyr"); const isExistFreyr = await checkToolInCurEnv("freyr");
if (!isExistFreyr) { if (!isExistFreyr) {
e.reply(`检测到没有${ freyrName }需要的环境,无法解析!${ HELP_DOC }`); e.reply(`检测到没有${freyrName}需要的环境,无法解析!${HELP_DOC}`);
return; return;
} }
// 执行命令 // 执行命令
const result = await execSync(`freyr -d ${ currentWorkingDirectory + "/am/" } get ${ message }`); const result = await execSync(`freyr -d ${currentWorkingDirectory + "/am/"} get ${message}`);
logger.info(result.toString()); logger.info(result.toString());
// 获取信息 // 获取信息
let { title, album, artist } = await this.parseFreyrLog(result.toString()); let { title, album, artist } = await this.parseFreyrLog(result.toString());
// 兜底策略 // 兜底策略
if (freyrName === "Apple Music" && (title === "N/A" || album === "N/A" || artist === "N/A")) { if (freyrName === "Apple Music" && (title === "N/A" || album === "N/A" || artist === "N/A")) {
const data = await axios.get(`https://api.fabdl.com/apple-music/get?url=${ message }`, { const data = await axios.get(`https://api.fabdl.com/apple-music/get?url=${message}`, {
headers: { headers: {
"User-Agent": COMMON_USER_AGENT, "User-Agent": COMMON_USER_AGENT,
"Referer": "https://apple-music-downloader.com/", "Referer": "https://apple-music-downloader.com/",
@ -2314,7 +2314,7 @@ export class tools extends plugin {
// 国内服务器解决方案 // 国内服务器解决方案
if (!isOversea) { if (!isOversea) {
// 临时接口 // 临时接口
const url = await this.musicTempApi(e, `${ title } ${ artist }`, freyrName); const url = await this.musicTempApi(e, `${title} ${artist}`, freyrName);
// 下载音乐 // 下载音乐
downloadAudio(url, this.getCurDownloadPath(e), title, 'follow').then(async path => { downloadAudio(url, this.getCurDownloadPath(e), title, 'follow').then(async path => {
// 发送语音 // 发送语音
@ -2325,22 +2325,22 @@ export class tools extends plugin {
await this.uploadGroupFile(e, path); await this.uploadGroupFile(e, path);
await checkAndRemoveFile(path); await checkAndRemoveFile(path);
}).catch(err => { }).catch(err => {
logger.error(`下载音乐失败,错误信息为: ${ err.message }`); logger.error(`下载音乐失败,错误信息为: ${err.message}`);
}); });
} else { } else {
// freyr 逻辑 // freyr 逻辑
e.reply(`${ this.identifyPrefix }识别:${ freyrName }${ title }--${ artist }`); e.reply(`${this.identifyPrefix}识别:${freyrName}${title}--${artist}`);
// 检查目录是否存在 // 检查目录是否存在
const musicPath = currentWorkingDirectory + "/am/" + artist + "/" + album; const musicPath = currentWorkingDirectory + "/am/" + artist + "/" + album;
// 找到音频文件 // 找到音频文件
const mediaFiles = await getMediaFilesAndOthers(musicPath); const mediaFiles = await getMediaFilesAndOthers(musicPath);
for (let other of mediaFiles.others) { for (let other of mediaFiles.others) {
await this.uploadGroupFile(e, `${ musicPath }/${ other }`); await this.uploadGroupFile(e, `${musicPath}/${other}`);
} }
} }
// 计数 // 计数
tools.#amCount += 1; tools.#amCount += 1;
logger.info(`当前${ freyrName }已经下载了:${ tools.#amCount }`); logger.info(`当前${freyrName}已经下载了:${tools.#amCount}`);
// 定时清理 // 定时清理
if (tools.#amCount >= 5) { if (tools.#amCount >= 5) {
await deleteFolderRecursive(currentWorkingDirectory + "/am"); await deleteFolderRecursive(currentWorkingDirectory + "/am");
@ -2391,13 +2391,13 @@ export class tools extends plugin {
.setModel(this.aiModel) .setModel(this.aiModel)
.setPrompt(SUMMARY_PROMPT) .setPrompt(SUMMARY_PROMPT)
.build(); .build();
e.reply(`${ this.identifyPrefix }识别:${ name },正在为您总结,请稍等...`, true, { recallMsg: MESSAGE_RECALL_TIME }); e.reply(`${this.identifyPrefix}识别:${name},正在为您总结,请稍等...`, true, { recallMsg: MESSAGE_RECALL_TIME });
const { ans: kimiAns, model } = await builder.kimi(summaryLink); const { ans: kimiAns, model } = await builder.kimi(summaryLink);
// 计算阅读时间 // 计算阅读时间
const stats = estimateReadingTime(kimiAns); const stats = estimateReadingTime(kimiAns);
const titleMatch = kimiAns.match(/(Title|标题)([:])\s*(.*?)\n/)?.[3]; const titleMatch = kimiAns.match(/(Title|标题)([:])\s*(.*?)\n/)?.[3];
e.reply(`${ titleMatch }》 预计阅读时间: ${ stats.minutes } 分钟,总字数: ${ stats.words }`) e.reply(`${titleMatch}》 预计阅读时间: ${stats.minutes} 分钟,总字数: ${stats.words}`)
const Msg = await Bot.makeForwardMsg(textArrayToMakeForward(e, [`「R插件 x ${ model }」联合为您总结内容:`, kimiAns])); const Msg = await Bot.makeForwardMsg(textArrayToMakeForward(e, [`「R插件 x ${model}」联合为您总结内容:`, kimiAns]));
await e.reply(Msg); await e.reply(Msg);
return true; return true;
} }
@ -2412,7 +2412,7 @@ export class tools extends plugin {
async tempSummary(name, summaryLink, e) { async tempSummary(name, summaryLink, e) {
const content = await llmRead(summaryLink); const content = await llmRead(summaryLink);
const titleMatch = content.match(/Title:\s*(.*?)\n/)?.[1]; const titleMatch = content.match(/Title:\s*(.*?)\n/)?.[1];
e.reply(`${ this.identifyPrefix }识别:${ name } - ${ titleMatch },正在为您总结,请稍等...`, true); e.reply(`${this.identifyPrefix}识别:${name} - ${titleMatch},正在为您总结,请稍等...`, true);
const summary = await deepSeekChat(content, SUMMARY_PROMPT); const summary = await deepSeekChat(content, SUMMARY_PROMPT);
const Msg = await Bot.makeForwardMsg(textArrayToMakeForward(e, [`「R插件 x DeepSeek」联合为您总结内容`, summary])); const Msg = await Bot.makeForwardMsg(textArrayToMakeForward(e, [`「R插件 x DeepSeek」联合为您总结内容`, summary]));
await e.reply(Msg); await e.reply(Msg);
@ -2436,7 +2436,7 @@ export class tools extends plugin {
musicInfo = prompt + "-" + desc; musicInfo = prompt + "-" + desc;
// 空判定 // 空判定
if (musicInfo.trim() === "-" || prompt === undefined || desc === undefined) { if (musicInfo.trim() === "-" || prompt === undefined || desc === undefined) {
logger.info(`没有识别到QQ音乐小程序帮助文档如下${ HELP_DOC }`) logger.info(`没有识别到QQ音乐小程序帮助文档如下${HELP_DOC}`)
return true; return true;
} }
} else { } else {
@ -2446,7 +2446,7 @@ export class tools extends plugin {
} }
// 删除特殊字符 // 删除特殊字符
musicInfo = cleanFilename(musicInfo); musicInfo = cleanFilename(musicInfo);
logger.info(`[R插件][qqMusic] 识别音乐为:${ musicInfo }`); logger.info(`[R插件][qqMusic] 识别音乐为:${musicInfo}`);
// 使用临时接口下载 // 使用临时接口下载
const url = await this.musicTempApi(e, musicInfo, "QQ音乐"); const url = await this.musicTempApi(e, musicInfo, "QQ音乐");
// 下载音乐 // 下载音乐
@ -2459,7 +2459,7 @@ export class tools extends plugin {
await this.uploadGroupFile(e, path); await this.uploadGroupFile(e, path);
await checkAndRemoveFile(path); await checkAndRemoveFile(path);
}).catch(err => { }).catch(err => {
logger.error(`下载音乐失败,错误信息为: ${ err.message }`); logger.error(`下载音乐失败,错误信息为: ${err.message}`);
}); });
return true; return true;
} }
@ -2468,7 +2468,7 @@ export class tools extends plugin {
async qishuiMusic(e) { async qishuiMusic(e) {
const normalRegex = /^(.*?)\s*https?:\/\//; const normalRegex = /^(.*?)\s*https?:\/\//;
const musicInfo = normalRegex.exec(e.msg)?.[1].trim().replace("@汽水音乐", ""); const musicInfo = normalRegex.exec(e.msg)?.[1].trim().replace("@汽水音乐", "");
logger.info(`[R插件][qishuiMusic] 识别音乐为:${ musicInfo }`); logger.info(`[R插件][qishuiMusic] 识别音乐为:${musicInfo}`);
// 使用临时接口下载 // 使用临时接口下载
const url = await this.musicTempApi(e, musicInfo, "汽水音乐"); const url = await this.musicTempApi(e, musicInfo, "汽水音乐");
// 下载音乐 // 下载音乐
@ -2481,7 +2481,7 @@ export class tools extends plugin {
await this.uploadGroupFile(e, path); await this.uploadGroupFile(e, path);
await checkAndRemoveFile(path); await checkAndRemoveFile(path);
}).catch(err => { }).catch(err => {
logger.error(`下载音乐失败,错误信息为: ${ err.message }`); logger.error(`下载音乐失败,错误信息为: ${err.message}`);
}); });
return true; return true;
} }
@ -2501,7 +2501,7 @@ export class tools extends plugin {
// 检查当前环境 // 检查当前环境
const isExistTdl = await checkToolInCurEnv("tdl"); const isExistTdl = await checkToolInCurEnv("tdl");
if (!isExistTdl) { if (!isExistTdl) {
e.reply(`未检测到必要的环境,无法解析小飞机${ HELP_DOC }`); e.reply(`未检测到必要的环境,无法解析小飞机${HELP_DOC}`);
return; return;
} }
const url = urlRex.exec(e.msg)[0]; const url = urlRex.exec(e.msg)[0];
@ -2511,8 +2511,8 @@ export class tools extends plugin {
e.reply("文件已保存到 Save Messages"); e.reply("文件已保存到 Save Messages");
return true; return true;
} }
e.reply(`${ this.identifyPrefix }识别:小飞机(学习版)`); e.reply(`${this.identifyPrefix}识别:小飞机(学习版)`);
const tgSavePath = `${ this.getCurDownloadPath(e) }/tg`; const tgSavePath = `${this.getCurDownloadPath(e)}/tg`;
// 如果没有文件夹则创建 // 如果没有文件夹则创建
await mkdirIfNotExists(tgSavePath); await mkdirIfNotExists(tgSavePath);
// 删除之前的文件 // 删除之前的文件
@ -2522,7 +2522,7 @@ export class tools extends plugin {
const mediaFiles = await getMediaFilesAndOthers(tgSavePath); const mediaFiles = await getMediaFilesAndOthers(tgSavePath);
if (mediaFiles.images.length > 0) { if (mediaFiles.images.length > 0) {
const imagesData = mediaFiles.images.map(item => { const imagesData = mediaFiles.images.map(item => {
const fileContent = fs.readFileSync(`${ tgSavePath }/${ item }`); const fileContent = fs.readFileSync(`${tgSavePath}/${item}`);
return { return {
message: segment.image(fileContent), message: segment.image(fileContent),
nickname: e.sender.card || e.user_id, nickname: e.sender.card || e.user_id,
@ -2532,11 +2532,11 @@ export class tools extends plugin {
e.reply(await Bot.makeForwardMsg(imagesData), true, { recallMsg: MESSAGE_RECALL_TIME }); e.reply(await Bot.makeForwardMsg(imagesData), true, { recallMsg: MESSAGE_RECALL_TIME });
} else if (mediaFiles.videos.length > 0) { } else if (mediaFiles.videos.length > 0) {
for (const item of mediaFiles.videos) { for (const item of mediaFiles.videos) {
await this.sendVideoToUpload(e, `${ tgSavePath }/${ item }`); await this.sendVideoToUpload(e, `${tgSavePath}/${item}`);
} }
} else { } else {
for (let other of mediaFiles.others) { for (let other of mediaFiles.others) {
await this.uploadGroupFile(e, `${ tgSavePath }/${ other }`); await this.uploadGroupFile(e, `${tgSavePath}/${other}`);
} }
} }
return true; return true;
@ -2548,7 +2548,7 @@ export class tools extends plugin {
const msg = /https:\/\/tieba\.baidu\.com\/p\/[A-Za-z0-9]+/.exec(e.msg)?.[0]; const msg = /https:\/\/tieba\.baidu\.com\/p\/[A-Za-z0-9]+/.exec(e.msg)?.[0];
const id = /\/p\/([A-Za-z0-9]+)/.exec(msg)?.[1]; const id = /\/p\/([A-Za-z0-9]+)/.exec(msg)?.[1];
// 获取帖子详情 // 获取帖子详情
const hibi = HIBI_API_SERVICE + `/tieba/post_detail?tid=${ id }`; const hibi = HIBI_API_SERVICE + `/tieba/post_detail?tid=${id}`;
const hibiResp = await fetch(hibi, { const hibiResp = await fetch(hibi, {
headers: { headers: {
"User-Agent": COMMON_USER_AGENT, "User-Agent": COMMON_USER_AGENT,
@ -2559,7 +2559,7 @@ export class tools extends plugin {
const top = postList[0]; const top = postList[0];
// 提取标题和内容 // 提取标题和内容
const { title, content } = top; const { title, content } = top;
let sendContent = `${ this.identifyPrefix }识别:贴吧,${ title }` let sendContent = `${this.identifyPrefix}识别:贴吧,${title}`
let extractImages = []; let extractImages = [];
// 如果内容中有图片、文本或视频,它会将它们添加到 sendContent 消息中 // 如果内容中有图片、文本或视频,它会将它们添加到 sendContent 消息中
if (content && content.length > 0) { if (content && content.length > 0) {
@ -2571,12 +2571,12 @@ export class tools extends plugin {
if (cdn_src) extractImages.push(segment.image(cdn_src)); if (cdn_src) extractImages.push(segment.image(cdn_src));
// 处理文本 // 处理文本
if (text) sendContent.push(`\n\n📝 简介:${ text }`); if (text) sendContent.push(`\n\n📝 简介:${text}`);
// 处理视频 // 处理视频
if (link) { if (link) {
const filePath = await this.downloadVideo(link); const filePath = await this.downloadVideo(link);
this.sendVideoToUpload(e, `${ filePath }/temp.mp4`); this.sendVideoToUpload(e, `${filePath}/temp.mp4`);
} }
} }
} }
@ -2654,7 +2654,7 @@ export class tools extends plugin {
this.videoDownloadConcurrency this.videoDownloadConcurrency
), ),
]).then(data => { ]).then(data => {
return mergeFileToMp4(data[0].fullFileName, data[1].fullFileName, `${ title }.mp4`); return mergeFileToMp4(data[0].fullFileName, data[1].fullFileName, `${title}.mp4`);
}); });
} }
@ -2709,7 +2709,7 @@ export class tools extends plugin {
* @returns {string} * @returns {string}
*/ */
getCurDownloadPath(e) { getCurDownloadPath(e) {
return `${ this.defaultPath }${ e.group_id || e.user_id }` return `${this.defaultPath}${e.group_id || e.user_id}`
} }
/** /**
@ -2717,8 +2717,8 @@ export class tools extends plugin {
* @returns {{groupPath: string, target: string}} * @returns {{groupPath: string, target: string}}
*/ */
getGroupPathAndTarget() { getGroupPathAndTarget() {
const groupPath = `${ this.defaultPath }${ this.e.group_id || this.e.user_id }`; const groupPath = `${this.defaultPath}${this.e.group_id || this.e.user_id}`;
const target = `${ groupPath }/temp.mp4`; const target = `${groupPath}/temp.mp4`;
return { groupPath, target }; return { groupPath, target };
} }
@ -2740,7 +2740,7 @@ export class tools extends plugin {
// 构造代理参数 // 构造代理参数
const proxyOption = { const proxyOption = {
...(isProxy && { ...(isProxy && {
httpAgent: new HttpsProxyAgent(`http://${ this.proxyAddr }:${ this.proxyPort }`), httpAgent: new HttpsProxyAgent(`http://${this.proxyAddr}:${this.proxyPort}`),
}), }),
} }
@ -2757,7 +2757,7 @@ export class tools extends plugin {
target, target,
groupPath, groupPath,
} }
logger.info(`[R插件][视频下载]:当前队列长度为 ${ this.queue.size + 1 }`); logger.info(`[R插件][视频下载]:当前队列长度为 ${this.queue.size + 1}`);
return await this.queue.add(async () => { return await this.queue.add(async () => {
// 如果是用户设置了单线程,则不分片下载 // 如果是用户设置了单线程,则不分片下载
if (numThreads === 1) { if (numThreads === 1) {
@ -2807,7 +2807,7 @@ export class tools extends plugin {
const partAxiosConfig = { const partAxiosConfig = {
headers: { headers: {
"User-Agent": userAgent, "User-Agent": userAgent,
"Range": `bytes=${ start }-${ end }` "Range": `bytes=${start}-${end}`
}, },
responseType: "stream", responseType: "stream",
...proxyOption ...proxyOption
@ -2815,12 +2815,12 @@ export class tools extends plugin {
promises.push(axios.get(url, partAxiosConfig).then(res => { promises.push(axios.get(url, partAxiosConfig).then(res => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const partPath = `${ target }.part${ i }`; const partPath = `${target}.part${i}`;
logger.mark(`[R插件][视频下载引擎] 正在下载 part${ i }`) logger.mark(`[R插件][视频下载引擎] 正在下载 part${i}`)
const writer = fs.createWriteStream(partPath); const writer = fs.createWriteStream(partPath);
res.data.pipe(writer); res.data.pipe(writer);
writer.on("finish", () => { writer.on("finish", () => {
logger.mark(`[R插件][视频下载引擎] part${ i + 1 } 下载完成`); // 记录线程下载完成 logger.mark(`[R插件][视频下载引擎] part${i + 1} 下载完成`); // 记录线程下载完成
resolve(partPath); resolve(partPath);
}); });
writer.on("error", reject); writer.on("error", reject);
@ -2850,7 +2850,7 @@ export class tools extends plugin {
return groupPath; return groupPath;
} catch (err) { } catch (err) {
logger.error(`下载视频发生错误!\ninfo:${ err }`); logger.error(`下载视频发生错误!\ninfo:${err}`);
} }
} }
@ -2865,39 +2865,39 @@ export class tools extends plugin {
// 构造aria2c命令参数 // 构造aria2c命令参数
const aria2cArgs = [ const aria2cArgs = [
`"${ url }"`, `"${url}"`,
`--out="temp.mp4"`, `--out="temp.mp4"`,
`--dir="${ groupPath }"`, `--dir="${groupPath}"`,
`--user-agent="${ userAgent }"`, `--user-agent="${userAgent}"`,
`--max-connection-per-server=${ numThreads }`, // 每个服务器的最大连接数 `--max-connection-per-server=${numThreads}`, // 每个服务器的最大连接数
`--split=${ numThreads }`, // 分成 6 个部分进行下载 `--split=${numThreads}`, // 分成 6 个部分进行下载
]; ];
// 如果有自定义头信息 // 如果有自定义头信息
if (headers) { if (headers) {
for (const [key, value] of Object.entries(headers)) { for (const [key, value] of Object.entries(headers)) {
aria2cArgs.push(`--header="${ key }: ${ value }"`); aria2cArgs.push(`--header="${key}: ${value}"`);
} }
} }
// 如果使用代理 // 如果使用代理
if (proxyOption && proxyOption.httpAgent) { if (proxyOption && proxyOption.httpAgent) {
const proxyUrl = proxyOption.httpAgent.proxy.href; const proxyUrl = proxyOption.httpAgent.proxy.href;
aria2cArgs.push(`--all-proxy="${ proxyUrl }"`); aria2cArgs.push(`--all-proxy="${proxyUrl}"`);
} }
try { try {
await checkAndRemoveFile(target); await checkAndRemoveFile(target);
logger.mark(`开始下载: ${ url }`); logger.mark(`开始下载: ${url}`);
// 执行aria2c命令 // 执行aria2c命令
const command = `aria2c ${ aria2cArgs.join(' ') }`; const command = `aria2c ${aria2cArgs.join(' ')}`;
exec(command, (error, stdout, stderr) => { exec(command, (error, stdout, stderr) => {
if (error) { if (error) {
logger.error(`下载视频发生错误!\ninfo:${ stderr }`); logger.error(`下载视频发生错误!\ninfo:${stderr}`);
throw error; throw error;
} else { } else {
logger.mark(`下载完成: ${ url }`); logger.mark(`下载完成: ${url}`);
} }
}); });
@ -2905,7 +2905,7 @@ export class tools extends plugin {
let count = 0; let count = 0;
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const checkInterval = setInterval(() => { const checkInterval = setInterval(() => {
logger.info(logger.red(`[R插件][Aria2] 没有检测到文件!重试第${ count + 1 }`)); logger.info(logger.red(`[R插件][Aria2] 没有检测到文件!重试第${count + 1}`));
count += 1; count += 1;
if (fs.existsSync(target)) { if (fs.existsSync(target)) {
logger.info("[R插件][Aria2] 检测到文件!"); logger.info("[R插件][Aria2] 检测到文件!");
@ -2920,7 +2920,7 @@ export class tools extends plugin {
}, DOWNLOAD_WAIT_DETECT_FILE_TIME); }, DOWNLOAD_WAIT_DETECT_FILE_TIME);
}); });
} catch (err) { } catch (err) {
logger.error(`下载视频发生错误!\ninfo:${ err }`); logger.error(`下载视频发生错误!\ninfo:${err}`);
throw err; throw err;
} }
} }
@ -2936,38 +2936,38 @@ export class tools extends plugin {
// 构造axel命令参数 // 构造axel命令参数
const axelArgs = [ const axelArgs = [
`-n ${ numThreads }`, `-n ${numThreads}`,
`-o "${ target }"`, `-o "${target}"`,
`-U "${ userAgent }"`, `-U "${userAgent}"`,
url url
]; ];
// 如果有自定义头信息 // 如果有自定义头信息
if (headers) { if (headers) {
for (const [key, value] of Object.entries(headers)) { for (const [key, value] of Object.entries(headers)) {
axelArgs.push(`-H "${ key }: ${ value }"`); axelArgs.push(`-H "${key}: ${value}"`);
} }
} }
// 如果使用代理 // 如果使用代理
if (proxyOption && proxyOption.httpAgent) { if (proxyOption && proxyOption.httpAgent) {
const proxyUrl = proxyOption.httpAgent.proxy.href; const proxyUrl = proxyOption.httpAgent.proxy.href;
axelArgs.push(`--proxy="${ proxyUrl }"`); axelArgs.push(`--proxy="${proxyUrl}"`);
} }
try { try {
await checkAndRemoveFile(target); await checkAndRemoveFile(target);
logger.mark(`开始下载: ${ url }`); logger.mark(`开始下载: ${url}`);
// 执行axel命令 // 执行axel命令
const command = `axel ${ axelArgs.join(' ') }`; const command = `axel ${axelArgs.join(' ')}`;
exec(command, (error, stdout, stderr) => { exec(command, (error, stdout, stderr) => {
if (error) { if (error) {
logger.error(`下载视频发生错误!\ninfo:${ stderr }`); logger.error(`下载视频发生错误!\ninfo:${stderr}`);
throw error; throw error;
} else { } else {
logger.mark(`下载完成: ${ url }`); logger.mark(`下载完成: ${url}`);
} }
}); });
@ -2975,12 +2975,12 @@ export class tools extends plugin {
// 监听文件生成完成 // 监听文件生成完成
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const checkInterval = setInterval(() => { const checkInterval = setInterval(() => {
logger.info(logger.red(`[R插件][Aria2] 没有检测到文件!重试第${ count + 1 }`)); logger.info(logger.red(`[R插件][Aria2] 没有检测到文件!重试第${count + 1}`));
count += 1; count += 1;
if (fs.existsSync(target)) { if (fs.existsSync(target)) {
logger.info("[R插件][Axel] 检测到文件!"); logger.info("[R插件][Axel] 检测到文件!");
clearInterval(checkInterval); clearInterval(checkInterval);
logger.info(`[R插件][Axel] 下载到${ groupPath }`); logger.info(`[R插件][Axel] 下载到${groupPath}`);
resolve(groupPath); resolve(groupPath);
} }
if (count === 6) { if (count === 6) {
@ -2991,7 +2991,7 @@ export class tools extends plugin {
}, DOWNLOAD_WAIT_DETECT_FILE_TIME); }, DOWNLOAD_WAIT_DETECT_FILE_TIME);
}); });
} catch (err) { } catch (err) {
logger.error(`下载视频发生错误!\ninfo:${ err }`); logger.error(`下载视频发生错误!\ninfo:${err}`);
throw err; throw err;
} }
} }
@ -3014,7 +3014,7 @@ export class tools extends plugin {
await checkAndRemoveFile(target); await checkAndRemoveFile(target);
const res = await axios.get(url, axiosConfig); const res = await axios.get(url, axiosConfig);
logger.mark(`开始下载: ${ url }`); logger.mark(`开始下载: ${url}`);
const writer = fs.createWriteStream(target); const writer = fs.createWriteStream(target);
res.data.pipe(writer); res.data.pipe(writer);
@ -3023,7 +3023,7 @@ export class tools extends plugin {
writer.on("error", reject); writer.on("error", reject);
}); });
} catch (err) { } catch (err) {
logger.error(`下载视频发生错误!\ninfo:${ err }`); logger.error(`下载视频发生错误!\ninfo:${err}`);
} }
} }
@ -3077,13 +3077,13 @@ export class tools extends plugin {
const videoSize = Math.floor(stats.size / (1024 * 1024)); const videoSize = Math.floor(stats.size / (1024 * 1024));
// 正常发送视频 // 正常发送视频
if (videoSize > videoSizeLimit) { if (videoSize > videoSizeLimit) {
e.reply(`当前视频大小:${ videoSize }MB\n大于设置的最大限制:${ videoSizeLimit }MB\n改为上传群文件`); e.reply(`当前视频大小:${videoSize}MB\n大于设置的最大限制:${videoSizeLimit}MB\n改为上传群文件`);
await this.uploadGroupFile(e, path); await this.uploadGroupFile(e, path);
} else { } else {
e.reply(segment.video(path)); e.reply(segment.video(path));
} }
} catch (err) { } catch (err) {
logger.error(`[R插件][发送视频判断是否需要上传] 发生错误:\n ${ err }`); logger.error(`[R插件][发送视频判断是否需要上传] 发生错误:\n ${err}`);
// logger.info(logger.yellow(`上传发生错误R插件正在为你采用备用策略请稍等如果发不出来请再次尝试`)); // logger.info(logger.yellow(`上传发生错误R插件正在为你采用备用策略请稍等如果发不出来请再次尝试`));
// e.reply(segment.video(path)); // e.reply(segment.video(path));
} }