From 513f52d3edf70af3dc2f2724e38e5d72c5a9bf94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=A0=E6=AA=AC=E5=86=B2=E6=B0=B4?= <10424920+ningmengchongshui@user.noreply.gitee.com> Date: Mon, 18 Dec 2023 07:37:04 +0000 Subject: [PATCH] =?UTF-8?q?AlemonJSV1.1.25=E5=A2=9E=E5=8A=A0*=E8=BD=AC?= =?UTF-8?q?=E4=B8=BA#=E6=98=9F=E9=93=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 柠檬冲水 <10424920+ningmengchongshui@user.noreply.gitee.com> --- main.js | 46 ++++++++++++++++++++-------------------------- 1 file changed, 20 insertions(+), 26 deletions(-) diff --git a/main.js b/main.js index 2330f581..3de82e99 100644 --- a/main.js +++ b/main.js @@ -1,27 +1,21 @@ -import { createApps } from 'alemonjs' +import { createApp } from 'alemonjs' import { apps } from './index.js' -const app = createApps(import.meta.url) -const arg = /^#?(\*|星铁|星轨|穹轨|星穹|崩铁|星穹铁道|崩坏星穹铁道|铁道)+/ -app.setMessage(async e => { - e.isSr = true - e.isGs = true - await runtime.init(e) - Object.defineProperty(e, 'isSr', { - get: () => e.game === 'sr', - set: (v) => { e.game = v ? 'sr' : 'gs' } - }) - Object.defineProperty(e, 'isGs', { - get: () => e.game === 'gs', - set: (v) => { e.game = v ? 'gs' : 'sr' } - }) - if (arg.test(e.msg)) { - e.game = 'sr' - e.msg = e.msg.replace(arg, '#星铁') - } - e.sender = {} - e.sender.card = e.user_name - return e -}) -app.setCharacter('#') -app.component(apps) -app.mount() +/** + * ******* + * 创建应用 createApp + * 重定义 reSetEvent + * 切割消息 replace + * 使用 use + * 挂载 mount + * ******* + * global.YUNZAI_GENSHIN 原神星铁重定义方法 | 方便A崽统一修改 + * global.YUNZAI_EVENT 非原神星铁相关的重定义方法 | 方便A崽统一修改 + * global.YUNZAI_REG 星铁消息的正则变量 + * ******* + */ +createApp(import.meta.url) +.reSetEvent(global.YUNZAI_GENSHIN) +.replace(global.YUNZAI_REG,'#星铁') +.replace(/^(\/|#)/,'#') +.use(apps) +.mount()