feat:新增锅巴配置项

This commit is contained in:
秋刀鱼 2024-11-05 10:12:49 +08:00
parent 29eae820a8
commit 66ea0e2319
3 changed files with 34 additions and 1 deletions

View File

@ -37,17 +37,25 @@ export class songRequest extends plugin {
this.neteaseCloudAudioQuality = this.toolsConfig.neteaseCloudAudioQuality
// 加载识别前缀
this.identifyPrefix = this.toolsConfig.identifyPrefix;
// 加载是否开启网易云点歌功能
this.useNeteaseSongRequest = this.toolsConfig.useNeteaseSongRequest
// 加载点歌列表长度
this.songRequestMaxList = this.toolsConfig.songRequestMaxList
}
async pickSong(e) {
// 判断功能是否开启
if(!this.useNeteaseSongRequest) return
const autoSelectNeteaseApi = await this.pickApi()
// 只在群里可以使用
let group_id = e.group.group_id
if (!group_id) return
// 初始化
let songInfo = await redisGetKey(REDIS_YUNZAI_SONGINFO)
const saveId = songInfo.findIndex(item => item.group_id === e.group.group_id)
let musicDate = { 'group_id': group_id, data: [] }
// 获取搜索歌曲列表信息
let searchUrl = autoSelectNeteaseApi + '/search?keywords={}&limit=10' //搜索API
let searchUrl = autoSelectNeteaseApi + '/search?keywords={}&limit='+ this.songRequestMaxList //搜索API
let detailUrl = autoSelectNeteaseApi + "/song/detail?ids={}" //歌曲详情API
if (e.msg.replace(/\s+/g, "").match(/点歌(.+)/)) {
const songKeyWord = e.msg.replace(/\s+/g, "").match(/点歌(.+)/)[1]
@ -111,6 +119,10 @@ export class songRequest extends plugin {
// 播放策略
async playSong(e) {
if(!this.useNeteaseSongRequest) return
// 只在群里可以使用
let group_id = e.group.group_id
if (!group_id) return
const autoSelectNeteaseApi = await this.pickApi()
let songInfo = []
// 获取搜索歌曲列表信息

View File

@ -23,6 +23,8 @@ biliDownloadMethod: 0 # 哔哩哔哩的下载方式0默认使用原生稳定
biliResolution: 1 # 哔哩哔哩的下载画质0为原画1为清晰画2为流畅画默认为0
useLocalNeteaseAPI: false # 是否使用网易云解析自建API
useNeteaseSongRequest: false # 是否开启网易云点歌功能
songRequestMaxList: 10 # 网易云点歌请求最大列表数
neteaseCookie: '' # 网易云ck
neteaseCloudAPIServer: '' # 网易云自建服务器地址
neteaseCloudAudioQuality: exhigh # 网易云解析最高音质 默认exhigh(极高) 分类standard => 标准,higher => 较高, exhigh=>极高, lossless=>无损, hires=>Hi-Res, jyeffect => 高清环绕声, sky => 沉浸环绕声, dolby => 杜比全景声, jymaster => 超清母带

View File

@ -260,6 +260,25 @@ export function supportGuoba() {
component: "Switch",
required: false,
},
{
field: "tools.useNeteaseSongRequest",
label: "开启网易云点歌功能",
bottomHelpMessage:
"默认不开启建议搭配自建网易云API使用以获得最佳体验",
component: "Switch",
required: false,
},
{
field: "tools.songRequestMaxList",
label: "点歌列表长度",
bottomHelpMessage:
"网易云点歌选择列表长度默认10",
component: "InputNumber",
required: false,
componentProps: {
placeholder: "填入长度",
},
},
{
field: "tools.neteaseCloudAPIServer",
label: "自建网易云API地址",