diff --git a/apps/abyss.js b/apps/abyss.js index 09d6acd..e911743 100644 --- a/apps/abyss.js +++ b/apps/abyss.js @@ -32,8 +32,7 @@ export class Abyss extends ZZZPlugin { throw e; }); if (!abyssData?.has_data) { - await this.reply('没有式舆防卫战数据'); - return false; + return this.reply('没有式舆防卫战数据'); } const abyss = new ZZZChallenge(abyssData); const timer = setTimeout(() => { diff --git a/apps/calendar.js b/apps/calendar.js index 5793cf6..8eeb768 100644 --- a/apps/calendar.js +++ b/apps/calendar.js @@ -26,8 +26,7 @@ export class Calendar extends ZZZPlugin { ) .then(res => res.json()); if (!activityList?.data) { - await this.reply('获取活动列表失败'); - return false; + return this.reply('获取活动列表失败'); } const t = activityList?.data?.t || new Date().getTime().toString(); const activityContent = await request @@ -42,8 +41,7 @@ export class Calendar extends ZZZPlugin { const htmlContent = calendarContent?.content || ''; if (!htmlContent) { - await this.reply('未找到活动日历'); - return false; + return this.reply('未找到活动日历'); } const imgReg = //g; const imgSrc = imgReg.exec(htmlContent)?.[1]; @@ -52,6 +50,5 @@ export class Calendar extends ZZZPlugin { } else { await this.reply('未找到活动日历图片'); } - return false; } } diff --git a/apps/code.js b/apps/code.js index 36dd20f..6b5b849 100644 --- a/apps/code.js +++ b/apps/code.js @@ -21,7 +21,6 @@ export class Code extends ZZZPlugin { } async code() { const msg = await getCodeMsg(); - await this.reply(msg); - return false; + return this.reply(msg); } } diff --git a/apps/deadly.js b/apps/deadly.js index a38317b..ab6b3c6 100644 --- a/apps/deadly.js +++ b/apps/deadly.js @@ -32,8 +32,7 @@ export class deadly extends ZZZPlugin { throw e; }); if (!deadlyData?.has_data) { - await this.reply('没有危局强袭战数据'); - return false; + return this.reply('没有危局强袭战数据'); } const deadly = new Deadly(deadlyData); const timer = setTimeout(() => { diff --git a/apps/gachalog.js b/apps/gachalog.js index 3da2a17..a880e9f 100644 --- a/apps/gachalog.js +++ b/apps/gachalog.js @@ -61,15 +61,14 @@ export class GachaLog extends ZZZPlugin { if (!this.e.isPrivate) { const currentGroup = this.e?.group_id; if (!currentGroup) { - await this.reply('获取群聊ID失败,请尝试私聊发送抽卡链接', false, { + return this.reply('获取群聊ID失败,请尝试私聊发送抽卡链接', false, { at: true, recallMsg: 100, }); - return false; } if (!allowGroup) { if (whiteList.length <= 0 || !whiteList?.includes(currentGroup)) { - await this.reply( + return this.reply( '当前群聊未开启链接刷新抽卡记录功能,请私聊发送', false, { @@ -77,11 +76,10 @@ export class GachaLog extends ZZZPlugin { recallMsg: 100, } ); - return false; } } else { if (blackList.length > 0 && blackList?.includes(currentGroup)) { - await this.reply( + return this.reply( '当前群聊未开启链接刷新抽卡记录功能,请私聊发送', false, { @@ -89,7 +87,6 @@ export class GachaLog extends ZZZPlugin { recallMsg: 100, } ); - return false; } } await this.reply( @@ -108,20 +105,18 @@ export class GachaLog extends ZZZPlugin { async gachaLog() { const msg = this.e.msg.trim(); if (msg.includes('取消')) { - await this.reply('已取消', false, { at: true, recallMsg: 100 }); this.finish('gachaLog'); - return false; + return this.reply('已取消', false, { at: true, recallMsg: 100 }); } const key = getQueryVariable(msg, 'authkey'); const region = getQueryVariable(msg, 'region'); const game_biz = getQueryVariable(msg, 'game_biz'); if (!key && !region && !game_biz) { - await this.reply('抽卡链接格式错误,请重新发起%抽卡链接', false, { + this.finish('gachaLog'); + return this.reply('抽卡链接格式错误,请重新发起%抽卡链接', false, { at: true, recallMsg: 100, }); - this.finish('gachaLog'); - return false; } this.finish('gachaLog'); this.getLogWithOutUID(key, region, game_biz); @@ -129,8 +124,7 @@ export class GachaLog extends ZZZPlugin { async refreshGachaLog() { const uid = await this.getUID(); if (/^(1[0-9])[0-9]{8}/i.test(uid)) { - await this.reply('国际服不支持此功能'); - return false; + return this.reply('国际服不支持此功能'); } if (!uid) return false; const lastQueryTime = await redis.get(`ZZZ:GACHA:${uid}:LASTTIME`); @@ -139,12 +133,10 @@ export class GachaLog extends ZZZPlugin { try { const key = await getAuthKey(this.e, this.User, uid); if (!key) { - await this.reply('authKey获取失败,请检查cookie是否过期'); - return false; + return this.reply('authKey获取失败,请检查cookie是否过期'); } if (lastQueryTime && Date.now() - lastQueryTime < 1000 * coldTime) { - await this.reply(`${coldTime}秒内只能刷新一次,请稍后再试`); - return false; + return this.reply(`${coldTime}秒内只能刷新一次,请稍后再试`); } await redis.set(`ZZZ:GACHA:${uid}:LASTTIME`, Date.now()); this.getLog(key); @@ -164,10 +156,9 @@ export class GachaLog extends ZZZPlugin { `${name}新增${count[name] || 0}条记录,一共${data[name].length}条记录` ); } - await this.reply( + return this.reply( await common.makeForwardMsg(this.e, msg.join('\n'), '抽卡记录更新成功') ); - return false; } async getLogWithOutUID(key, region, game_biz) { await this.reply( @@ -195,11 +186,10 @@ export class GachaLog extends ZZZPlugin { } } if (!uid) { - await this.reply('未查询到uid,请检查链接是否正确', false, { + return this.reply('未查询到uid,请检查链接是否正确', false, { at: true, recallMsg: 100, }); - return false; } const { data, count } = await updateGachaLog(key, uid, region, game_biz); let msg = []; @@ -209,10 +199,9 @@ export class GachaLog extends ZZZPlugin { `${name}新增${count[name] || 0}条记录,一共${data[name].length}条记录` ); } - await this.reply( + return this.reply( await common.makeForwardMsg(this.e, msg, '抽卡记录更新成功') ); - return false; } async gachaLogAnalysis() { @@ -225,7 +214,7 @@ export class GachaLog extends ZZZPlugin { }); const data = await anaylizeGachaLog(uid); if (!data) { - await this.reply( + return this.reply( '未查询到抽卡记录,请先发送抽卡链接或%更新抽卡记录', false, { @@ -233,7 +222,6 @@ export class GachaLog extends ZZZPlugin { recallMsg: 100, } ); - return false; } const result = { data, @@ -243,18 +231,15 @@ export class GachaLog extends ZZZPlugin { async getGachaLink() { const uid = await this.getUID(); if (/^(1[0-9])[0-9]{8}/i.test(uid)) { - await this.reply('国际服不支持此功能'); - return false; + return this.reply('国际服不支持此功能'); } if (!uid) return false; if (!this.e.isPrivate || this.e.isGroup) { - await this.reply('请私聊获取抽卡链接', false, { at: true }); - return false; + return this.reply('请私聊获取抽卡链接', false, { at: true }); } const key = await getAuthKey(this.e, this.User, uid); if (!key) { - await this.reply('authKey获取失败,请检查cookie是否过期'); - return false; + return this.reply('authKey获取失败,请检查cookie是否过期'); } const link = await getZZZGachaLink(key); await this.reply(link); diff --git a/apps/guide.js b/apps/guide.js index 82fdd1c..b18f136 100644 --- a/apps/guide.js +++ b/apps/guide.js @@ -69,8 +69,7 @@ export class Guide extends ZZZPlugin { } group = Number(group); if (group > guides.guideMaxNum) { - await this.reply(`超过攻略数量(${guides.guideMaxNum})`); - return false; + return this.reply(`超过攻略数量(${guides.guideMaxNum})`); } if (alias === '设置默认' || alias === '设置所有') { return false; @@ -79,8 +78,7 @@ export class Guide extends ZZZPlugin { const name = char.aliasToName(alias); if (!name) { - await this.reply('该角色不存在'); - return false; + return this.reply('该角色不存在'); } if (group === 0) { @@ -102,20 +100,17 @@ export class Guide extends ZZZPlugin { if (msg.length) { await this.reply(await common.makeForwardMsg(this.e, msg)); } - return false; } const guidePath = await this.getGuidePath(group, name, !!isUpdate); if (!guidePath) { - this.e.reply( + return this.e.reply( `暂无${name}攻略 (${ guides.guideSources[group - 1] })\n请尝试其他的攻略来源查询` ); - return false; } await this.e.reply(segment.image(guidePath)); - return false; } /** 下载攻略图 */ @@ -128,9 +123,8 @@ export class Guide extends ZZZPlugin { try { mysRes = await Promise.all(mysRes); } catch (error) { - this.e.reply('暂无攻略数据,请稍后再试'); console.log(`米游社接口报错:${error}}`); - return false; + return this.e.reply('暂无攻略数据,请稍后再试'); } // 搜索时过滤特殊符号,譬如「11号」 diff --git a/apps/help.js b/apps/help.js index 70aa309..e0b2ede 100644 --- a/apps/help.js +++ b/apps/help.js @@ -481,11 +481,9 @@ export class Help extends ZZZPlugin { await this.render('help/index.html', { helpData: _helpData, }); - return false; } await this.render('help/index.html', { helpData, }); - return false; } } diff --git a/apps/manage/alias.js b/apps/manage/alias.js index 3f92cd5..b7b4389 100644 --- a/apps/manage/alias.js +++ b/apps/manage/alias.js @@ -3,8 +3,7 @@ import settings from '../../lib/settings.js'; export async function addAlias() { if (!this.e.isMaster) { - this.reply('仅限主人设置', false, { at: true, recallMsg: 100 }); - return false; + return this.reply('仅限主人设置', false, { at: true, recallMsg: 100 }); } const match = /添加(\S+)别名(\S+)$/g.exec(this.e.msg); const key = match[1]; @@ -34,8 +33,7 @@ export async function addAlias() { export async function deleteAlias() { if (!this.e.isMaster) { - this.reply('仅限主人设置', false, { at: true, recallMsg: 100 }); - return false; + return this.reply('仅限主人设置', false, { at: true, recallMsg: 100 }); } const match = /删除别名(\S+)$/g.exec(this.e.msg); const key = match[1]; diff --git a/apps/manage/config.js b/apps/manage/config.js index e6a7161..13938c2 100644 --- a/apps/manage/config.js +++ b/apps/manage/config.js @@ -3,24 +3,21 @@ import settings from '../../lib/settings.js'; /** 设置渲染精度 */ export async function setRenderPrecision() { if (!this.e.isMaster) { - this.reply('仅限主人设置', false, { at: true, recallMsg: 100 }); - return false; + return this.reply('仅限主人设置', false, { at: true, recallMsg: 100 }); } const match = /渲染精度(\d+)$/g.exec(this.e.msg); const render_precision = Number(match[1]); if (render_precision < 50) { - await this.e.reply('渲染精度不能小于50', false, { + return this.e.reply('渲染精度不能小于50', false, { at: true, recallMsg: 100, }); - return false; } if (render_precision > 200) { - await this.e.reply('渲染精度不能大于200', false, { + return this.e.reply('渲染精度不能大于200', false, { at: true, recallMsg: 100, }); - return false; } settings.setSingleConfig('config', 'render', { scale: render_precision, @@ -31,24 +28,21 @@ export async function setRenderPrecision() { /** 设置刷新抽卡间隔 */ export async function setRefreshGachaInterval() { if (!this.e.isMaster) { - this.reply('仅限主人设置', false, { at: true, recallMsg: 100 }); - return false; + return this.reply('仅限主人设置', false, { at: true, recallMsg: 100 }); } const match = /刷新抽卡间隔(\d+)$/g.exec(this.e.msg); const refresh_gacha_interval = Number(match[1]); if (refresh_gacha_interval < 0) { - await this.e.reply('刷新抽卡间隔不能小于0秒', false, { + return this.e.reply('刷新抽卡间隔不能小于0秒', false, { at: true, recallMsg: 100, }); - return false; } if (refresh_gacha_interval > 1000) { - await this.e.reply('刷新抽卡间隔不能大于1000秒', false, { + return this.e.reply('刷新抽卡间隔不能大于1000秒', false, { at: true, recallMsg: 100, }); - return false; } settings.setSingleConfig('gacha', 'interval', refresh_gacha_interval); await this.e.reply(`绝区零刷新抽卡间隔已设置为: ${refresh_gacha_interval}`); @@ -57,24 +51,21 @@ export async function setRefreshGachaInterval() { /** 设置刷新面板间隔 */ export async function setRefreshPanelInterval() { if (!this.e.isMaster) { - this.reply('仅限主人设置', false, { at: true, recallMsg: 100 }); - return false; + return this.reply('仅限主人设置', false, { at: true, recallMsg: 100 }); } const match = /刷新面板间隔(\d+)$/g.exec(this.e.msg); const refresh_panel_interval = Number(match[1]); if (refresh_panel_interval < 0) { - await this.e.reply('刷新面板间隔不能小于0秒', false, { + return this.e.reply('刷新面板间隔不能小于0秒', false, { at: true, recallMsg: 100, }); - return false; } if (refresh_panel_interval > 1000) { - await this.e.reply('刷新面板间隔不能大于1000秒', false, { + return this.e.reply('刷新面板间隔不能大于1000秒', false, { at: true, recallMsg: 100, }); - return false; } settings.setSingleConfig('panel', 'interval', refresh_panel_interval); await this.e.reply( @@ -87,24 +78,21 @@ export async function setRefreshPanelInterval() { /** 设置角色刷新间隔 */ export async function setRefreshCharInterval() { if (!this.e.isMaster) { - this.reply('仅限主人设置', false, { at: true, recallMsg: 100 }); - return false; + return this.reply('仅限主人设置', false, { at: true, recallMsg: 100 }); } const match = /刷新角色间隔(\d+)$/g.exec(this.e.msg); const refresh_char_interval = Number(match[1]); if (refresh_char_interval < 0) { - await this.e.reply('刷新角色间隔不能小于0秒', false, { + return this.e.reply('刷新角色间隔不能小于0秒', false, { at: true, recallMsg: 100, }); - return false; } if (refresh_char_interval > 1000) { - await this.e.reply('刷新角色间隔不能大于1000秒', false, { + return this.e.reply('刷新角色间隔不能大于1000秒', false, { at: true, recallMsg: 100, }); - return false; } settings.setSingleConfig('panel', 'roleInterval', refresh_char_interval); await this.e.reply(`绝区零刷新角色间隔已设置为: ${refresh_char_interval}秒`); diff --git a/apps/manage/device.js b/apps/manage/device.js index d65f25c..34c87ce 100644 --- a/apps/manage/device.js +++ b/apps/manage/device.js @@ -2,8 +2,7 @@ import settings from '../../lib/settings.js'; export async function setDefaultDevice() { if (!this.e.isMaster) { - this.reply('仅限主人设置', false, { at: true, recallMsg: 100 }); - return false; + return this.reply('仅限主人设置', false, { at: true, recallMsg: 100 }); } this.setContext('toSetDefaultDevice'); await this.reply( @@ -15,19 +14,16 @@ export async function setDefaultDevice() { export async function toSetDefaultDevice() { const msg = this.e.msg.trim(); if (!msg) { - this.reply('请发送设备信息', false, { at: true, recallMsg: 100 }); - return false; + return this.reply('请发送设备信息', false, { at: true, recallMsg: 100 }); } if (msg.includes('取消')) { - await this.reply('已取消', false, { at: true, recallMsg: 100 }); this.finish('toSetDefaultDevice'); - return false; + return this.reply('已取消', false, { at: true, recallMsg: 100 }); } try { const info = JSON.parse(msg); if (!info) { - this.reply('设备信息格式错误', false, { at: true, recallMsg: 100 }); - return false; + return this.reply('设备信息格式错误', false, { at: true, recallMsg: 100 }); } if ( !info?.deviceName || @@ -37,8 +33,7 @@ export async function toSetDefaultDevice() { !info?.deviceFingerprint || !info?.deviceProduct ) { - this.reply('设备信息格式错误', false, { at: true, recallMsg: 100 }); - return false; + return this.reply('设备信息格式错误', false, { at: true, recallMsg: 100 }); } settings.setConfig('device', { productName: info.deviceProduct, diff --git a/apps/manage/guides.js b/apps/manage/guides.js index 05b3fe0..2f29623 100644 --- a/apps/manage/guides.js +++ b/apps/manage/guides.js @@ -4,8 +4,7 @@ import settings from '../../lib/settings.js'; /** 设置默认攻略 */ export async function setDefaultGuide() { if (!this.e.isMaster) { - this.reply('仅限主人设置', false, { at: true, recallMsg: 100 }); - return false; + return this.reply('仅限主人设置', false, { at: true, recallMsg: 100 }); } const match = /设置默认攻略(\d+|all)$/g.exec(this.e.msg); let guide_id = match[1]; @@ -36,24 +35,21 @@ export async function setDefaultGuide() { /** 设置所有攻略显示个数 */ export async function setMaxForwardGuide() { if (!this.e.isMaster) { - this.reply('仅限主人设置', false, { at: true, recallMsg: 100 }); - return false; + return this.reply('仅限主人设置', false, { at: true, recallMsg: 100 }); } const match = /设置所有攻略显示个数(\d+)$/g.exec(this.e.msg); const max_forward_guide = Number(match[1]); if (max_forward_guide < 1) { - await this.e.reply('所有攻略显示个数不能小于1', false, { + return this.e.reply('所有攻略显示个数不能小于1', false, { at: true, recallMsg: 100, }); - return false; } if (max_forward_guide > guides.guideMaxNum) { - await this.e.reply(`所有攻略显示个数不能大于${guides.guideMaxNum}`, false, { + return this.e.reply(`所有攻略显示个数不能大于${guides.guideMaxNum}`, false, { at: true, recallMsg: 100, }); - return false; } settings.setSingleConfig('guide', 'max_forward_guides', max_forward_guide); await this.e.reply( diff --git a/apps/manage/panel.js b/apps/manage/panel.js index dcc45f3..9b0a43e 100644 --- a/apps/manage/panel.js +++ b/apps/manage/panel.js @@ -6,8 +6,7 @@ import fs from 'fs'; import path from 'path'; export async function uploadCharacterImg() { if (!this.e.isMaster) { - this.reply('只有主人才能添加', false, { at: true, recallMsg: 100 }); - return false; + return this.reply('只有主人才能添加', false, { at: true, recallMsg: 100 }); } const reg = /(上传|添加)(.+)(角色|面板)图$/; const match = this.e.msg.match(reg); @@ -17,8 +16,7 @@ export async function uploadCharacterImg() { const charName = match[2].trim(); const name = char.aliasToName(charName); if (!name) { - this.reply('未找到对应角色', false, { at: true, recallMsg: 100 }); - return false; + return this.reply('未找到对应角色', false, { at: true, recallMsg: 100 }); } const images = []; // 下面方法来源于miao-plugin/apps/character/ImgUpload.js @@ -70,12 +68,11 @@ export async function uploadCharacterImg() { } } if (images.length <= 0) { - this.reply( + return this.reply( '消息中未找到图片,请将要发送的图片与消息一同发送或引用要添加的图像。', false, { at: true, recallMsg: 100 } ); - return false; } const resourcesImagesPath = imageResourcesPath; const panelImagesPath = path.join(resourcesImagesPath, `panel/${name}`); @@ -96,11 +93,10 @@ export async function uploadCharacterImg() { failed++; } } - this.reply(`成功上传${success}张图片,失败${failed}张图片。`, false, { + return this.reply(`成功上传${success}张图片,失败${failed}张图片。`, false, { at: true, recallMsg: 100, }); - return false; } export async function getCharacterImages() { @@ -113,8 +109,7 @@ export async function getCharacterImages() { const name = char.aliasToName(charName); let page = match[4]; if (!name) { - this.reply('未找到对应角色', false, { at: true, recallMsg: 100 }); - return false; + return this.reply('未找到对应角色', false, { at: true, recallMsg: 100 }); } const pageSize = 5; const resourcesImagesPath = imageResourcesPath; @@ -131,8 +126,7 @@ export async function getCharacterImages() { const start = (page - 1) * pageSize; const end = page * pageSize; if (start >= images.length) { - this.reply('哪有这么多图片', false, { at: true, recallMsg: 100 }); - return false; + return this.reply('哪有这么多图片', false, { at: true, recallMsg: 100 }); } const imagePaths = images.slice(start, end); const imageMsg = imagePaths.map(imagePath => { @@ -150,14 +144,11 @@ export async function getCharacterImages() { ); if (imageMsg.length) await this.reply(await common.makeForwardMsg(this.e, imageMsg)); - - return false; } export async function deleteCharacterImg() { if (!this.e.isMaster) { - this.reply('只有主人才能删除', false, { at: true, recallMsg: 100 }); - return false; + return this.reply('只有主人才能删除', false, { at: true, recallMsg: 100 }); } const reg = /(删除)(.+)(角色|面板)图(.+)$/; const match = this.e.msg.match(reg); @@ -167,8 +158,7 @@ export async function deleteCharacterImg() { const charName = match[2].trim(); const name = char.aliasToName(charName); if (!name) { - this.reply('未找到对应角色', false, { at: true, recallMsg: 100 }); - return false; + return this.reply('未找到对应角色', false, { at: true, recallMsg: 100 }); } const ids = match[4].split(/[,,、\s]+/); const resourcesImagesPath = imageResourcesPath; @@ -195,6 +185,5 @@ export async function deleteCharacterImg() { failed ? `删除失败ID为${failed.join(',')}` : '无失败ID', '删除后会重新排序ID,若想要再次删除,请重新获取图片列表,否则可能会删除错误的图片。', ]; - this.reply(common.makeForwardMsg(this.e, msgs)); - return false; + return this.reply(common.makeForwardMsg(this.e, msgs)); } diff --git a/apps/manage/version.js b/apps/manage/version.js index 0c17330..700a20b 100644 --- a/apps/manage/version.js +++ b/apps/manage/version.js @@ -54,8 +54,7 @@ export async function hasUpdate() { /** 开启/关闭自动更新推送 */ export async function enableAutoUpdatePush() { if (!this.e.isMaster) { - this.reply('仅限主人设置', false, { at: true, recallMsg: 100 }); - return false; + return this.reply('仅限主人设置', false, { at: true, recallMsg: 100 }); } let enable = true; if (this.e.msg.includes('关闭')) { @@ -72,12 +71,11 @@ export async function enableAutoUpdatePush() { /** 设置自动更新时间 */ export async function setCheckUpdateCron() { if (!this.e.isMaster) { - this.reply('仅限主人设置', false, { at: true, recallMsg: 100 }); - return false; + return this.reply('仅限主人设置', false, { at: true, recallMsg: 100 }); } const cron = this.e.msg.split('时间')[1]; if (!cron) { - await this.reply( + return this.reply( `[${pluginName}]设置自动更新频率失败,无cron表达式`, false, { @@ -85,7 +83,6 @@ export async function setCheckUpdateCron() { recallMsg: 100, } ); - return false; } settings.setSingleConfig('config', 'update', { cron }); await this.reply(`[${pluginName}]自动更新频率已设置为${cron}`, false, { diff --git a/apps/monthly.js b/apps/monthly.js index bbe8e55..beaa470 100644 --- a/apps/monthly.js +++ b/apps/monthly.js @@ -30,8 +30,7 @@ export class monthly extends ZZZPlugin { ); const match = this.e.msg.match(reg); if (!match) { - await this.reply('参数错误,请检查输入'); - return false; + return this.reply('参数错误,请检查输入'); } let year = match[3]; let month = match[5]; @@ -46,12 +45,10 @@ export class monthly extends ZZZPlugin { throw e; }); if (!monthlyResponse) { - await this.reply('获取月报数据失败,请检查日期是否正确'); - return false; + return this.reply('获取月报数据失败,请检查日期是否正确'); } if (!monthlyResponse?.month_data) { - await this.reply('月报数据为空'); - return false; + return this.reply('月报数据为空'); } const monthlyData = new Monthly(monthlyResponse); const finalData = { @@ -72,8 +69,7 @@ export class monthly extends ZZZPlugin { }); if (!collect) { - await this.reply('获取月报数据失败'); - return false; + return this.reply('获取月报数据失败'); } const collectData = collect.map(item => new Monthly(item)); diff --git a/apps/panel.js b/apps/panel.js index 2175a9d..c1830db 100644 --- a/apps/panel.js +++ b/apps/panel.js @@ -60,8 +60,7 @@ export class Panel extends ZZZPlugin { const panelSettings = settings.getConfig('panel'); const coldTime = _.get(panelSettings, 'interval', 300); if (lastQueryTime && Date.now() - lastQueryTime < 1000 * coldTime) { - await this.reply(`${coldTime}秒内只能更新一次,请稍后再试`); - return false; + return this.reply(`${coldTime}秒内只能更新一次,请稍后再试`); } const isEnka = this.e.msg.includes('展柜') || !(await getCk(this.e)) let result @@ -115,8 +114,7 @@ export class Panel extends ZZZPlugin { const uid = await this.getUID(); const result = getPanelList(uid); if (!result.length) { - await this.reply(`UID:${uid}无本地面板数据,请先%更新面板 或 %更新展柜面板`); - return false; + return this.reply(`UID:${uid}无本地面板数据,请先%更新面板 或 %更新展柜面板`); } const hasCk = !!(await getCk(this.e)); await this.getPlayerInfo(hasCk ? undefined : parsePlayerInfo({ uid })); @@ -169,7 +167,6 @@ export class Panel extends ZZZPlugin { needSave: false, }); } - return false; } async getCharPanelTool(e, _data = {}) { @@ -184,12 +181,10 @@ export class Panel extends ZZZPlugin { needImg = true } = _data; if (!uid) { - await this.reply('UID为空'); - return false; + return this.reply('UID为空'); } if (!data) { - await this.reply('数据为空'); - return false; + return this.reply('数据为空'); } if (needSave) { updatePanelData(uid, [data]); @@ -235,8 +230,7 @@ export class Panel extends ZZZPlugin { const uid = await this.getUID(); const result = getPanelList(uid); if (!result) { - await this.reply('未找到面板数据,请先%更新面板 或 %更新展柜面板'); - return false; + return this.reply('未找到面板数据,请先%更新面板 或 %更新展柜面板'); } await this.getPlayerInfo(); result.sort((a, b) => { @@ -293,15 +287,12 @@ export class Panel extends ZZZPlugin { } const id = source?.message_id; if (!id) { - await this.reply('未找到消息源,请引用要查看的图片'); - return false; + return this.reply('未找到消息源,请引用要查看的图片'); } const image = await redis.get(`ZZZ:PANEL:IMAGE:${id}`); if (!image) { - await this.reply('未找到原图'); - return false; + return this.reply('未找到原图'); } await this.reply(segment.image(image)); - return false; } } diff --git a/apps/user.js b/apps/user.js index bb32b7d..1c440b3 100644 --- a/apps/user.js +++ b/apps/user.js @@ -30,8 +30,7 @@ export class User extends ZZZPlugin { async bindDevice() { const uid = await this.getUID(); if (/^(1[0-9])[0-9]{8}/i.test(uid)) { - await this.reply('国际服不需要绑定设备'); - return false; + return this.reply('国际服不需要绑定设备'); } //先throw一步( this.setContext('toBindDevice'); @@ -44,32 +43,27 @@ export class User extends ZZZPlugin { async toBindDevice() { const ltuid = await this.getLtuid(); if (!ltuid) { - this.reply('未绑定UID'); this.finish('toBindDevice'); - return false; + return this.reply('未绑定UID'); } const msg = this.e.msg.trim(); if (!msg) { - this.reply('请发送设备信息', false, { at: true, recallMsg: 100 }); - return false; + return this.reply('请发送设备信息', false, { at: true, recallMsg: 100 }); } if (msg.includes('取消')) { - await this.reply('已取消', false, { at: true, recallMsg: 100 }); this.finish('toBindDevice'); - return false; + return this.reply('已取消', false, { at: true, recallMsg: 100 }); } try { const info = JSON.parse(msg); if (!info) { - this.reply('设备信息格式错误', false, { at: true, recallMsg: 100 }); - return false; + return this.reply('设备信息格式错误', false, { at: true, recallMsg: 100 }); } if (!!info?.device_id && !!info.device_fp) { + this.finish('toBindDevice'); await redis.set(`ZZZ:DEVICE_FP:${ltuid}:FP`, info.device_fp); await redis.set(`ZZZ:DEVICE_FP:${ltuid}:ID`, info.device_id); - await this.reply('绑定设备成功', false, { at: true, recallMsg: 100 }); - this.finish('toBindDevice'); - return false; + return this.reply('绑定设备成功', false, { at: true, recallMsg: 100 }); } if ( !info?.deviceName || @@ -80,24 +74,20 @@ export class User extends ZZZPlugin { !info?.deviceFingerprint || !info?.deviceProduct ) { - this.reply('设备信息格式错误', false, { at: true, recallMsg: 100 }); - return false; + return this.reply('设备信息格式错误', false, { at: true, recallMsg: 100 }); } await redis.del(`ZZZ:DEVICE_FP:${ltuid}:FP`); await redis.set(`ZZZ:DEVICE_FP:${ltuid}:BIND`, JSON.stringify(info)); const { deviceFp } = await this.getAPI(); if (!deviceFp) { - await this.reply('绑定设备失败'); - return false; + return this.reply('绑定设备失败'); } logger.debug(`[LTUID:${ltuid}]绑定设备成功,deviceFp:${deviceFp}`); await this.reply(`绑定设备成功${this.e.isGroup ? '\n请撤回设备信息' : ''}`, false, { at: true, recallMsg: 100 }); } catch (error) { - this.reply('设备信息格式错误', false, { at: true, recallMsg: 100 }); - return false; + return this.reply('设备信息格式错误', false, { at: true, recallMsg: 100 }); } finally { this.finish('toBindDevice'); - return false; } } async deleteBind() { diff --git a/apps/wiki.js b/apps/wiki.js index 0a8aa80..57b8478 100644 --- a/apps/wiki.js +++ b/apps/wiki.js @@ -80,7 +80,6 @@ export class Wiki extends ZZZPlugin { !isSkillLevelLegal('ChainLevel', ChainLevel) || !isSkillLevelLegal('CoreLevel', CoreLevel) ) { - await this.reply(`${charname}天赋等级参数不合法`); return false; } const charData = await getHakushCharacterData(charname); @@ -108,8 +107,7 @@ export class Wiki extends ZZZPlugin { const charData = await getHakushCharacterData(charname); const cinemaData = charData?.Talent; if (!cinemaData) { - await this.reply(`未找到${charname}的数据`); - return false; + return this.reply(`未找到${charname}的数据`); } await charData.get_assets(); const finalData = {