Merge pull request #43 from nikoyoke1/master

 faet: 新增语音开关[#42]
This commit is contained in:
Zhiyu 2024-11-06 11:15:20 +08:00 committed by GitHub
commit acfa39520a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 28 additions and 5 deletions

View File

@ -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));
}
}

View File

@ -270,6 +270,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
@ -1791,7 +1793,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));
}
// 上传群文件
@ -2248,7 +2250,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);
@ -2380,7 +2384,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);
@ -2400,7 +2406,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);

View File

@ -24,6 +24,7 @@ biliResolution: 1 # 哔哩哔哩的下载画质0为原画1为清晰画2
useLocalNeteaseAPI: false # 是否使用网易云解析自建API
useNeteaseSongRequest: false # 是否开启网易云点歌功能
isSendVocal: true # 是否开启发送群语音
songRequestMaxList: 10 # 网易云点歌请求最大列表数
neteaseCookie: '' # 网易云ck
neteaseCloudAPIServer: '' # 网易云自建服务器地址

View File

@ -268,6 +268,14 @@ export function supportGuoba() {
component: "Switch",
required: false,
},
{
field: "tools.isSendVocal",
label: "开启转语音",
bottomHelpMessage:
"默认开启,识别音乐之后是否转化群语音发送,关闭将获得一定的性能提升",
component: "Switch",
required: false,
},
{
field: "tools.songRequestMaxList",
label: "点歌列表长度",