更新星铁1.4角色数据,逐步去除对V2 Yunzai的支持
@ -7,21 +7,10 @@ import help from './help.js'
|
||||
import admin from './admin.js'
|
||||
import gacha from './gacha.js'
|
||||
|
||||
export const characterApp = character.v2App()
|
||||
export const profileApp = profile.v2App()
|
||||
export const adminApp = admin.v2App()
|
||||
export const helpApp = help.v2App()
|
||||
export const statApp = stat.v2App()
|
||||
export const wikiApp = wiki.v2App()
|
||||
export const pokeApp = poke.v2App()
|
||||
export const gachaApp = gacha.v2App()
|
||||
|
||||
let apps = { character, poke, profile, stat, wiki, gacha, admin, help }
|
||||
let rule = {} // v2
|
||||
let rules = {} // v3
|
||||
for (let key in apps) {
|
||||
rule[`${key}App`] = apps[key].v2Rule()
|
||||
rules[`${key}`] = apps[key].v3App()
|
||||
}
|
||||
|
||||
export { rule, rules as apps }
|
||||
export { rules as apps }
|
||||
|
@ -20,32 +20,11 @@ const _getTargetUid = async function (e) {
|
||||
}
|
||||
let uid = false
|
||||
let getUid = async function (qq) {
|
||||
let nCookie = global.NoteCookie || false
|
||||
if (nCookie && nCookie[qq]) {
|
||||
let nc = nCookie[qq]
|
||||
if (nc.uid && uidReg.test(nc.uid)) {
|
||||
return nc.uid
|
||||
}
|
||||
}
|
||||
uid = await redis.get(`genshin:id-uid:${qq}`) || await redis.get(`Yz:genshin:mys:qq-uid:${qq}`)
|
||||
if (uid && uidReg.test(uid)) {
|
||||
return uid
|
||||
}
|
||||
}
|
||||
if (!Version.isV3) {
|
||||
let botQQ = global?.Bot?.uin || global?.BotConfig?.account?.qq
|
||||
if (e.at && e.at !== botQQ) {
|
||||
uid = await getUid(e.at)
|
||||
if (uid) {
|
||||
return uid
|
||||
}
|
||||
}
|
||||
|
||||
uid = await getUid(e.user_id)
|
||||
if (uid) {
|
||||
return uid
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
let user = await MysApi.initUser(e)
|
||||
|
@ -124,69 +124,6 @@ class App {
|
||||
}
|
||||
return cls
|
||||
}
|
||||
|
||||
// 获取v2版rule
|
||||
v2Rule () {
|
||||
let cfg = this.cfg
|
||||
return {
|
||||
reg: 'noCheck',
|
||||
describe: cfg.desc || '',
|
||||
priority: cfg.priority || 50,
|
||||
hashMark: true
|
||||
}
|
||||
}
|
||||
|
||||
// v2执行方法
|
||||
v2App (e) {
|
||||
let cfg = this.cfg || {}
|
||||
let event = cfg.event
|
||||
let apps = this.apps
|
||||
return async function (e) {
|
||||
e.original_msg = e.original_msg || e.msg
|
||||
let msg = e.original_msg || e.msg || ''
|
||||
for (let key in apps) {
|
||||
let app = apps[key]
|
||||
if (app.check && app.check(e, msg) === true) {
|
||||
break
|
||||
}
|
||||
}
|
||||
msg = e.msg
|
||||
for (let key in apps) {
|
||||
let app = apps[key]
|
||||
let rule = app.rule || app.reg || 'noCheck'
|
||||
if (app.rule) {
|
||||
if (typeof (rule) === 'string') {
|
||||
if (rule === '#poke#') {
|
||||
continue
|
||||
} else if (rule === 'noCheck') {
|
||||
rule = /.*/
|
||||
}
|
||||
rule = new RegExp(rule)
|
||||
}
|
||||
if (rule.test(msg)) {
|
||||
let ret = await app.fn(e, {})
|
||||
if (ret === true) {
|
||||
return true
|
||||
}
|
||||
} else if (app.yzRule && app.yzCheck()) {
|
||||
rule = new RegExp(app.yzRule)
|
||||
if (rule.test(msg)) {
|
||||
let ret = await app.fn(e, {})
|
||||
if (ret === true) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (event === 'poke' && msg === '#poke#') {
|
||||
let ret = await app.fn(e, {})
|
||||
if (ret === true) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
App.init = function (cfg) {
|
||||
|
9
index.js
@ -2,7 +2,7 @@ import { Data, Version } from '#miao'
|
||||
import fs from 'fs'
|
||||
|
||||
if (!global.segment) {
|
||||
global.segment = (await import("oicq")).segment
|
||||
global.segment = (await import('oicq')).segment
|
||||
}
|
||||
|
||||
export * from './apps/index.js'
|
||||
@ -18,7 +18,7 @@ setTimeout(async function () {
|
||||
let msgStr = await redis.get('miao:restart-msg')
|
||||
let relpyPrivate = async function () {
|
||||
}
|
||||
let common = await Data.importModule(Version.isV3 ? 'lib/common/common.js' : 'lib/common.js', 'root')
|
||||
let common = await Data.importModule('lib/common/common.js', 'root')
|
||||
if (common && common.default && common.default.relpyPrivate) {
|
||||
relpyPrivate = common.default.relpyPrivate
|
||||
}
|
||||
@ -29,8 +29,11 @@ setTimeout(async function () {
|
||||
let msgs = [`当前喵喵版本: ${Version.version}`, '您可使用 #喵喵版本 命令查看更新信息']
|
||||
await relpyPrivate(msg.qq, msgs.join('\n'))
|
||||
}
|
||||
if (!Version.isV3) {
|
||||
console.log('警告:miao-plugin需要V3 Yunzai,请升级至最新版Miao-Yunzai以使用miao-plugin')
|
||||
}
|
||||
if (!fs.existsSync(process.cwd() + '/lib/plugins/runtime.js')) {
|
||||
let msg = '警告:未检测到runtime,miao-plugin可能无法正常工作。请升级至最新版Yunzai以使用miao-plugin'
|
||||
let msg = '警告:未检测到runtime,miao-plugin可能无法正常工作。请升级至最新版Miao-Yunzai以使用miao-plugin'
|
||||
if (!await redis.get('miao:runtime-warning')) {
|
||||
await relpyPrivate(msg.qq, msg)
|
||||
await redis.set('miao:runtime-warning', 'true', { EX: 3600 * 24 })
|
||||
|
@ -224,7 +224,7 @@ export default class ProfileRank {
|
||||
add(user.qq, uid, type)
|
||||
})
|
||||
})
|
||||
} else if (Version.isV3) {
|
||||
} else {
|
||||
if (rn?.gsCfg?.getBingCk) {
|
||||
// Yunzai-V3
|
||||
let noteCks = await rn.gsCfg.getBingCk(game) || {}
|
||||
@ -235,15 +235,6 @@ export default class ProfileRank {
|
||||
add(qq, uid, 'ck')
|
||||
})
|
||||
}
|
||||
} else {
|
||||
// V2
|
||||
lodash.forEach(global.NoteCookie || {}, (ck) => {
|
||||
const { qq, uid } = ck
|
||||
if (!users[qq]) return true
|
||||
if (qq && uid) {
|
||||
add(qq, uid, 'ck')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
for (let qq in users) {
|
||||
|
BIN
resources/meta-sr/character/托帕&账账/imgs/cons-1.webp
Normal file
After Width: | Height: | Size: 6.4 KiB |
BIN
resources/meta-sr/character/托帕&账账/imgs/cons-2.webp
Normal file
After Width: | Height: | Size: 5.1 KiB |
BIN
resources/meta-sr/character/托帕&账账/imgs/cons-4.webp
Normal file
After Width: | Height: | Size: 4.1 KiB |
BIN
resources/meta-sr/character/托帕&账账/imgs/cons-6.webp
Normal file
After Width: | Height: | Size: 10 KiB |
BIN
resources/meta-sr/character/托帕&账账/imgs/face.webp
Normal file
After Width: | Height: | Size: 41 KiB |
Before Width: | Height: | Size: 6.5 KiB After Width: | Height: | Size: 7.3 KiB |
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 5.9 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 5.2 KiB |
Before Width: | Height: | Size: 8.4 KiB After Width: | Height: | Size: 9.4 KiB |
BIN
resources/meta-sr/character/桂乃芬/imgs/cons-1.webp
Normal file
After Width: | Height: | Size: 6.3 KiB |
BIN
resources/meta-sr/character/桂乃芬/imgs/cons-2.webp
Normal file
After Width: | Height: | Size: 9.7 KiB |
BIN
resources/meta-sr/character/桂乃芬/imgs/cons-4.webp
Normal file
After Width: | Height: | Size: 6.2 KiB |
BIN
resources/meta-sr/character/桂乃芬/imgs/cons-6.webp
Normal file
After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 43 KiB |
BIN
resources/meta-sr/character/桂乃芬/imgs/preview.webp
Normal file
After Width: | Height: | Size: 92 KiB |
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 7.5 KiB |
Before Width: | Height: | Size: 6.3 KiB After Width: | Height: | Size: 8.9 KiB |
Before Width: | Height: | Size: 9.2 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 9.8 KiB |
Before Width: | Height: | Size: 7.5 KiB After Width: | Height: | Size: 8.2 KiB |
BIN
resources/meta-sr/character/镜流/imgs/cons-1.webp
Normal file
After Width: | Height: | Size: 8.5 KiB |
BIN
resources/meta-sr/character/镜流/imgs/cons-2.webp
Normal file
After Width: | Height: | Size: 8.7 KiB |
BIN
resources/meta-sr/character/镜流/imgs/cons-4.webp
Normal file
After Width: | Height: | Size: 9.2 KiB |
BIN
resources/meta-sr/character/镜流/imgs/cons-6.webp
Normal file
After Width: | Height: | Size: 9.1 KiB |
Before Width: | Height: | Size: 63 KiB After Width: | Height: | Size: 39 KiB |
BIN
resources/meta-sr/character/镜流/imgs/preview.webp
Normal file
After Width: | Height: | Size: 97 KiB |
Before Width: | Height: | Size: 7.1 KiB After Width: | Height: | Size: 8.1 KiB |
Before Width: | Height: | Size: 6.9 KiB After Width: | Height: | Size: 7.6 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 7.8 KiB After Width: | Height: | Size: 8.9 KiB |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 12 KiB |