mirror of
https://github.com/Jerryplusy/rc-plugin.git
synced 2025-10-14 16:19:18 +00:00
Merge branch 'dev' of https://github.com/zhiyu1998/rconsole-plugin into dev
This commit is contained in:
commit
4ee740d14d
@ -94,11 +94,11 @@ export class songRequest extends plugin {
|
|||||||
// 获取自定义API
|
// 获取自定义API
|
||||||
const autoSelectNeteaseApi = await this.pickApi()
|
const autoSelectNeteaseApi = await this.pickApi()
|
||||||
// 只在群里可以使用
|
// 只在群里可以使用
|
||||||
let group_id = e.group.group_id
|
let group_id = e.group_id
|
||||||
if (!group_id) return
|
if (!group_id) return
|
||||||
// 初始化
|
// 初始化
|
||||||
let songInfo = await redisGetKey(REDIS_YUNZAI_SONGINFO) || []
|
let songInfo = await redisGetKey(REDIS_YUNZAI_SONGINFO) || []
|
||||||
const saveId = songInfo.findIndex(item => item.group_id === e.group.group_id)
|
const saveId = songInfo.findIndex(item => item.group_id === e.group_id)
|
||||||
let musicDate = { 'group_id': group_id, data: [] }
|
let musicDate = { 'group_id': group_id, data: [] }
|
||||||
// 获取搜索歌曲列表信息
|
// 获取搜索歌曲列表信息
|
||||||
let detailUrl = autoSelectNeteaseApi + "/song/detail?ids={}&time=" + Date.now() //歌曲详情API
|
let detailUrl = autoSelectNeteaseApi + "/song/detail?ids={}&time=" + Date.now() //歌曲详情API
|
||||||
@ -179,10 +179,10 @@ export class songRequest extends plugin {
|
|||||||
} else if (await redisGetKey(REDIS_YUNZAI_SONGINFO) != []) {
|
} else if (await redisGetKey(REDIS_YUNZAI_SONGINFO) != []) {
|
||||||
if (e.msg.replace(/\s+/g, "").match(/^#听(\d+)/)) {
|
if (e.msg.replace(/\s+/g, "").match(/^#听(\d+)/)) {
|
||||||
const pickNumber = e.msg.replace(/\s+/g, "").match(/^#听(\d+)/)[1] - 1
|
const pickNumber = e.msg.replace(/\s+/g, "").match(/^#听(\d+)/)[1] - 1
|
||||||
let group_id = e.group.group_id
|
let group_id = e.group_id
|
||||||
if (!group_id) return
|
if (!group_id) return
|
||||||
let songInfo = await redisGetKey(REDIS_YUNZAI_SONGINFO)
|
let songInfo = await redisGetKey(REDIS_YUNZAI_SONGINFO)
|
||||||
const saveId = songInfo.findIndex(item => item.group_id === e.group.group_id)
|
const saveId = songInfo.findIndex(item => item.group_id === e.group_id)
|
||||||
const AUTO_NETEASE_SONG_DOWNLOAD = autoSelectNeteaseApi + "/song/url/v1?id={}&level=" + this.neteaseCloudAudioQuality;
|
const AUTO_NETEASE_SONG_DOWNLOAD = autoSelectNeteaseApi + "/song/url/v1?id={}&level=" + this.neteaseCloudAudioQuality;
|
||||||
const pickSongUrl = AUTO_NETEASE_SONG_DOWNLOAD.replace("{}", songInfo[saveId].data[pickNumber].id)
|
const pickSongUrl = AUTO_NETEASE_SONG_DOWNLOAD.replace("{}", songInfo[saveId].data[pickNumber].id)
|
||||||
const songWikiUrl = autoSelectNeteaseApi + '/song/wiki/summary?id=' + songInfo[saveId].data[pickNumber].id
|
const songWikiUrl = autoSelectNeteaseApi + '/song/wiki/summary?id=' + songInfo[saveId].data[pickNumber].id
|
||||||
@ -202,7 +202,7 @@ export class songRequest extends plugin {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
// 只在群里可以使用
|
// 只在群里可以使用
|
||||||
let group_id = e.group.group_id
|
let group_id = e.group_id
|
||||||
if (!group_id) return
|
if (!group_id) return
|
||||||
const autoSelectNeteaseApi = await this.pickApi()
|
const autoSelectNeteaseApi = await this.pickApi()
|
||||||
let songInfo = []
|
let songInfo = []
|
||||||
@ -528,10 +528,10 @@ export class songRequest extends plugin {
|
|||||||
const userInfo = res.data.data.profile
|
const userInfo = res.data.data.profile
|
||||||
await config.updateField("tools", "neteaseUserId", res.data.data.profile.userId);
|
await config.updateField("tools", "neteaseUserId", res.data.data.profile.userId);
|
||||||
if (userInfo) {
|
if (userInfo) {
|
||||||
logger.info('ck活着,使用ck进行高音质下载')
|
logger.info('[R插件][ncm-Cookie检测]ck活着,使用ck进行高音质下载')
|
||||||
status = true
|
status = true
|
||||||
} else {
|
} else {
|
||||||
logger.info('ck失效,将启用临时接口下载')
|
logger.info('[R插件][ncm-Cookie检测]ck失效,将启用临时接口下载')
|
||||||
status = false
|
status = false
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -636,8 +636,8 @@ export class songRequest extends plugin {
|
|||||||
// 发送卡片
|
// 发送卡片
|
||||||
await sendMusicCard(e, '163', songInfo[pickNumber].id)
|
await sendMusicCard(e, '163', songInfo[pickNumber].id)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error.error.message) {
|
if (error.message) {
|
||||||
logger.error("发送卡片错误错误:", error.error.message, '发送群语音');
|
logger.error("发送卡片错误错误:", error.message, '发送群语音');
|
||||||
} else {
|
} else {
|
||||||
logger.error("发送卡片错误错误,请查看控制台报错,将发送群语音")
|
logger.error("发送卡片错误错误,请查看控制台报错,将发送群语音")
|
||||||
logger.error(error)
|
logger.error(error)
|
||||||
|
@ -1693,10 +1693,10 @@ export class tools extends plugin {
|
|||||||
}).then(res => {
|
}).then(res => {
|
||||||
const userInfo = res.data.data.profile
|
const userInfo = res.data.data.profile
|
||||||
if (userInfo) {
|
if (userInfo) {
|
||||||
logger.info('ck活着,使用ck进行高音质下载')
|
logger.info('[R插件][netease]ck活着,使用ck进行高音质下载')
|
||||||
return true
|
return true
|
||||||
} else {
|
} else {
|
||||||
logger.info('ck失效,将启用临时接口下载')
|
logger.info('[R插件][netease]ck失效,将启用临时接口下载')
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -21,7 +21,7 @@ export function textArrayToMakeForward(e, textArray) {
|
|||||||
*/
|
*/
|
||||||
export async function sendMusicCard(e, platformType, musicId) {
|
export async function sendMusicCard(e, platformType, musicId) {
|
||||||
await e.bot.sendApi('send_group_msg', {
|
await e.bot.sendApi('send_group_msg', {
|
||||||
group_id: e.group.group_id,
|
group_id: e.group_id,
|
||||||
message: [
|
message: [
|
||||||
{
|
{
|
||||||
type: 'music',
|
type: 'music',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user