mirror of
https://github.com/yoimiya-kokomi/miao-plugin.git
synced 2024-11-25 17:35:34 +00:00
commit
d14999dcb7
@ -390,7 +390,7 @@ async function renderCard(e, avatar, render, renderType = "card") {
|
|||||||
e.reply(segment.image(process.cwd() + "/plugins/miao-plugin/resources/" + bg.img));
|
e.reply(segment.image(process.cwd() + "/plugins/miao-plugin/resources/" + bg.img));
|
||||||
} else {
|
} else {
|
||||||
//渲染图像
|
//渲染图像
|
||||||
return await Common.render("character/card", {
|
let msgRes = await Common.render("character/card", {
|
||||||
save_id: uid,
|
save_id: uid,
|
||||||
uid,
|
uid,
|
||||||
talent,
|
talent,
|
||||||
@ -400,6 +400,11 @@ async function renderCard(e, avatar, render, renderType = "card") {
|
|||||||
...getCharacterData(avatar),
|
...getCharacterData(avatar),
|
||||||
ds: char.getData("name,id,title,desc"),
|
ds: char.getData("name,id,title,desc"),
|
||||||
}, { e, render, scale: 1.6 });
|
}, { e, render, scale: 1.6 });
|
||||||
|
if (msgRes && msgRes.message_id) {
|
||||||
|
// 如果消息发送成功,就将message_id和图片路径存起来,1小时过期
|
||||||
|
await redis.set(`miao:original-picture:${msgRes.message_id}`, bg.img, {EX: 3600});
|
||||||
|
}
|
||||||
|
return msgRes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -965,3 +970,34 @@ export async function profileHelp(e) {
|
|||||||
e.reply(segment.image(`file://${process.cwd()}/plugins/miao-plugin/resources/character/imgs/help.jpg`))
|
e.reply(segment.image(`file://${process.cwd()}/plugins/miao-plugin/resources/character/imgs/help.jpg`))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 获取角色卡片的原图 */
|
||||||
|
export async function getOriginalPicture(e) {
|
||||||
|
if (!e.hasReply) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 引用的消息不是自己的消息
|
||||||
|
if (e.source.user_id !== e.self_id) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 引用的消息不是纯图片
|
||||||
|
if (!/^\[图片]$/.test(e.source.message)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 获取原消息
|
||||||
|
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(`miao:original-picture:${source.message_id}`);
|
||||||
|
if (imgPath) {
|
||||||
|
e.reply([segment.image(process.cwd() + "/plugins/miao-plugin/resources/" + imgPath)]);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
e.reply("消息太过久远了,俺也忘了原图是啥了,下次早点来吧~");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
@ -18,7 +18,7 @@ export const render = async function (path, params, cfg) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (base64) {
|
if (base64) {
|
||||||
e.reply(segment.image(`base64://${base64}`));
|
return await e.reply(segment.image(`base64://${base64}`));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
10
index.js
10
index.js
@ -6,7 +6,8 @@ import {
|
|||||||
enemyLv,
|
enemyLv,
|
||||||
getArtis,
|
getArtis,
|
||||||
getProfileAll,
|
getProfileAll,
|
||||||
profileHelp
|
profileHelp,
|
||||||
|
getOriginalPicture
|
||||||
} from "./apps/character.js";
|
} from "./apps/character.js";
|
||||||
import { consStat, abyssPct, abyssTeam } from "./apps/stat.js";
|
import { consStat, abyssPct, abyssTeam } from "./apps/stat.js";
|
||||||
import { wiki, calendar } from "./apps/wiki.js";
|
import { wiki, calendar } from "./apps/wiki.js";
|
||||||
@ -34,7 +35,8 @@ export {
|
|||||||
getProfileAll,
|
getProfileAll,
|
||||||
profileHelp,
|
profileHelp,
|
||||||
calendar,
|
calendar,
|
||||||
profileCfg
|
profileCfg,
|
||||||
|
getOriginalPicture
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -60,6 +62,10 @@ let rule = {
|
|||||||
reg: wifeReg,
|
reg: wifeReg,
|
||||||
describe: "【#角色】#老公 #老婆 查询",
|
describe: "【#角色】#老公 #老婆 查询",
|
||||||
},
|
},
|
||||||
|
getOriginalPicture: {
|
||||||
|
reg: "^#(获取|给我|我要|求|发|发下|发个|发一下)?原图(吧|呗)?$",
|
||||||
|
describe: "【#原图】 回复角色卡片,可获取原图",
|
||||||
|
},
|
||||||
consStat: {
|
consStat: {
|
||||||
reg: "^#(喵喵)?角色(持有|持有率|命座|命之座|.命)(分布|统计|持有|持有率)?$",
|
reg: "^#(喵喵)?角色(持有|持有率|命座|命之座|.命)(分布|统计|持有|持有率)?$",
|
||||||
describe: "【#统计】 #角色持有率 #角色5命统计",
|
describe: "【#统计】 #角色持有率 #角色5命统计",
|
||||||
|
Loading…
Reference in New Issue
Block a user