mirror of
https://github.com/Jerryplusy/rc-plugin.git
synced 2025-10-14 16:19:18 +00:00
🦄 reactor: 支持发送音乐卡片
This commit is contained in:
parent
5dbf6f13af
commit
a294bcd3bb
@ -45,7 +45,7 @@ export class songRequest extends plugin {
|
|||||||
|
|
||||||
async pickSong(e) {
|
async pickSong(e) {
|
||||||
// 判断功能是否开启
|
// 判断功能是否开启
|
||||||
if(!this.useNeteaseSongRequest) {
|
if (!this.useNeteaseSongRequest) {
|
||||||
logger.info('当前未开启网易云点歌')
|
logger.info('当前未开启网易云点歌')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -58,7 +58,7 @@ export class songRequest extends plugin {
|
|||||||
const saveId = songInfo.findIndex(item => item.group_id === e.group.group_id)
|
const saveId = songInfo.findIndex(item => item.group_id === e.group.group_id)
|
||||||
let musicDate = { 'group_id': group_id, data: [] }
|
let musicDate = { 'group_id': group_id, data: [] }
|
||||||
// 获取搜索歌曲列表信息
|
// 获取搜索歌曲列表信息
|
||||||
let searchUrl = autoSelectNeteaseApi + '/search?keywords={}&limit='+ this.songRequestMaxList //搜索API
|
let searchUrl = autoSelectNeteaseApi + '/search?keywords={}&limit=' + this.songRequestMaxList //搜索API
|
||||||
let detailUrl = autoSelectNeteaseApi + "/song/detail?ids={}" //歌曲详情API
|
let detailUrl = autoSelectNeteaseApi + "/song/detail?ids={}" //歌曲详情API
|
||||||
if (e.msg.replace(/\s+/g, "").match(/点歌(.+)/)) {
|
if (e.msg.replace(/\s+/g, "").match(/点歌(.+)/)) {
|
||||||
const songKeyWord = e.msg.replace(/\s+/g, "").match(/点歌(.+)/)[1]
|
const songKeyWord = e.msg.replace(/\s+/g, "").match(/点歌(.+)/)[1]
|
||||||
@ -121,7 +121,7 @@ export class songRequest extends plugin {
|
|||||||
|
|
||||||
// 播放策略
|
// 播放策略
|
||||||
async playSong(e) {
|
async playSong(e) {
|
||||||
if(!this.useNeteaseSongRequest) {
|
if (!this.useNeteaseSongRequest) {
|
||||||
logger.info('当前未开启网易云点歌')
|
logger.info('当前未开启网易云点歌')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -275,10 +275,31 @@ export class songRequest extends plugin {
|
|||||||
let musicExt = resp.data.data?.[0]?.type
|
let musicExt = resp.data.data?.[0]?.type
|
||||||
// 下载音乐
|
// 下载音乐
|
||||||
downloadAudio(url, this.getCurDownloadPath(e), title, 'follow', musicExt).then(async path => {
|
downloadAudio(url, this.getCurDownloadPath(e), title, 'follow', musicExt).then(async path => {
|
||||||
|
try {
|
||||||
|
await e.bot.sendApi('send_group_msg', {
|
||||||
|
group_id: e.group.group_id,
|
||||||
|
message: [
|
||||||
|
{
|
||||||
|
type: 'music',
|
||||||
|
data: {
|
||||||
|
type: '163',
|
||||||
|
id: songInfo[pickNumber].id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
// 发送语音
|
// 发送语音
|
||||||
|
if (error.error.message) {
|
||||||
|
logger.error("发送卡片错误错误:", error.error.message, '发送群语音');
|
||||||
|
} else {
|
||||||
|
logger.error("发送卡片错误错误,请查看控制台报错,将发送群语音")
|
||||||
|
logger.error(error)
|
||||||
|
}
|
||||||
if (musicExt != 'mp4') {
|
if (musicExt != 'mp4') {
|
||||||
await e.reply(segment.record(path));
|
await e.reply(segment.record(path));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// 上传群文件
|
// 上传群文件
|
||||||
await this.uploadGroupFile(e, path);
|
await this.uploadGroupFile(e, path);
|
||||||
// 删除文件
|
// 删除文件
|
||||||
|
Loading…
x
Reference in New Issue
Block a user