mirror of
https://github.com/yoimiya-kokomi/miao-plugin.git
synced 2024-11-16 04:35:42 +00:00
支持戳一戳返回喵喵版角色卡片
This commit is contained in:
parent
acdc50f49f
commit
5394a429df
22
CHANGELOG.md
22
CHANGELOG.md
@ -1,27 +1,25 @@
|
||||
# 1.8.4
|
||||
# 1.8.5
|
||||
|
||||
* 支持戳一戳返回喵喵版角色卡片
|
||||
* 需要使用喵喵分支Yunzai以支持此能力,如需切换可在Yunzai跟目录输入下方命令后更新重启
|
||||
* `git remote set-url origin https://gitee.com/yoimiya-kokomi/Yunzai-Bot`
|
||||
* 可通过`#喵喵设置` 关闭戳一戳
|
||||
* 增加鹿野院平藏的角色图片
|
||||
|
||||
# 1.8.1~1.8.4
|
||||
|
||||
* 新增`#上传深渊数据`命令
|
||||
* 可上传自己角色的深渊挑战数据及角色列表,不会上传其他信息
|
||||
* 上传数据用于`#角色持有率 #深渊出场率`等统计,可使统计更加及时准确
|
||||
* 数据统计及服务来自SG团队胡桃API
|
||||
* 新增角色 派蒙、瑶瑶、白术、伐难、应达、散兵、女士、萍儿 的角色配置及图片
|
||||
|
||||
# 1.8.3
|
||||
|
||||
* `#刻晴` 角色卡片功能升级
|
||||
* `#老婆设置刻晴,心海`不再检查是否具有角色或展示在米游社展柜
|
||||
* `#刻晴` 角色卡片优先使用面板数据进行展示,无面板数据时使用米游社数据
|
||||
* 在未能获取到角色数据时也会展示角色卡片
|
||||
* 角色卡片后续会进行样式升级,按需展示更多内容
|
||||
* 支持定义新角色及别名
|
||||
* 新增角色 派蒙、瑶瑶、白术、伐难、散兵 的角色配置及图片
|
||||
* 新增角色 派蒙、瑶瑶、白术、伐难、应达、散兵、女士、萍儿 的角色配置及图片
|
||||
* 自定义角色可使用`#派蒙` `#派蒙图片`触发图片查看,`#女儿设置派蒙`进行设置。后续会支持更多场景
|
||||
* 如需扩展可在喵喵config/character.js中定义
|
||||
* `#深渊出场率`增加楼层排序,以防止服务侧数据乱序导致顺序错乱
|
||||
* B服面板的天赋与皇冠信息现在可以正确的展示了
|
||||
|
||||
# 1.8.1~1.8.2
|
||||
|
||||
* `#喵喵帮助`增加对自定义配置文件的支持
|
||||
* 已有配置文件可更名为help-cfg.js,防止后续更新冲突,后续会支持更多配置项
|
||||
* 在默认配置中增加部分新帮助命令
|
||||
|
@ -13,6 +13,7 @@ let cfgMap = {
|
||||
"角色": "char.char",
|
||||
"面板": "char.profile-data",
|
||||
"老婆": "char.wife",
|
||||
"戳一戳": "char.poke",
|
||||
"小清新": "char.se",
|
||||
"查他人": "char.queryOther",
|
||||
"图鉴": "wiki.wiki",
|
||||
@ -90,6 +91,7 @@ export async function sysCfg(e, { render }) {
|
||||
chars: getStatus("char.char"),
|
||||
profile: getStatus("char.profile-data"),
|
||||
wife: getStatus("char.wife"),
|
||||
poke: getStatus("char.poke"),
|
||||
se: getStatus("char.se", false),
|
||||
other: getStatus("char.queryOther"),
|
||||
wiki: getStatus("wiki.wiki"),
|
||||
|
@ -18,7 +18,7 @@ export { getProfileAll, getProfile, profileHelp };
|
||||
export { profileArtisList } from "./character/profile-artis.js";
|
||||
|
||||
// 老婆
|
||||
export { wife, wifeReg } from "./character/avatar-wife.js";
|
||||
export { wife, pokeWife, wifeReg } from "./character/avatar-wife.js";
|
||||
|
||||
import { Character } from "../components/models.js";
|
||||
|
||||
|
@ -95,7 +95,7 @@ async function renderCard(e, avatar, render, renderType = "card") {
|
||||
// 如果消息发送成功,就将message_id和图片路径存起来,1小时过期
|
||||
await redis.set(`miao:original-picture:${msgRes.message_id}`, bg.img, { EX: 3600 });
|
||||
}
|
||||
return msgRes;
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -37,15 +37,22 @@ export const wifeReg = `^#?\\s*(${relation.join("|")})\\s*(设置|选择|指定|
|
||||
|
||||
export async function wife(e, { render, User }) {
|
||||
let msg = e.msg || "";
|
||||
if (!msg) return false;
|
||||
if (!msg && !e.isPoke) return false;
|
||||
|
||||
if (Cfg.isDisable(e, "char.wife")) {
|
||||
if (e.isPoke) {
|
||||
if (Cfg.isDisable(e, "char.poke")) {
|
||||
return false;
|
||||
}
|
||||
} else if (Cfg.isDisable(e, "char.wife")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let msgRet = (new RegExp(wifeReg)).exec(msg);
|
||||
if (!msgRet) return false;
|
||||
|
||||
if (e.isPoke) {
|
||||
msgRet = [];
|
||||
} else if (!msgRet) {
|
||||
return false;
|
||||
}
|
||||
let target = msgRet[1],
|
||||
action = msgRet[2] || "卡片",
|
||||
actionParam = msgRet[3] || "";
|
||||
@ -58,7 +65,7 @@ export async function wife(e, { render, User }) {
|
||||
cfg.key = key;
|
||||
return cfg.keyword.includes(target);
|
||||
});
|
||||
if (!targetCfg) return true;
|
||||
if (!targetCfg && !e.isPoke) return true;
|
||||
|
||||
let avatarList = [], avatar = {}, wifeList = [];
|
||||
|
||||
@ -87,30 +94,38 @@ export async function wife(e, { render, User }) {
|
||||
// 展示老婆卡片
|
||||
|
||||
// 如果选择过,则进行展示
|
||||
wifeList = await selfUser.getCfg(`wife.${targetCfg.key}`, []);
|
||||
let renderType = action === "卡片" ? "card" : "photo";
|
||||
// 存在设置
|
||||
if (wifeList && wifeList.length > 0 && isSelf) {
|
||||
if (wifeList[0] === "随机") {
|
||||
// 如果选择为全部,则从列表中随机选择一个
|
||||
avatarList = await getAvatarList(e, targetCfg.type, MysApi);
|
||||
let avatar = lodash.sample(avatarList);
|
||||
return renderAvatar(e, avatar, render, renderType);
|
||||
} else {
|
||||
// 如果指定过,则展示指定角色
|
||||
return renderAvatar(e, lodash.sample(wifeList), render, renderType);
|
||||
if (!e.isPoke) {
|
||||
wifeList = await selfUser.getCfg(`wife.${targetCfg.key}`, []);
|
||||
// 存在设置
|
||||
if (wifeList && wifeList.length > 0 && isSelf && !e.isPoke) {
|
||||
if (wifeList[0] === "随机") {
|
||||
// 如果选择为全部,则从列表中随机选择一个
|
||||
avatarList = await getAvatarList(e, targetCfg.type, MysApi);
|
||||
let avatar = lodash.sample(avatarList);
|
||||
return renderAvatar(e, avatar, render, renderType);
|
||||
} else {
|
||||
// 如果指定过,则展示指定角色
|
||||
return renderAvatar(e, lodash.sample(wifeList), render, renderType);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 如果未指定过,则从列表中排序并随机选择前5个
|
||||
if (e.isPoke) {
|
||||
avatarList = await getAvatarList(e, false, MysApi);
|
||||
if (avatarList && avatarList.length > 0) {
|
||||
avatar = lodash.sample(avatarList);
|
||||
return await renderAvatar(e, avatar, render, renderType);
|
||||
}
|
||||
} else {
|
||||
// 如果未指定过,则从列表中排序并随机选择前5个
|
||||
avatarList = await getAvatarList(e, targetCfg.type, MysApi);
|
||||
if (avatarList && avatarList.length > 0) {
|
||||
avatar = lodash.sample(avatarList.slice(0, 5));
|
||||
return renderAvatar(e, avatar, render, renderType);
|
||||
} else {
|
||||
e.reply(`在当前米游社公开展示的角色中未能找到适合展示的角色..`);
|
||||
return true;
|
||||
return await renderAvatar(e, avatar, render, renderType);
|
||||
}
|
||||
}
|
||||
e.reply(`在当前米游社公开展示的角色中未能找到适合展示的角色..`);
|
||||
return true;
|
||||
break;
|
||||
case "设置":
|
||||
case "选择":
|
||||
@ -168,3 +183,7 @@ export async function wife(e, { render, User }) {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
export async function pokeWife(e, components) {
|
||||
return await wife(e, components);
|
||||
}
|
5
index.js
5
index.js
@ -2,6 +2,7 @@ export {
|
||||
character,
|
||||
getProfile,
|
||||
wife,
|
||||
pokeWife,
|
||||
enemyLv,
|
||||
profileArtisList,
|
||||
getProfileAll,
|
||||
@ -63,6 +64,10 @@ let rule = {
|
||||
reg: wifeReg,
|
||||
describe: "【#角色】#老公 #老婆 查询",
|
||||
},
|
||||
pokeWife: {
|
||||
reg: "#poke#",
|
||||
describe: "【#角色】戳一戳",
|
||||
},
|
||||
getOriginalPicture: {
|
||||
reg: "^#?(获取|给我|我要|求|发|发下|发个|发一下)?原图(吧|呗)?$",
|
||||
describe: "【#原图】 回复角色卡片,可获取原图",
|
||||
|
@ -34,6 +34,13 @@
|
||||
{{@wife}}
|
||||
</div>
|
||||
</li>
|
||||
<li class="cfg-li">
|
||||
<div class="cfg-line">
|
||||
戳一戳卡片
|
||||
<span class="cfg-hint"> #喵喵设置戳一戳 + 开启/关闭</span>
|
||||
{{@poke}}
|
||||
</div>
|
||||
</li>
|
||||
<li class="cfg-li">
|
||||
<div class="cfg-line">
|
||||
允许查他人
|
||||
|
Loading…
Reference in New Issue
Block a user