2022-07-30 21:06:00 +00:00
|
|
|
import { segment } from 'oicq'
|
2022-06-25 23:45:43 +00:00
|
|
|
|
|
|
|
/** 获取角色卡片的原图 */
|
2022-07-30 21:06:00 +00:00
|
|
|
export async function getOriginalPicture (e) {
|
2022-08-03 18:32:10 +00:00
|
|
|
if (!e.hasReply && !e.source) {
|
2022-07-30 21:06:00 +00:00
|
|
|
return
|
2022-06-25 23:45:43 +00:00
|
|
|
}
|
|
|
|
// 引用的消息不是自己的消息
|
|
|
|
if (e.source.user_id !== e.self_id) {
|
2022-07-30 21:06:00 +00:00
|
|
|
return
|
2022-06-25 23:45:43 +00:00
|
|
|
}
|
|
|
|
// 引用的消息不是纯图片
|
|
|
|
if (!/^\[图片]$/.test(e.source.message)) {
|
2022-07-30 21:06:00 +00:00
|
|
|
return
|
2022-06-25 23:45:43 +00:00
|
|
|
}
|
|
|
|
// 获取原消息
|
2022-07-30 21:06:00 +00:00
|
|
|
let source
|
2022-06-25 23:45:43 +00:00
|
|
|
if (e.isGroup) {
|
2022-07-30 21:06:00 +00:00
|
|
|
source = (await e.group.getChatHistory(e.source.seq, 1)).pop()
|
2022-06-25 23:45:43 +00:00
|
|
|
} else {
|
2022-07-30 21:06:00 +00:00
|
|
|
source = (await e.friend.getChatHistory(e.source.time, 1)).pop()
|
2022-06-25 23:45:43 +00:00
|
|
|
}
|
|
|
|
if (source) {
|
2022-07-30 21:06:00 +00:00
|
|
|
let imgPath = await redis.get(`miao:original-picture:${source.message_id}`)
|
2022-06-25 23:45:43 +00:00
|
|
|
if (imgPath) {
|
2022-07-30 21:06:00 +00:00
|
|
|
e.reply([segment.image(process.cwd() + '/plugins/miao-plugin/resources/' + imgPath)])
|
|
|
|
return true
|
2022-06-25 23:45:43 +00:00
|
|
|
}
|
|
|
|
if (source.time) {
|
2022-07-30 21:06:00 +00:00
|
|
|
let time = new Date()
|
2022-06-25 23:45:43 +00:00
|
|
|
// 对at错图像的增加嘲讽...
|
|
|
|
if (time / 1000 - source.time < 3600) {
|
2022-07-30 21:06:00 +00:00
|
|
|
e.reply([segment.image(process.cwd() + '/plugins/miao-plugin/resources/common/face/what.jpg')])
|
|
|
|
return true
|
2022-06-25 23:45:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-07-30 21:06:00 +00:00
|
|
|
e.reply('消息太过久远了,俺也忘了原图是啥了,下次早点来吧~')
|
|
|
|
return true
|
2022-06-25 23:45:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* #敌人等级 */
|
2022-07-30 21:06:00 +00:00
|
|
|
export async function enemyLv (e) {
|
2022-06-25 23:45:43 +00:00
|
|
|
let selfUser = await e.checkAuth({
|
2022-07-30 21:06:00 +00:00
|
|
|
auth: 'self'
|
2022-06-25 23:45:43 +00:00
|
|
|
})
|
|
|
|
if (!selfUser || !e.msg) {
|
2022-07-30 21:06:00 +00:00
|
|
|
return true
|
2022-06-25 23:45:43 +00:00
|
|
|
}
|
2022-07-30 21:06:00 +00:00
|
|
|
let ret = /(敌人|怪物)等级\s*(\d{1,3})\s*$/.exec(e.msg)
|
2022-06-25 23:45:43 +00:00
|
|
|
if (ret && ret[2]) {
|
2022-07-30 21:06:00 +00:00
|
|
|
let lv = ret[2] * 1
|
|
|
|
await selfUser.setCfg('char.enemyLv', lv)
|
|
|
|
lv = await selfUser.getCfg('char.enemyLv', 91)
|
|
|
|
e.reply(`敌人等级已经设置为${lv}`)
|
|
|
|
return true
|
2022-06-25 23:45:43 +00:00
|
|
|
}
|
2022-07-30 21:06:00 +00:00
|
|
|
return true
|
|
|
|
}
|