miao-plugin/index.js

34 lines
1.0 KiB
JavaScript
Raw Normal View History

2022-08-18 10:13:42 +00:00
import { Data, Version } from './components/index.js'
2022-07-23 20:32:10 +00:00
export * from './apps/index.js'
let index = { miao: {} }
2022-08-18 10:13:42 +00:00
if (Version.isV3) {
2022-09-04 09:33:14 +00:00
index = await Data.importModule('adapter/v3-entrance.js')
2022-07-23 20:32:10 +00:00
}
export const miao = index.miao || {}
if (Bot?.logger?.info) {
Bot.logger.info('---------^_^---------')
2022-08-18 10:13:42 +00:00
Bot.logger.info(`喵喵插件${Version.version}初始化~`)
} else {
2022-08-18 10:13:42 +00:00
console.log(`喵喵插件${Version.version}初始化~`)
}
setTimeout(async function () {
2022-07-23 20:32:10 +00:00
let msgStr = await redis.get('miao:restart-msg')
let relpyPrivate = async function () {
}
2022-08-18 10:13:42 +00:00
if (!Version.isV3) {
2022-09-04 09:33:14 +00:00
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')
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-07-23 20:32:10 +00:00
}, 1000)