mirror of
https://github.com/ctrlcvs/xiaoyao-cvs-plugin.git
synced 2024-12-22 19:10:53 +08:00
新增七圣召唤动态指令 例:#七圣刻晴动态
This commit is contained in:
parent
16d9f7d19c
commit
b998e12a68
@ -1,7 +1,7 @@
|
||||
import lodash from "lodash";
|
||||
import schedule from "node-schedule";
|
||||
import {
|
||||
AtlasAlias
|
||||
AtlasAlias,getBasicVoide
|
||||
} from "./xiaoyao_image.js";
|
||||
import {
|
||||
versionInfo,
|
||||
@ -50,7 +50,7 @@ export {
|
||||
seach, bindLogin_ticket,
|
||||
bbsSign,
|
||||
gclog,
|
||||
mytoken,
|
||||
mytoken, getBasicVoide,
|
||||
bindStoken,
|
||||
updateMiaoPlugin,
|
||||
userInfo,
|
||||
@ -106,6 +106,10 @@ let rule = {
|
||||
reg: "#poke#",
|
||||
describe: "体力",
|
||||
},
|
||||
getBasicVoide: {
|
||||
reg: '#?(动态)',
|
||||
describe: "动态",
|
||||
},
|
||||
...userRule,
|
||||
...signRule,
|
||||
...adminRule
|
||||
|
@ -34,8 +34,48 @@ export async function AtlasAlias(e) {
|
||||
return send_Msg(e, "all", "");
|
||||
}
|
||||
|
||||
|
||||
/** 获取角色卡片的原图 */
|
||||
export async function getBasicVoide(e) {
|
||||
if (!e.hasReply && !e.source) {
|
||||
return true
|
||||
}
|
||||
// 引用的消息不是自己的消息
|
||||
if (e.source.user_id !== e.self_id) {
|
||||
return true
|
||||
}
|
||||
// 引用的消息不是纯图片
|
||||
if (!/^\[图片]$/.test(e.source.message)) {
|
||||
return true
|
||||
}
|
||||
// 获取原消息
|
||||
let source
|
||||
if (e.isGroup) {
|
||||
source = (await e.group.getChatHistory(e.source.seq, 1)).pop()
|
||||
} else {
|
||||
source = (await e.friend.getChatHistory(e.source.time, 1)).pop()
|
||||
}
|
||||
if (source) {
|
||||
let imgPath = await redis.get(`xiaoyao:basic:${source.message_id}`)
|
||||
console.log(imgPath)
|
||||
if (imgPath) {
|
||||
e.reply([segment.video(`file:///${imgPath}`)])
|
||||
return true
|
||||
}
|
||||
if (source.time) {
|
||||
let time = new Date()
|
||||
// 对at错图像的增加嘲讽...
|
||||
if (time / 1000 - source.time < 3600) {
|
||||
e.reply([segment.image(process.cwd() + '/plugins/miao-plugin/resources/common/face/what.jpg')])
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
e.reply('消息太过久远了,俺也忘了动态是啥了,下次早点来吧~')
|
||||
return true
|
||||
}
|
||||
export async function roleInfo(e) {
|
||||
let msg = e.msg.replace(/#|#|信息|图鉴|命座|天赋|原牌|七圣/g, "");
|
||||
let msg = e.msg.replace(/#|#|信息|图鉴|命座|天赋|原牌|七圣|动态/g, "");
|
||||
let Botcfg, id, type = 'juese_tujian';
|
||||
if (isV3) {
|
||||
Botcfg = (await import(`file://${_path}/plugins/genshin/model/gsCfg.js`)).default;
|
||||
@ -84,7 +124,7 @@ const filePath = async function(e) {
|
||||
}
|
||||
}
|
||||
|
||||
const send_Msg = function(e, type, name) {
|
||||
const send_Msg = async function (e, type, name) {
|
||||
let path;
|
||||
if (type == "all") {
|
||||
for (let [index, val] of list.entries()) {
|
||||
@ -103,7 +143,15 @@ const send_Msg = function(e, type, name) {
|
||||
if (!fs.existsSync(path)) {
|
||||
return false;
|
||||
}
|
||||
e.reply(segment.image(`file:///${path}`));
|
||||
let msg = segment.image(`file:///${path}`)
|
||||
try {
|
||||
if (/动态/.test(e.msg)) msg = segment.video(`file:///${path.replace(/\.png|\.jpg/, '.mp4')}`)
|
||||
} catch (error) {
|
||||
Bot.logger.error(`发送七圣动态数据失败:` + error)
|
||||
// error
|
||||
}
|
||||
let { message_id } = await e.reply(msg);
|
||||
await redis.set(`xiaoyao:basic:${message_id}`, path.replace(/\.png|\.jpg/, '.mp4'), 10800); //三小时
|
||||
return true;
|
||||
}
|
||||
export async function Atlas_list(e) {
|
||||
|
Loading…
Reference in New Issue
Block a user