mirror of
https://github.com/yoimiya-kokomi/miao-plugin.git
synced 2024-11-16 04:35:42 +00:00
调整V3下MysApi调用逻辑
This commit is contained in:
parent
6acfb6417a
commit
122565722b
@ -110,23 +110,21 @@ class Mys {
|
||||
|
||||
export async function getMysApi (e, cfg) {
|
||||
let { auth = 'all' } = cfg
|
||||
let uid = await MysInfo.getUid(e)
|
||||
if (!uid) return false
|
||||
|
||||
/* 检查user ck */
|
||||
let isCookieUser = await MysInfo.checkUidBing(uid)
|
||||
if (auth === 'cookie') {
|
||||
if (!isCookieUser) {
|
||||
e.reply('尚未绑定Cookie...')
|
||||
return false
|
||||
}
|
||||
e.isSelfCookie = true
|
||||
}
|
||||
let MysApi = await MysInfo.init(e, 'roleIndex')
|
||||
if (!MysApi) {
|
||||
return false
|
||||
}
|
||||
MysApi.isSelfCookie = !!e.isSelfCookie
|
||||
let uid = MysApi.uid
|
||||
let ckUid = MysApi.ckInfo?.uid
|
||||
/* 检查user ck */
|
||||
if (auth === 'cookie') {
|
||||
let isCookieUser = await MysInfo.checkUidBing(uid)
|
||||
if (!isCookieUser || uid !== ckUid) {
|
||||
e.reply('尚未绑定Cookie...')
|
||||
return false
|
||||
}
|
||||
}
|
||||
e.isSelfCookie = uid !== ckUid
|
||||
return new Mys(e, uid, MysApi)
|
||||
}
|
||||
|
||||
@ -140,10 +138,12 @@ export async function checkAuth (e, cfg) {
|
||||
}
|
||||
|
||||
/* 检查user ck */
|
||||
let isCookieUser = await MysInfo.checkUidBing(uid)
|
||||
if (auth === 'cookie' && !isCookieUser) {
|
||||
e.reply('尚未绑定Cookie...')
|
||||
return false
|
||||
if (auth === 'cookie') {
|
||||
let isCookieUser = await MysInfo.checkUidBing(uid)
|
||||
if (!isCookieUser) {
|
||||
e.reply('尚未绑定Cookie...')
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
e.selfUser = new User({ id: e.user_id, uid })
|
||||
|
@ -34,7 +34,7 @@ const relationMap = {
|
||||
const relation = lodash.flatMap(relationMap, (d) => d.keyword)
|
||||
export const wifeReg = `^#?\\s*(${relation.join('|')})\\s*(设置|选择|指定|列表|查询|列表|是|是谁|照片|相片|图片|写真|图像)?\\s*([^\\d]*)\\s*(\\d*)$`
|
||||
|
||||
export async function wife (e, { User }) {
|
||||
export async function wife (e) {
|
||||
let msg = e.msg || ''
|
||||
if (!msg && !e.isPoke) return false
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user