miao-plugin/index.js

36 lines
1.1 KiB
JavaScript
Raw Normal View History

2022-07-23 20:32:10 +00:00
// 适配V3 Yunzai将index.js移至app/index.js
import { currentVersion, isV3 } from './components/Changelog.js'
import Data from './components/Data.js'
2022-07-23 20:32:10 +00:00
export * from './apps/index.js'
let index = { miao: {} }
if (isV3) {
index = await Data.importModule('/plugins/miao-plugin/adapter', 'index.js')
}
export const miao = index.miao || {}
if (Bot?.logger?.info) {
Bot.logger.info(`---------^_^---------`)
Bot.logger.info(`喵喵插件${currentVersion}初始化~`)
} else {
console.log(`喵喵插件${currentVersion}初始化~`)
}
setTimeout(async function () {
2022-07-23 20:32:10 +00:00
let msgStr = await redis.get('miao:restart-msg')
let relpyPrivate = async function () {
}
2022-07-24 21:11:19 +00:00
if (!isV3) {
let common = await Data.importModule('/lib', 'common.js')
2022-07-25 18:11:18 +00:00
if (common && common.default && common.default.relpyPrivate) {
relpyPrivate = common.default.relpyPrivate
2022-07-24 21:11:19 +00:00
}
}
if (msgStr) {
2022-07-23 20:32:10 +00:00
let msg = JSON.parse(msgStr)
await relpyPrivate(msg.qq, msg.msg)
await redis.del('miao:restart-msg')
let msgs = [`当前喵喵版本: ${currentVersion}`, '您可使用 #喵喵版本 命令查看更新信息']
await relpyPrivate(msg.qq, msgs.join('\n'))
}
2022-07-23 20:32:10 +00:00
}, 1000)