From 6c269a2cedcdeadbad11907abf481e220cdd9645 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=8B=E5=88=80=E9=B1=BC?= <9903082+qdyovo@user.noreply.gitee.com> Date: Wed, 6 Nov 2024 10:22:46 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20faet:=20=E6=96=B0=E5=A2=9E=E8=AF=AD?= =?UTF-8?q?=E9=9F=B3=E5=BC=80=E5=85=B3[#42]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/songRequest.js | 8 +++++++- apps/tools.js | 16 ++++++++++++---- config/tools.yaml | 1 + guoba.support.js | 8 ++++++++ 4 files changed, 28 insertions(+), 5 deletions(-) diff --git a/apps/songRequest.js b/apps/songRequest.js index ed4a50b..8e47ea5 100644 --- a/apps/songRequest.js +++ b/apps/songRequest.js @@ -34,6 +34,8 @@ export class songRequest extends plugin { this.toolsConfig = config.getConfig("tools"); // 加载网易云Cookie this.neteaseCookie = this.toolsConfig.neteaseCookie + // 加载是否转化群语音 + this.isSendVocal = this.toolsConfig.isSendVocal // 加载是否自建服务器 this.useLocalNeteaseAPI = this.toolsConfig.useLocalNeteaseAPI // 加载自建服务器API @@ -316,8 +318,12 @@ export class songRequest extends plugin { logger.error("发送卡片错误错误,请查看控制台报错,将发送群语音") logger.error(error) } + // 发送群文件 + await this.uploadGroupFile(e, path); + // 删除文件 + await checkAndRemoveFile(path); // 发送语音 - if (musicExt != 'mp4') { + if (musicExt != 'mp4' && this.isSendVocal) { await e.reply(segment.record(path)); } } diff --git a/apps/tools.js b/apps/tools.js index 3637208..b13d7ff 100644 --- a/apps/tools.js +++ b/apps/tools.js @@ -272,6 +272,8 @@ export class tools extends plugin { this.biliCDN = this.toolsConfig.biliCDN; // 加载网易云Cookie this.neteaseCookie = this.toolsConfig.neteaseCookie + // 加载是否转化群语音 + this.isSendVocal = this.toolsConfig.isSendVocal // 加载是否自建服务器 this.useLocalNeteaseAPI = this.toolsConfig.useLocalNeteaseAPI // 加载自建服务器API @@ -1793,7 +1795,7 @@ export class tools extends plugin { // 下载音乐 downloadAudio(url, this.getCurDownloadPath(e), title, 'follow', musicExt).then(async path => { // 发送语音 - if (musicExt != 'mp4') { + if (musicExt != 'mp4' && this.isSendVocal) { await e.reply(segment.record(path)); } // 上传群文件 @@ -2250,7 +2252,9 @@ export class tools extends plugin { // 下载音乐 downloadAudio(url, this.getCurDownloadPath(e), title, 'follow').then(async path => { // 发送语音 - await e.reply(segment.record(path)); + if (this.isSendVocal) { + await e.reply(segment.record(path)); + } // 判断是不是icqq await this.uploadGroupFile(e, path); await checkAndRemoveFile(path); @@ -2382,7 +2386,9 @@ export class tools extends plugin { // 下载音乐 await downloadAudio(url, this.getCurDownloadPath(e), musicInfo, 'follow').then(async path => { // 发送语音 - await e.reply(segment.record(path)); + if (this.isSendVocal) { + await e.reply(segment.record(path)); + } // 判断是不是icqq await this.uploadGroupFile(e, path); await checkAndRemoveFile(path); @@ -2402,7 +2408,9 @@ export class tools extends plugin { // 下载音乐 await downloadAudio(url, this.getCurDownloadPath(e), musicInfo, 'follow').then(async path => { // 发送语音 - await e.reply(segment.record(path)); + if (this.isSendVocal) { + await e.reply(segment.record(path)); + } // 判断是不是icqq await this.uploadGroupFile(e, path); await checkAndRemoveFile(path); diff --git a/config/tools.yaml b/config/tools.yaml index aa972c8..ac62303 100644 --- a/config/tools.yaml +++ b/config/tools.yaml @@ -24,6 +24,7 @@ biliResolution: 1 # 哔哩哔哩的下载画质,0为原画,1为清晰画,2 useLocalNeteaseAPI: false # 是否使用网易云解析自建API useNeteaseSongRequest: false # 是否开启网易云点歌功能 +isSendVocal: true # 是否开启发送群语音 songRequestMaxList: 10 # 网易云点歌请求最大列表数 neteaseCookie: '' # 网易云ck neteaseCloudAPIServer: '' # 网易云自建服务器地址 diff --git a/guoba.support.js b/guoba.support.js index e004404..6309fa3 100644 --- a/guoba.support.js +++ b/guoba.support.js @@ -268,6 +268,14 @@ export function supportGuoba() { component: "Switch", required: false, }, + { + field: "tools.isSendVocal", + label: "开启转语音", + bottomHelpMessage: + "默认开启,识别音乐之后是否转化群语音发送,关闭将获得一定的性能提升", + component: "Switch", + required: false, + }, { field: "tools.songRequestMaxList", label: "点歌列表长度",