mirror of
https://github.com/Jerryplusy/rc-plugin.git
synced 2025-10-14 16:19:18 +00:00
🌈 style: 整理代码
This commit is contained in:
parent
ec6248150a
commit
47ec00a057
@ -17,7 +17,7 @@ import Translate from "../utils/trans-strategy.js";
|
|||||||
import { getXB } from "../utils/x-bogus.js";
|
import { getXB } from "../utils/x-bogus.js";
|
||||||
import { getVideoInfo } from "../utils/biliInfo.js";
|
import { getVideoInfo } from "../utils/biliInfo.js";
|
||||||
import { getBiliGptInputText } from "../utils/biliSummary.js";
|
import { getBiliGptInputText } from "../utils/biliSummary.js";
|
||||||
import {getBodianAudio, getBodianMv, getBodianMusicInfo} from "../utils/bodian.js";
|
import { getBodianAudio, getBodianMv, getBodianMusicInfo } from "../utils/bodian.js";
|
||||||
import { ChatGPTClient } from "@waylaidwanderer/chatgpt-api";
|
import { ChatGPTClient } from "@waylaidwanderer/chatgpt-api";
|
||||||
|
|
||||||
export class tools extends plugin {
|
export class tools extends plugin {
|
||||||
@ -915,27 +915,33 @@ export class tools extends plugin {
|
|||||||
async bodianMusic(e) {
|
async bodianMusic(e) {
|
||||||
// 音频例子:https://h5app.kuwo.cn/m/bodian/playMusic.html?uid=3216773&musicId=192015898&opusId=&extendType=together
|
// 音频例子:https://h5app.kuwo.cn/m/bodian/playMusic.html?uid=3216773&musicId=192015898&opusId=&extendType=together
|
||||||
// 视频例子:https://h5app.kuwo.cn/m/bodian/play.html?uid=3216773&mvId=118987&opusId=770096&extendType=together
|
// 视频例子:https://h5app.kuwo.cn/m/bodian/play.html?uid=3216773&mvId=118987&opusId=770096&extendType=together
|
||||||
const id = /(?=musicId).*?(?=&)/.exec(e.msg.trim())?.[0].replace("musicId=", "")
|
const id =
|
||||||
|| /(?=mvId).*?(?=&)/.exec(e.msg.trim())?.[0].replace("mvId=", "");
|
/(?=musicId).*?(?=&)/.exec(e.msg.trim())?.[0].replace("musicId=", "") ||
|
||||||
const {name, album, artist, albumPic120, categorys} = await getBodianMusicInfo(id)
|
/(?=mvId).*?(?=&)/.exec(e.msg.trim())?.[0].replace("mvId=", "");
|
||||||
e.reply([`识别:波点音乐,${name}-${album}-${artist}\n标签:${categorys.map(item=>item.name).join(" | ")}`, segment.image(albumPic120)])
|
const { name, album, artist, albumPic120, categorys } = await getBodianMusicInfo(id);
|
||||||
|
e.reply([
|
||||||
|
`识别:波点音乐,${name}-${album}-${artist}\n标签:${categorys
|
||||||
|
.map(item => item.name)
|
||||||
|
.join(" | ")}`,
|
||||||
|
segment.image(albumPic120),
|
||||||
|
]);
|
||||||
if (e.msg.includes("musicId")) {
|
if (e.msg.includes("musicId")) {
|
||||||
const path = `${this.defaultPath}${this.e.group_id || this.e.user_id}`
|
const path = `${this.defaultPath}${this.e.group_id || this.e.user_id}`;
|
||||||
await getBodianAudio(id, path).then(_ => {
|
await getBodianAudio(id, path).then(_ => {
|
||||||
Bot.acquireGfs(e.group_id).upload(
|
Bot.acquireGfs(e.group_id).upload(
|
||||||
fs.readFileSync(path+"/temp.mp3"),
|
fs.readFileSync(path + "/temp.mp3"),
|
||||||
"/",
|
"/",
|
||||||
`${name}-${album}-${artist}.mp3`,
|
`${name}-${album}-${artist}.mp3`,
|
||||||
);
|
);
|
||||||
})
|
});
|
||||||
} else if (e.msg.includes("mvId")) {
|
} else if (e.msg.includes("mvId")) {
|
||||||
await getBodianMv(id).then(res => {
|
await getBodianMv(id).then(res => {
|
||||||
// 下载 && 发送
|
// 下载 && 发送
|
||||||
const { coverUrl, highUrl, lowUrl, shortLowUrl } = res
|
const { coverUrl, highUrl, lowUrl, shortLowUrl } = res;
|
||||||
this.downloadVideo(lowUrl).then(path => {
|
this.downloadVideo(lowUrl).then(path => {
|
||||||
e.reply(segment.video(path + "/temp.mp4"));
|
e.reply(segment.video(path + "/temp.mp4"));
|
||||||
});
|
});
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user