From ec147c0317aabbae83dd23c5e5459925f546efbe Mon Sep 17 00:00:00 2001 From: zhiyu1998 Date: Fri, 17 Mar 2023 23:38:42 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9E=20fix:=20=E8=A7=A3=E5=86=B3netease?= =?UTF-8?q?=E7=99=BB=E5=BD=95=E5=90=8E=E6=97=A0=E6=B3=95=E8=AF=86=E5=88=AB?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/neteasepro.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/neteasepro.js b/apps/neteasepro.js index 8ce20ef..318aeee 100644 --- a/apps/neteasepro.js +++ b/apps/neteasepro.js @@ -30,7 +30,7 @@ export class neteasepro extends plugin { rule: [ { /** 命令正则匹配 */ - reg: "#网易云登陆", + reg: "#网易云登录", /** 执行方法 */ fnc: "neteaseCloudLogin", }, @@ -72,7 +72,7 @@ export class neteasepro extends plugin { } else { // 已经登陆过的,直接从redis取出 neteaseCookie = await store2ha1( - JSON.parse(await redis.get(await this.getRedisKey(e.user_id))).cookie, + JSON.parse(await redis.get(await this.getRedisKey(e.user_id))).cookie ); } // 获取用户信息 @@ -151,8 +151,8 @@ export class neteasepro extends plugin { const musicUrlReg = /(http:|https:)\/\/music.163.com\/song\/media\/outer\/url\?id=(\d+)/; const musicUrlReg2 = /(http:|https:)\/\/y.music.163.com\/m\/song\?(.*)&id=(\d+)/; const id = - musicUrlReg2.exec(message)[3] || - musicUrlReg.exec(message)[2] || + musicUrlReg2.exec(message)?.[3] || + musicUrlReg.exec(message)?.[2] || /id=(\d+)/.exec(message)[1]; // 是游客 if (!(await redis.get(await this.getRedisKey(e.user_id)))) { @@ -212,7 +212,7 @@ export class neteasepro extends plugin { async aopBefore(e) { // 取出cookie let userInfo = JSON.parse(await redis.get(await this.getRedisKey(e.user_id))); - const cookie = userInfo.cookie; + const cookie = userInfo?.cookie; // 如果不存在cookie if (!cookie) { e.reply("请先#网易云登录");