AlemonJSV1.1.25增加*转为#星铁

Signed-off-by: 柠檬冲水 <10424920+ningmengchongshui@user.noreply.gitee.com>
This commit is contained in:
柠檬冲水 2023-12-18 07:37:04 +00:00 committed by Gitee
parent 4fff29e147
commit 513f52d3ed
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

46
main.js
View File

@ -1,27 +1,21 @@
import { createApps } from 'alemonjs' import { createApp } from 'alemonjs'
import { apps } from './index.js' import { apps } from './index.js'
const app = createApps(import.meta.url) /**
const arg = /^#?(\*|星铁|星轨|穹轨|星穹|崩铁|星穹铁道|崩坏星穹铁道|铁道)+/ * *******
app.setMessage(async e => { * 创建应用 createApp
e.isSr = true * 重定义 reSetEvent
e.isGs = true * 切割消息 replace
await runtime.init(e) * 使用 use
Object.defineProperty(e, 'isSr', { * 挂载 mount
get: () => e.game === 'sr', * *******
set: (v) => { e.game = v ? 'sr' : 'gs' } * global.YUNZAI_GENSHIN 原神星铁重定义方法 | 方便A崽统一修改
}) * global.YUNZAI_EVENT 非原神星铁相关的重定义方法 | 方便A崽统一修改
Object.defineProperty(e, 'isGs', { * global.YUNZAI_REG 星铁消息的正则变量
get: () => e.game === 'gs', * *******
set: (v) => { e.game = v ? 'gs' : 'sr' } */
}) createApp(import.meta.url)
if (arg.test(e.msg)) { .reSetEvent(global.YUNZAI_GENSHIN)
e.game = 'sr' .replace(global.YUNZAI_REG,'#星铁')
e.msg = e.msg.replace(arg, '#星铁') .replace(/^(\/|#)/,'#')
} .use(apps)
e.sender = {} .mount()
e.sender.card = e.user_name
return e
})
app.setCharacter('#')
app.component(apps)
app.mount()