From 1f0fa8f2907573cd67005e3b98d8992858d78b34 Mon Sep 17 00:00:00 2001 From: Ctrlcvs <1509167646@qq.com> Date: Fri, 12 Aug 2022 08:20:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E7=AD=BE=E5=88=B0=E6=97=B6st?= =?UTF-8?q?oken=E5=A4=B1=E6=95=88=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sign.js | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/apps/sign.js b/apps/sign.js index 282df76..abdeb7e 100644 --- a/apps/sign.js +++ b/apps/sign.js @@ -129,10 +129,19 @@ export async function mysSign(e) { START = moment().unix(); let resultMessage = ""; let resObj=await mysSeach(e) - if(resObj.data.can_get_points===0){ + if(resObj?.data?.can_get_points===0){ resultMessage+=`今日米游币任务已完成~\n请勿重复操作\n当前米游币总持有数量为:${resObj.data.total_points}`; await replyMsg(e, resultMessage); return true + }else if(!resObj?.data){ + resultMessage+=`登录Stoken失效请重新获取cookies保存~`; + await replyMsg(e, resultMessage); + fs.unlink(`${YamlDataUrl}/${e.user_id}.yaml`,function(error){ + if(error){ + return "" + } + }) + return true; } // Execute task let msg = e.msg.replace(/#|签到|井|米游社|mys|社区/g, ""); @@ -219,11 +228,20 @@ export async function bbsSeach(e){ START = moment().unix(); let miHoYoApi = new MihoYoApi(e); if (Object.keys((await miHoYoApi.getStoken(e.user_id))).length == 0) { - await replyMsg(e, "未读取到stoken请检查cookies是否包含login_ticket,请先绑定stoken再查询~"); - await cookiesDocHelp(e); + let cookiesDoc = await getcookiesDoc() + await replyMsg(e, "未读取到stoken请检查cookies是否包含login_ticket,请先绑定stoken再查询~\n"+cookiesDoc); return true; } let resObj=await mysSeach(e) + if(!resObj?.data){ + await replyMsg(e, `登录Stoken失效请重新获取cookies保存~`); + fs.unlink(`${YamlDataUrl}/${e.user_id}.yaml`,function(error){ + if(error){ + return "" + } + }) + return true; + } await replyMsg(e,`当前米游币数量为:${resObj.data.total_points},今日剩余可获取:${resObj.data.can_get_points}`); return true; }