2023-03-07 17:52:11 +00:00
|
|
|
|
import { Data, Version } from '#miao'
|
2022-11-24 18:17:31 +00:00
|
|
|
|
import fs from 'fs'
|
2022-06-27 20:46:49 +00:00
|
|
|
|
|
2023-03-21 19:19:03 +00:00
|
|
|
|
if (!global.segment) {
|
|
|
|
|
global.segment = (await import("oicq")).segment
|
|
|
|
|
}
|
|
|
|
|
|
2022-07-23 20:32:10 +00:00
|
|
|
|
export * from './apps/index.js'
|
2022-09-16 21:45:10 +00:00
|
|
|
|
|
2022-08-02 19:12:07 +00:00
|
|
|
|
if (Bot?.logger?.info) {
|
2022-08-24 01:07:06 +00:00
|
|
|
|
Bot.logger.info('---------^_^---------')
|
2022-08-18 10:13:42 +00:00
|
|
|
|
Bot.logger.info(`喵喵插件${Version.version}初始化~`)
|
2022-08-02 19:12:07 +00:00
|
|
|
|
} else {
|
2022-08-18 10:13:42 +00:00
|
|
|
|
console.log(`喵喵插件${Version.version}初始化~`)
|
2022-08-02 19:12:07 +00:00
|
|
|
|
}
|
2022-04-26 14:25:47 +00:00
|
|
|
|
|
|
|
|
|
setTimeout(async function () {
|
2022-07-23 20:32:10 +00:00
|
|
|
|
let msgStr = await redis.get('miao:restart-msg')
|
|
|
|
|
let relpyPrivate = async function () {
|
|
|
|
|
}
|
2022-11-24 18:17:31 +00:00
|
|
|
|
let common = await Data.importModule(Version.isV3 ? 'lib/common/common.js' : 'lib/common.js', 'root')
|
|
|
|
|
if (common && common.default && common.default.relpyPrivate) {
|
|
|
|
|
relpyPrivate = common.default.relpyPrivate
|
2022-07-24 21:11:19 +00:00
|
|
|
|
}
|
2022-04-26 14:25:47 +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')
|
2022-08-18 10:13:42 +00:00
|
|
|
|
let msgs = [`当前喵喵版本: ${Version.version}`, '您可使用 #喵喵版本 命令查看更新信息']
|
2022-07-23 20:32:10 +00:00
|
|
|
|
await relpyPrivate(msg.qq, msgs.join('\n'))
|
2022-04-26 14:25:47 +00:00
|
|
|
|
}
|
2022-11-26 22:20:58 +00:00
|
|
|
|
if (!fs.existsSync(process.cwd() + '/lib/plugins/runtime.js')) {
|
2022-11-24 18:17:31 +00:00
|
|
|
|
let msg = '警告:未检测到runtime,miao-plugin可能无法正常工作。请升级至最新版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 })
|
|
|
|
|
} else {
|
|
|
|
|
console.log(msg)
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-07-23 20:32:10 +00:00
|
|
|
|
}, 1000)
|