mirror of
https://github.com/yoimiya-kokomi/miao-plugin.git
synced 2024-11-21 22:48:13 +00:00
加部分按钮
This commit is contained in:
parent
942cac4fb2
commit
b97bc17ff3
@ -1,4 +1,4 @@
|
|||||||
import { Character, MysApi, Player } from '#miao.models'
|
import { Button, Character, MysApi, Player } from '#miao.models'
|
||||||
import { Cfg, Common, Meta } from '#miao'
|
import { Cfg, Common, Meta } from '#miao'
|
||||||
import lodash from 'lodash'
|
import lodash from 'lodash'
|
||||||
import moment from 'moment'
|
import moment from 'moment'
|
||||||
@ -79,7 +79,7 @@ let Avatar = {
|
|||||||
scale = 1.45
|
scale = 1.45
|
||||||
}
|
}
|
||||||
// 渲染图像
|
// 渲染图像
|
||||||
let msgRes = await Common.render('character/character-card', {
|
let msgRes = await e.reply([await Common.render('character/character-card', {
|
||||||
saveId: uid,
|
saveId: uid,
|
||||||
uid,
|
uid,
|
||||||
bg,
|
bg,
|
||||||
@ -88,7 +88,7 @@ let Avatar = {
|
|||||||
custom,
|
custom,
|
||||||
isRelease,
|
isRelease,
|
||||||
data
|
data
|
||||||
}, { e, scale, retMsgId: true })
|
}, { e, scale, retType: "base64" }), new Button(e).profile(char, uid)])
|
||||||
if (msgRes) {
|
if (msgRes) {
|
||||||
// 如果消息发送成功,就将message_id和图片路径存起来,3小时过期
|
// 如果消息发送成功,就将message_id和图片路径存起来,3小时过期
|
||||||
const message_id = [e.message_id]
|
const message_id = [e.message_id]
|
||||||
|
@ -102,11 +102,11 @@ const Wife = {
|
|||||||
let renderType = (action === '卡片' ? 'card' : 'photo')
|
let renderType = (action === '卡片' ? 'card' : 'photo')
|
||||||
let addRet = []
|
let addRet = []
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case '卡片':
|
|
||||||
case '照片':
|
case '照片':
|
||||||
case '相片':
|
case '相片':
|
||||||
case '图片':
|
case '图片':
|
||||||
case '写真':
|
case '写真':
|
||||||
|
case '卡片':
|
||||||
// 展示老婆卡片
|
// 展示老婆卡片
|
||||||
// 如果选择过,则进行展示
|
// 如果选择过,则进行展示
|
||||||
if (!e.isPoke) {
|
if (!e.isPoke) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { Common } from '#miao'
|
import { Common } from '#miao'
|
||||||
import { getTargetUid } from '../profile/ProfileCommon.js'
|
import { getTargetUid } from '../profile/ProfileCommon.js'
|
||||||
import GachaData from './GachaData.js'
|
import GachaData from './GachaData.js'
|
||||||
import { Character, Player } from '#miao.models'
|
import { Button, Character, Player } from '#miao.models'
|
||||||
|
|
||||||
let Gacha = {
|
let Gacha = {
|
||||||
async detail (e) {
|
async detail (e) {
|
||||||
@ -29,15 +29,15 @@ let Gacha = {
|
|||||||
|
|
||||||
let gacha = GachaData.analyse(e.user_id, uid, type)
|
let gacha = GachaData.analyse(e.user_id, uid, type)
|
||||||
if (!gacha) {
|
if (!gacha) {
|
||||||
e.reply(`UID:${uid} 本地暂无抽卡信息,请通过【#抽卡帮助】获得绑定帮助...`)
|
e.reply([`UID:${uid} 本地暂无抽卡信息,请通过【#抽卡帮助】获得绑定帮助...`, new Button(e).gacha()])
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
await Common.render('gacha/gacha-detail', {
|
this.reply([await Common.render('gacha/gacha-detail', {
|
||||||
save_id: uid,
|
save_id: uid,
|
||||||
uid,
|
uid,
|
||||||
gacha,
|
gacha,
|
||||||
face: Gacha.getFace(uid)
|
face: Gacha.getFace(uid)
|
||||||
}, { e, scale: 1.4, retMsgId: true })
|
}, { e, scale: 1.4, retType: "base64" }), new Button(e).gacha()])
|
||||||
},
|
},
|
||||||
async stat (e) {
|
async stat (e) {
|
||||||
let msg = e.msg.replace(/#|统计|分析|池/g, '')
|
let msg = e.msg.replace(/#|统计|分析|池/g, '')
|
||||||
@ -58,15 +58,15 @@ let Gacha = {
|
|||||||
}
|
}
|
||||||
let gacha = GachaData.stat(e.user_id, uid, type)
|
let gacha = GachaData.stat(e.user_id, uid, type)
|
||||||
if (!gacha) {
|
if (!gacha) {
|
||||||
e.reply(`UID:${uid} 本地暂无抽卡信息,请通过【#抽卡帮助】获得绑定帮助...`)
|
e.reply([`UID:${uid} 本地暂无抽卡信息,请通过【#抽卡帮助】获得绑定帮助...`, new Button(e).gacha()])
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
await Common.render('gacha/gacha-stat', {
|
e.reply([await Common.render('gacha/gacha-stat', {
|
||||||
save_id: uid,
|
save_id: uid,
|
||||||
uid,
|
uid,
|
||||||
gacha,
|
gacha,
|
||||||
face: Gacha.getFace(uid)
|
face: Gacha.getFace(uid)
|
||||||
}, { e, scale: 1.4 })
|
}, { e, scale: 1.4, retType: "base64" }), new Button(e).gacha()])
|
||||||
},
|
},
|
||||||
|
|
||||||
getFace (uid) {
|
getFace (uid) {
|
||||||
|
@ -18,13 +18,13 @@ app.reg({
|
|||||||
name: '面板角色列表',
|
name: '面板角色列表',
|
||||||
desc: '查看当前已获取面板数据的角色列表',
|
desc: '查看当前已获取面板数据的角色列表',
|
||||||
fn: ProfileList.render,
|
fn: ProfileList.render,
|
||||||
rule: /^#(星铁|原神)?(面板角色|角色面板|面板)(列表)?\s*(\d{9,10})?$/
|
rule: /^#(星铁|原神)?(面板角色|角色面板|面板)(列表)?\s*(\d{9})?$/
|
||||||
},
|
},
|
||||||
|
|
||||||
profileDetail: {
|
profileDetail: {
|
||||||
name: '角色面板',
|
name: '角色面板',
|
||||||
fn: ProfileDetail.detail,
|
fn: ProfileDetail.detail,
|
||||||
rule: /^#*([^#]+)\s*(详细|详情|面板|面版|圣遗物|武器[1-7]?|伤害([1-9]+\d*)?)\s*(\d{9,10})*(.*[换变改].*)?$/
|
rule: /^#*([^#]+)\s*(详细|详情|面板|面版|圣遗物|武器[1-7]?|伤害([1-9]+\d*)?)\s*(\d{9})*(.*[换变改].*)?$/
|
||||||
},
|
},
|
||||||
|
|
||||||
profileChange: {
|
profileChange: {
|
||||||
@ -66,7 +66,7 @@ app.reg({
|
|||||||
artisList: {
|
artisList: {
|
||||||
name: '面板圣遗物列表',
|
name: '面板圣遗物列表',
|
||||||
fn: profileArtisList,
|
fn: profileArtisList,
|
||||||
rule: /^#圣遗物列表\s*(\d{9,10})?$/
|
rule: /^#圣遗物列表\s*(\d{9})?$/
|
||||||
},
|
},
|
||||||
|
|
||||||
profileStat: {
|
profileStat: {
|
||||||
@ -87,7 +87,7 @@ app.reg({
|
|||||||
name: '角色查询',
|
name: '角色查询',
|
||||||
fn: ProfileStat.avatarList,
|
fn: ProfileStat.avatarList,
|
||||||
rule: /^#喵喵(角色|查询)[ |0-9]*$/,
|
rule: /^#喵喵(角色|查询)[ |0-9]*$/,
|
||||||
yzRule: /^(#(五|四|5|4|星)*(角色|查询|查询角色|角色查询|人物)[ |0-9]*$)|(^(#*uid|#*UID)\+*([1-9]|18)[0-9]{8}$)|(^#[\+|+]*([1-9]|18)[0-9]{8})/,
|
yzRule: /^(#(五|四|5|4|星)*(角色|查询|查询角色|角色查询|人物)[ |0-9]*$)|(^(#*uid|#*UID)\+*[1|2|5-9][0-9]{8}$)|(^#[\+|+]*[1|2|5-9][0-9]{8})/,
|
||||||
yzCheck: () => Cfg.get('avatarList', false)
|
yzCheck: () => Cfg.get('avatarList', false)
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -114,7 +114,7 @@ app.reg({
|
|||||||
name: '面板更新',
|
name: '面板更新',
|
||||||
describe: '【#角色】 获取游戏橱窗详情数据',
|
describe: '【#角色】 获取游戏橱窗详情数据',
|
||||||
fn: ProfileList.refresh,
|
fn: ProfileList.refresh,
|
||||||
rule: /^#(星铁|原神)?(全部面板更新|更新全部面板|获取游戏角色详情|更新面板|面板更新)\s*(\d{9,10})?$/
|
rule: /^#(星铁|原神)?(全部面板更新|更新全部面板|获取游戏角色详情|更新面板|面板更新)\s*(\d{9})?$/
|
||||||
},
|
},
|
||||||
|
|
||||||
uploadImg: {
|
uploadImg: {
|
||||||
@ -142,13 +142,13 @@ app.reg({
|
|||||||
name: '删除面板',
|
name: '删除面板',
|
||||||
describe: '【#角色】 删除游戏橱窗详情数据',
|
describe: '【#角色】 删除游戏橱窗详情数据',
|
||||||
fn: ProfileList.del,
|
fn: ProfileList.del,
|
||||||
rule: /^#(删除全部面板|删除面板|删除面板数据)\s*(\d{9,10})?$/
|
rule: /^#(删除全部面板|删除面板|删除面板数据)\s*(\d{9})?$/
|
||||||
},
|
},
|
||||||
|
|
||||||
profileReload: {
|
profileReload: {
|
||||||
name: '重新加载面板',
|
name: '重新加载面板',
|
||||||
fn: ProfileList.reload,
|
fn: ProfileList.reload,
|
||||||
rule: /^#(星铁|原神)?(加载|重新加载|重载)面板\s*(\d{9,10})?$/
|
rule: /^#(星铁|原神)?(加载|重新加载|重载)面板\s*(\d{9})?$/
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
import lodash from 'lodash'
|
import lodash from 'lodash'
|
||||||
import { Cfg, Common, Meta } from '#miao'
|
import { Cfg, Common, Meta } from '#miao'
|
||||||
import { getTargetUid, profileHelp, getProfileRefresh } from './ProfileCommon.js'
|
import { getTargetUid, profileHelp, getProfileRefresh } from './ProfileCommon.js'
|
||||||
import { Artifact, Character, Player } from '#miao.models'
|
import { Artifact, Button, Character, Player } from '#miao.models'
|
||||||
import ArtisMarkCfg from '../../models/artis/ArtisMarkCfg.js'
|
import ArtisMarkCfg from '../../models/artis/ArtisMarkCfg.js'
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -31,7 +31,7 @@ export async function profileArtis (e) {
|
|||||||
let artisKeyTitle = Artifact.getArtisKeyTitle()
|
let artisKeyTitle = Artifact.getArtisKeyTitle()
|
||||||
|
|
||||||
// 渲染图像
|
// 渲染图像
|
||||||
return await Common.render('character/artis-mark', {
|
return e.reply([await Common.render('character/artis-mark', {
|
||||||
uid,
|
uid,
|
||||||
elem: char.elem,
|
elem: char.elem,
|
||||||
splash: profile.costumeSplash,
|
splash: profile.costumeSplash,
|
||||||
@ -43,7 +43,7 @@ export async function profileArtis (e) {
|
|||||||
charCfg,
|
charCfg,
|
||||||
game,
|
game,
|
||||||
changeProfile: e._profileMsg
|
changeProfile: e._profileMsg
|
||||||
}, { e, scale: 1.6 / 1.1 })
|
}, { e, scale: 1.6 / 1.1, retType: "base64" }), new Button(e).profile(char, uid)])
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -25,7 +25,7 @@ const ProfileChange = {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
msg = msg.toLowerCase().replace(/uid ?:? ?/, '').replace('', '')
|
msg = msg.toLowerCase().replace(/uid ?:? ?/, '').replace('', '')
|
||||||
let regRet = /^#*(\d{9,10})?(.+?)(详细|详情|面板|面版|圣遗物|伤害[1-7]?)?\s*(\d{9,10})?[变换改](.+)/.exec(msg)
|
let regRet = /^#*(\d{9})?(.+?)(详细|详情|面板|面版|圣遗物|伤害[1-7]?)?\s*(\d{9})?[变换改](.+)/.exec(msg)
|
||||||
if (!regRet || !regRet[2]) {
|
if (!regRet || !regRet[2]) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@ -63,7 +63,7 @@ const ProfileChange = {
|
|||||||
keyTitleMap[v] = key
|
keyTitleMap[v] = key
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
const keyReg = new RegExp(`^(\\d{9,10})?\\s*(.+?)\\s*(\\d{9,10})?\\s*((?:${lodash.keys(keyTitleMap).join('|')}|\\+)+)$`)
|
const keyReg = new RegExp(`^(\\d{9})?\\s*(.+?)\\s*(\\d{9})?\\s*((?:${lodash.keys(keyTitleMap).join('|')}|\\+)+)$`)
|
||||||
|
|
||||||
ret.char = char.id
|
ret.char = char.id
|
||||||
ret.mode = regRet[3] === '换' ? '面板' : regRet[3]
|
ret.mode = regRet[3] === '换' ? '面板' : regRet[3]
|
||||||
|
@ -2,13 +2,13 @@
|
|||||||
* 面板公共方法及处理
|
* 面板公共方法及处理
|
||||||
* */
|
* */
|
||||||
import { Version } from '#miao'
|
import { Version } from '#miao'
|
||||||
import { Character, MysApi, Player } from '#miao.models'
|
import { Button, Character, MysApi, Player } from '#miao.models'
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 获取面板查询的 目标uid
|
* 获取面板查询的 目标uid
|
||||||
* */
|
* */
|
||||||
const _getTargetUid = async function (e) {
|
const _getTargetUid = async function (e) {
|
||||||
let uidReg = /([1-9]|18)[0-9]{8}/
|
let uidReg = /[1-9][0-9]{8}/
|
||||||
|
|
||||||
if (e.uid && uidReg.test(e.uid)) {
|
if (e.uid && uidReg.test(e.uid)) {
|
||||||
return e.uid
|
return e.uid
|
||||||
@ -28,7 +28,7 @@ const _getTargetUid = async function (e) {
|
|||||||
}
|
}
|
||||||
uid = user.uid
|
uid = user.uid
|
||||||
if ((!uid || !uidReg.test(uid)) && !e._replyNeedUid) {
|
if ((!uid || !uidReg.test(uid)) && !e._replyNeedUid) {
|
||||||
e.reply('请先发送【#绑定+你的UID】来绑定查询目标\n星铁请使用【#星铁绑定+UID】')
|
e.reply(['请先发送【#绑定+你的UID】来绑定查询目标\n星铁请使用【#星铁绑定+UID】', new Button(e).bindUid()])
|
||||||
e._replyNeedUid = true
|
e._replyNeedUid = true
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@ -61,7 +61,7 @@ export async function getProfileRefresh(e, avatar) {
|
|||||||
}
|
}
|
||||||
if (!profile || !profile.hasData) {
|
if (!profile || !profile.hasData) {
|
||||||
if (!e._isReplyed) {
|
if (!e._isReplyed) {
|
||||||
e.reply(`请确认${char.name}已展示在【游戏内】的角色展柜中,并打开了“显示角色详情”。然后请使用 #更新面板\n命令来获取${char.name}的面板详情`)
|
e.reply([`请确认${char.name}已展示在【游戏内】的角色展柜中,并打开了“显示角色详情”。然后请使用 #更新面板\n命令来获取${char.name}的面板详情`, new Button(e).profileList(player.uid), new Button(e).profile(char, player.uid)])
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ import lodash from 'lodash'
|
|||||||
import { getTargetUid, getProfileRefresh } from './ProfileCommon.js'
|
import { getTargetUid, getProfileRefresh } from './ProfileCommon.js'
|
||||||
import ProfileList from './ProfileList.js'
|
import ProfileList from './ProfileList.js'
|
||||||
import { Cfg, Common, Data, Format } from '#miao'
|
import { Cfg, Common, Data, Format } from '#miao'
|
||||||
|
import { Button } from '#miao.models'
|
||||||
import { MysApi, ProfileRank, Character, Weapon, Artifact } from '#miao.models'
|
import { MysApi, ProfileRank, Character, Weapon, Artifact } from '#miao.models'
|
||||||
import ProfileChange from './ProfileChange.js'
|
import ProfileChange from './ProfileChange.js'
|
||||||
import { profileArtis } from './ProfileArtis.js'
|
import { profileArtis } from './ProfileArtis.js'
|
||||||
@ -125,7 +126,7 @@ let ProfileDetail = {
|
|||||||
let selfUser = await MysApi.initUser(e)
|
let selfUser = await MysApi.initUser(e)
|
||||||
|
|
||||||
if (!selfUser) {
|
if (!selfUser) {
|
||||||
e.reply('尚未绑定UID')
|
e.reply(['尚未绑定UID', new Button(e).bindUid()])
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -244,7 +245,7 @@ let ProfileDetail = {
|
|||||||
changeProfile: e._profileMsg
|
changeProfile: e._profileMsg
|
||||||
}
|
}
|
||||||
// 渲染图像
|
// 渲染图像
|
||||||
let msgRes = await Common.render('character/profile-detail', renderData, { e, scale: 1.6, retMsgId: true })
|
const msgRes = await e.reply([await Common.render('character/profile-detail', renderData, { e, scale: 1.6, retType: "base64" }), new Button(e).profile(char, uid)])
|
||||||
if (msgRes) {
|
if (msgRes) {
|
||||||
// 如果消息发送成功,就将message_id和图片路径存起来,3小时过期
|
// 如果消息发送成功,就将message_id和图片路径存起来,3小时过期
|
||||||
const message_id = [e.message_id]
|
const message_id = [e.message_id]
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import lodash from 'lodash'
|
import lodash from 'lodash'
|
||||||
import { getTargetUid } from './ProfileCommon.js'
|
import { getTargetUid } from './ProfileCommon.js'
|
||||||
import { Common, Data } from '#miao'
|
import { Common, Data } from '#miao'
|
||||||
import { ProfileRank, Player, Character } from '#miao.models'
|
import { Button, ProfileRank, Player, Character } from '#miao.models'
|
||||||
|
|
||||||
const ProfileList = {
|
const ProfileList = {
|
||||||
/**
|
/**
|
||||||
@ -12,7 +12,7 @@ const ProfileList = {
|
|||||||
async refresh (e) {
|
async refresh (e) {
|
||||||
let uid = await getTargetUid(e)
|
let uid = await getTargetUid(e)
|
||||||
if (!uid) {
|
if (!uid) {
|
||||||
e._replyNeedUid || e.reply('请先发送【#绑定+你的UID】来绑定查询目标\n星铁请使用【#星铁绑定+UID】')
|
e._replyNeedUid || e.reply(['请先发送【#绑定+你的UID】来绑定查询目标\n星铁请使用【#星铁绑定+UID】', new Button(e).bindUid()])
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -21,7 +21,7 @@ const ProfileList = {
|
|||||||
await player.refreshProfile(2)
|
await player.refreshProfile(2)
|
||||||
|
|
||||||
if (!player?._update?.length) {
|
if (!player?._update?.length) {
|
||||||
e._isReplyed || e.reply('获取角色面板数据失败,请确认角色已在游戏内橱窗展示,并开放了查看详情。设置完毕后请5分钟后再进行请求~')
|
e._isReplyed || e.reply(['获取角色面板数据失败,请确认角色已在游戏内橱窗展示,并开放了查看详情。设置完毕后请5分钟后再进行请求~', new Button(e).profileList(uid)])
|
||||||
e._isReplyed = true
|
e._isReplyed = true
|
||||||
} else {
|
} else {
|
||||||
let ret = {}
|
let ret = {}
|
||||||
@ -32,7 +32,7 @@ const ProfileList = {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
if (lodash.isEmpty(ret)) {
|
if (lodash.isEmpty(ret)) {
|
||||||
e._isReplyed || e.reply('获取角色面板数据失败,未能请求到角色数据。请确认角色已在游戏内橱窗展示,并开放了查看详情。设置完毕后请5分钟后再进行请求~')
|
e._isReplyed || e.reply(['获取角色面板数据失败,未能请求到角色数据。请确认角色已在游戏内橱窗展示,并开放了查看详情。设置完毕后请5分钟后再进行请求~', new Button(e).profileList(uid)])
|
||||||
e._isReplyed = true
|
e._isReplyed = true
|
||||||
} else {
|
} else {
|
||||||
e.newChar = ret
|
e.newChar = ret
|
||||||
@ -51,7 +51,7 @@ const ProfileList = {
|
|||||||
async render (e) {
|
async render (e) {
|
||||||
let uid = await getTargetUid(e)
|
let uid = await getTargetUid(e)
|
||||||
if (!uid) {
|
if (!uid) {
|
||||||
e._replyNeedUid || e.reply('请先发送【#绑定+你的UID】来绑定查询目标\n星铁请使用【#星铁绑定+UID】')
|
e._replyNeedUid || e.reply(['请先发送【#绑定+你的UID】来绑定查询目标\n星铁请使用【#星铁绑定+UID】', new Button(e).bindUid()])
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ const ProfileList = {
|
|||||||
await player.refresh({ profile: true })
|
await player.refresh({ profile: true })
|
||||||
}
|
}
|
||||||
if (!player.hasProfile) {
|
if (!player.hasProfile) {
|
||||||
e.reply(`本地暂无uid${uid}[${player.game}]的面板数据...`)
|
e.reply([`本地暂无uid${uid}[${player.game}]的面板数据...`, new Button(e).profileList(uid)])
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
let profiles = player.getProfiles()
|
let profiles = player.getProfiles()
|
||||||
@ -129,7 +129,7 @@ const ProfileList = {
|
|||||||
|
|
||||||
player.save()
|
player.save()
|
||||||
// 渲染图像
|
// 渲染图像
|
||||||
return await Common.render('character/profile-list', {
|
return e.reply([await Common.render('character/profile-list', {
|
||||||
save_id: uid,
|
save_id: uid,
|
||||||
uid,
|
uid,
|
||||||
chars,
|
chars,
|
||||||
@ -141,7 +141,7 @@ const ProfileList = {
|
|||||||
allowRank: rank && rank.allowRank,
|
allowRank: rank && rank.allowRank,
|
||||||
rankCfg,
|
rankCfg,
|
||||||
elem: player.isGs ? 'hydro' : 'sr'
|
elem: player.isGs ? 'hydro' : 'sr'
|
||||||
}, { e, scale: 1.6 })
|
}, { e, scale: 1.6, retType: "base64" }), new Button(e).profileList(uid, newChar)])
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -150,7 +150,7 @@ const ProfileList = {
|
|||||||
* @returns {Promise<boolean>}
|
* @returns {Promise<boolean>}
|
||||||
*/
|
*/
|
||||||
async del (e) {
|
async del (e) {
|
||||||
let ret = /^#(删除全部面板|删除面板|删除面板数据)\s*(\d{9,10})?$/.exec(e.msg)
|
let ret = /^#(删除全部面板|删除面板|删除面板数据)\s*(\d{9})?$/.exec(e.msg)
|
||||||
let uid = await getTargetUid(e)
|
let uid = await getTargetUid(e)
|
||||||
if (!uid) {
|
if (!uid) {
|
||||||
return true
|
return true
|
||||||
@ -164,18 +164,18 @@ const ProfileList = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!targetUid) {
|
if (!targetUid) {
|
||||||
e.reply(`你确认要删除面板数据吗? 请回复 #删除面板${uid} 以删除面板数据`)
|
e.reply([`你确认要删除面板数据吗? 请回复 #删除面板${uid} 以删除面板数据`, new Button(e).profileList(uid)])
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
let ckUids = (user?.ckUids || []).join(',').split(',')
|
let ckUids = (user?.ckUids || []).join(',').split(',')
|
||||||
if (!ckUids.includes(targetUid) && !e.isMaster) {
|
if (!ckUids.includes(targetUid) && !e.isMaster) {
|
||||||
e.reply(`仅允许删除自己的UID数据[${ckUids.join(',')}]`)
|
e.reply([`仅允许删除自己的UID数据[${ckUids.join(',')}]`, new Button(e).profileList(uid)])
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
Player.delByUid(targetUid)
|
Player.delByUid(targetUid)
|
||||||
e.reply(`UID${targetUid}的本地数据已删除,排名数据已清除...`)
|
e.reply([`UID${targetUid}的本地数据已删除,排名数据已清除...`, new Button(e).profileList(uid)])
|
||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import ProfileDetail from './ProfileDetail.js'
|
import ProfileDetail from './ProfileDetail.js'
|
||||||
import { Data, Common, Format, Cfg } from '#miao'
|
import { Data, Common, Format, Cfg } from '#miao'
|
||||||
import { Character, ProfileRank, ProfileDmg, Player } from '#miao.models'
|
import { Button, Character, ProfileRank, ProfileDmg, Player } from '#miao.models'
|
||||||
import lodash from 'lodash'
|
import lodash from 'lodash'
|
||||||
|
|
||||||
export async function groupRank (e) {
|
export async function groupRank (e) {
|
||||||
@ -61,14 +61,14 @@ export async function groupRank (e) {
|
|||||||
return await ProfileDetail.render(e, char)
|
return await ProfileDetail.render(e, char)
|
||||||
} else {
|
} else {
|
||||||
if (mode === 'dmg' && !ProfileDmg.dmgRulePath(char.name, char.game)) {
|
if (mode === 'dmg' && !ProfileDmg.dmgRulePath(char.name, char.game)) {
|
||||||
e.reply(`暂无排名:${char.name}暂不支持伤害计算,无法进行排名..`)
|
e.reply([`暂无排名:${char.name}暂不支持伤害计算,无法进行排名..`, new Button(e).profile(char)])
|
||||||
} else {
|
} else {
|
||||||
e.reply('暂无排名:请通过【#面板】查看角色面板以更新排名信息...')
|
e.reply('暂无排名:请通过【#面板】查看角色面板以更新排名信息...')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (type === 'list') {
|
} else if (type === 'list') {
|
||||||
if (mode === 'dmg' && char && !ProfileDmg.dmgRulePath(char.name, char.game)) {
|
if (mode === 'dmg' && char && !ProfileDmg.dmgRulePath(char.name, char.game)) {
|
||||||
e.reply(`暂无排名:${char.name}暂不支持伤害计算,无法进行排名..`)
|
e.reply([`暂无排名:${char.name}暂不支持伤害计算,无法进行排名..`, new Button(e).profile(char)])
|
||||||
} else {
|
} else {
|
||||||
let uids = []
|
let uids = []
|
||||||
if (char) {
|
if (char) {
|
||||||
@ -80,9 +80,9 @@ export async function groupRank (e) {
|
|||||||
return renderCharRankList({ e, uids, char, mode, groupId })
|
return renderCharRankList({ e, uids, char, mode, groupId })
|
||||||
} else {
|
} else {
|
||||||
if (e.isSr) {
|
if (e.isSr) {
|
||||||
e.reply('暂无排名:请通过【*面板】查看角色面板以更新排名信息...')
|
e.reply(['暂无排名:请通过【*面板】查看角色面板以更新排名信息...', new Button(e).profile(char)])
|
||||||
} else {
|
} else {
|
||||||
e.reply('暂无排名:请通过【#面板】查看角色面板以更新排名信息...')
|
e.reply(['暂无排名:请通过【#面板】查看角色面板以更新排名信息...', new Button(e).profile(char)])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -114,7 +114,7 @@ export async function resetRank (e) {
|
|||||||
charName = char.name
|
charName = char.name
|
||||||
}
|
}
|
||||||
await ProfileRank.resetRank(groupId, charId, game)
|
await ProfileRank.resetRank(groupId, charId, game)
|
||||||
e.reply(`本群${charName}排名已重置...`)
|
e.reply([`本群${charName}排名已重置...`, new Button(e).profile(char)])
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -266,7 +266,7 @@ async function renderCharRankList ({ e, uids, char, mode, groupId }) {
|
|||||||
|
|
||||||
const rankCfg = await ProfileRank.getGroupCfg(groupId)
|
const rankCfg = await ProfileRank.getGroupCfg(groupId)
|
||||||
// 渲染图像
|
// 渲染图像
|
||||||
return await Common.render('character/rank-profile-list', {
|
return e.reply([await Common.render('character/rank-profile-list', {
|
||||||
save_id: char.id,
|
save_id: char.id,
|
||||||
game: e.isSr ? 'sr' : 'gs',
|
game: e.isSr ? 'sr' : 'gs',
|
||||||
list,
|
list,
|
||||||
@ -275,5 +275,5 @@ async function renderCharRankList ({ e, uids, char, mode, groupId }) {
|
|||||||
bodyClass: `char-${char.name}`,
|
bodyClass: `char-${char.name}`,
|
||||||
rankCfg,
|
rankCfg,
|
||||||
mode
|
mode
|
||||||
}, { e, scale: 1.4 })
|
}, { e, scale: 1.4, retType: "base64" }), new Button(e).profile(char)])
|
||||||
}
|
}
|
||||||
|
6
index.js
6
index.js
@ -1,9 +1,11 @@
|
|||||||
import { Data, Version } from '#miao'
|
import { Data, Version } from '#miao'
|
||||||
import Index from './tools/index.js'
|
import Index from './tools/index.js'
|
||||||
|
|
||||||
if (!global.segment) {
|
if (!global.segment)
|
||||||
global.segment = (await import('oicq')).segment
|
global.segment = (await import('oicq')).segment
|
||||||
}
|
|
||||||
|
if (!segment.button)
|
||||||
|
segment.button = () => ""
|
||||||
|
|
||||||
export * from './apps/index.js'
|
export * from './apps/index.js'
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user