🌈 style: 格式化代码

This commit is contained in:
zhiyu1998 2023-03-18 01:34:40 +08:00
parent 68edefe056
commit 94350812ce

View File

@ -75,13 +75,11 @@ export class neteasepro extends plugin {
// 如果cookie存在但是为空 // 如果cookie存在但是为空
if (_.isEmpty(userData)) { if (_.isEmpty(userData)) {
await redis.del(await this.getRedisKey(e.user_id)); await redis.del(await this.getRedisKey(e.user_id));
e.reply("发生已知错误cookie为空请重试 #网易云登录 即可!") e.reply("发生已知错误cookie为空请重试 #网易云登录 即可!");
return; return;
} }
// 已经登陆过的直接从redis取出 // 已经登陆过的直接从redis取出
neteaseCookie = await store2ha1( neteaseCookie = await store2ha1(JSON.parse(userData).cookie);
JSON.parse(userData).cookie
);
} }
// 获取用户信息 // 获取用户信息
const userInfo = await getLoginStatus(neteaseCookie); const userInfo = await getLoginStatus(neteaseCookie);
@ -175,18 +173,16 @@ export class neteasepro extends plugin {
// 非小程序 // 非小程序
const title = await getSongDetail(id).then(res => { const title = await getSongDetail(id).then(res => {
const song = res.songs?.[0]; const song = res.songs?.[0];
return song.length > 0 ? `${song?.name}-${song?.ar?.[0].name}`.replace(/[\/\?<>\\:\*\|".… ]/g, "") : "暂无信息"; return song.length > 0
? `${song?.name}-${song?.ar?.[0].name}`.replace(/[\/\?<>\\:\*\|".… ]/g, "")
: "暂无信息";
}); });
e.reply(`识别:网易云音乐,${title}`); e.reply(`识别:网易云音乐,${title}`);
} }
// 下载游客歌曲 // 下载游客歌曲
this.downloadMp3(`https://music.163.com/song/media/outer/url?id=${id}`, "follow") this.downloadMp3(`https://music.163.com/song/media/outer/url?id=${id}`, "follow")
.then(path => { .then(path => {
Bot.acquireGfs(e.group_id).upload( Bot.acquireGfs(e.group_id).upload(fs.readFileSync(path), "/", `${id}.mp3`);
fs.readFileSync(path),
"/",
`${id}.mp3`,
);
}) })
.catch(err => { .catch(err => {
console.error(`下载音乐失败,错误信息为: ${err.message}`); console.error(`下载音乐失败,错误信息为: ${err.message}`);