2
0
mirror of https://github.com/ctrlcvs/xiaoyao-cvs-plugin.git synced 2024-12-23 03:20:52 +08:00

主人权限修正及更新成功后回复修正

This commit is contained in:
leiyilu 2022-07-26 08:46:36 +08:00
parent 583ee3c064
commit 64c884cddb
2 changed files with 41 additions and 16 deletions

View File

@ -110,5 +110,20 @@ export async function getMysApi (e, cfg) {
}
export async function checkAuth (e, cfg) {
return new User({ id: e.user_id })
let { auth = 'all' } = cfg
let uid = await MysInfo.getUid(e)
if (!uid) return false
if (auth === 'master' && !e.isMaster) {
return false
}
/* 检查user ck */
let isCookieUser = await MysInfo.checkUidBing(uid)
if (auth === 'cookie' && !isCookieUser) {
e.reply('尚未绑定Cookie...')
return false
}
e.selfUser = new User({ id: e.user_id, uid })
return e.selfUser
}

View File

@ -1,26 +1,36 @@
// 适配V3 Yunzai将index.js移至app/index.js
import { currentVersion, isV3 } from './components/Changelog.js'
import {
currentVersion,
isV3
} from './components/Changelog.js'
import Data from './components/Data.js'
export * from './apps/index.js'
let index = { atlas: {} }
let index = {
atlas: {}
}
if (isV3) {
index = await Data.importModule('/plugins/xiaoyao-cvs-plugin/adapter', 'index.js')
console.log(index)
index = await Data.importModule('/plugins/xiaoyao-cvs-plugin/adapter', 'index.js')
console.log(index)
}
export const atlas = index.atlas || {}
console.log(`图鉴插件${currentVersion}初始化~`)
setTimeout(async function () {
let msgStr = await redis.get('xiaoyao:restart-msg')
let relpyPrivate = async function () {
}
if (msgStr) {
let msg = JSON.parse(msgStr)
await relpyPrivate(msg.qq, msg.msg)
await redis.del('xiaoyao:restart-msg')
let msgs = [`当前图鉴版本: ${currentVersion}`, '您可使用 #图鉴版本 命令查看更新信息']
await relpyPrivate(msg.qq, msgs.join('\n'))
}
setTimeout(async function() {
let msgStr = await redis.get('xiaoyao:restart-msg')
let relpyPrivate = async function() {}
if (!isV3) {
let common = await Data.importModule('/lib', 'common.js')
if (common && common.default && common.default.relpyPrivate) {
relpyPrivate = common.default.relpyPrivate
}
}
if (msgStr) {
let msg = JSON.parse(msgStr)
await relpyPrivate(msg.qq, msg.msg)
await redis.del('xiaoyao:restart-msg')
let msgs = [`当前图鉴版本: ${currentVersion}`, '您可使用 #图鉴版本 命令查看更新信息']
await relpyPrivate(msg.qq, msgs.join('\n'))
}
}, 1000)