diff --git a/apps/help.js b/apps/help.js new file mode 100644 index 0000000..7314b7a --- /dev/null +++ b/apps/help.js @@ -0,0 +1,12 @@ +import { segment } from "oicq"; + +const _path = process.cwd(); +export async function calendar(e) { + e.reply("当前版本支持:\n角色、武器、食谱、怪物、圣遗物\n指令例:魔女图鉴") + return true; +} + +export async function versionInfo(e) { + e.reply("当前图鉴版本:1.0.1") + return true; +} \ No newline at end of file diff --git a/apps/xiaoyao_image.js b/apps/xiaoyao_image.js index e0d976d..9d1ac1b 100644 --- a/apps/xiaoyao_image.js +++ b/apps/xiaoyao_image.js @@ -2,11 +2,24 @@ import { segment } from "oicq"; import fs from "fs"; - +import Data from "../components/Data.js" import path from 'path'; +import fetch from "node-fetch"; const _path = process.cwd(); const __dirname = path.resolve(); +const list = ["shiwu_tujian", "yuanmo_tujian"] +export async function AtlasAlias(e) { + if (await roleInfo(e)) return true; + if (await weaponInfo(e)) return true; + // if (await foodInfo(e)) return true; + if (await RelicsInfo(e)) return true; + // if (await monsterInfo(e)) return true; + var name = e.msg.replace(/#|#|信息|图鉴|命座|天赋|突破|圣遗物|原魔|食物|食材|的|特殊|材|料|特色|料理|理|色/g, ""); + send_Msg(e, "all", name) +} + + export async function roleInfo(e) { // let msg=e.msg.replace(/#|图鉴/g,""); let msg = e.msg.replace(/#|#|信息|图鉴|命座|天赋|突破/g, ""); @@ -27,31 +40,19 @@ export async function roleInfo(e) { } const send_Msg = function(e, type, name) { + if (type == "all") { + for (let val of list) { + let new_name = info_img(e, Data.readJSON(`${_path}/plugins/xiaoyao-cvs-plugin/resources/Atlas_alias/`, + val), name) + if (new_name) { + name = new_name + type = val; + break; + } + } + } let path = `${_path}/plugins/xiaoyao-cvs-plugin/resources/xiaoyao-plus/${type}/${name}.png` if (!fs.existsSync(path)) { - // 异步读取上级目录下的所有文件 - fs.readdir(`${_path}/plugins/xiaoyao-cvs-plugin/resources/xiaoyao-plus/${type}`, function(err, files) { - if (err) { - e.reply("出问题了呢建议检查/plugins/xiaoyao-cvs-plugin/resources/xiaoyao-plus/" + type + "有没有") - return true - } else { - let new_files = []; - for (let i = 0; i < files.length; i++) { - for (var j = 0; j < name.length; j++) { - if (files[i].indexOf(name[j]) >= 0) { - new_files.push(files[i]) - break; - } - } - } - if (new_files.length == 0) { - e.reply("刻晴没有找到你想要的" + name+ "哦") - return true; - } - e.reply("没有找到指定文件呢,您要找的是否是这些:\n"+new_files.join(",").replace(/,/g, ',\n').replace(/(.amr|.mp3|.mp4|.jpg|.png)/g,"")) - return true; - } - }); return true; } e.reply(segment.image(`file:///${path}`)); @@ -92,47 +93,29 @@ export async function weaponInfo(e) { return false; } -export async function foodInfo(e) { - - let msg = e.msg || ''; - - if (e.atBot) { - msg = "#" + msg.replace("#", ""); - } - if (!/(#*食物(.*)|#(.*))$/.test(msg)) return; - let name = msg.replace(/#|#|信息|图鉴|食物/g, ""); - if (name) { - send_Msg(e, "shiwu_tujian", name) - return true; - } - return false; -} - export async function RelicsInfo(e) { let msg = e.msg || ''; if (e.atBot) { msg = "#" + msg.replace("#", ""); } - if (!/(#*圣遗物(.*)|#(.*))$/.test(msg)) return; - let name = msg.replace(/#|#|信息|副本|本|圣遗物/g, ""); + // if (!/(#*圣遗物(.*)|#(.*))$/.test(msg)) return; + let name = msg.replace(/#|#|信息|副本|本|圣遗物|图鉴/g, ""); + let response = await fetch(`https://info.minigg.cn/artifacts?query=${encodeURIComponent(name)}`); + let res = await response.json(); + if (res?.errcode == "10006") return false; + name = res["name"]; if (name) { send_Msg(e, "shengyiwu_tujian", name) return true; } return false; } - - -export async function monsterInfo(e) { - let msg = e.msg || ''; - if (e.atBot) { - msg = "#" + msg.replace("#", ""); +const info_img = function(e, list, name) { + for (let i in list) { + for (let val of list[i]) { + if (val == name) { + return i; + } + } } - if (!/(#*(原魔|怪物)(.*)|#(.*))$/.test(msg)) return; - let name = msg.replace(/#|#|信息|副本|本|图鉴|数据|原魔/g, ""); - if (name) { - send_Msg(e, "yuanmo_tujian", name) - return true; - } - return false; } diff --git a/index.js b/index.js index 9036ba4..bea4985 100644 --- a/index.js +++ b/index.js @@ -1,15 +1,16 @@ import lodash from "lodash"; import { - roleInfo,weaponInfo,monsterInfo,RelicsInfo,foodInfo -} from "./apps/xiaoyao_image.js" + AtlasAlias +} from "./apps/xiaoyao_image.js"; +import {versionInfo,calendar} from "./apps/help.js" import { rule as adminRule, updateRes, updateMiaoPlugin } from "./apps/admin.js"; export { - updateRes,updateMiaoPlugin, - roleInfo,weaponInfo,monsterInfo,foodInfo,RelicsInfo + updateRes,updateMiaoPlugin,versionInfo,calendar, + AtlasAlias }; @@ -22,26 +23,10 @@ let rule = { reg: "^#图鉴列表$", describe: "【#日历】 活动日历", }, - roleInfo: { - reg: "#*(.*)(信息|图鉴|命座|天赋|突破|材料|素材)$", //匹配消息正则,命令正则 + AtlasAlias:{ + reg: "#*(.*)(信息|图鉴|命座|天赋|突破|材料|素材|特色料理|特殊料理)$", //匹配消息正则,命令正则 describe: "【刻晴信息、刻晴图鉴、刻晴突破、刻晴命座】角色信息图鉴", //【命令】功能说明 }, - weaponInfo: { - reg: "", //匹配消息正则,命令正则 - describe: "武器图鉴【匹配规则】", //【命令】功能说明 - }, - foodInfo:{ - reg: "#食物(.*)$", //匹配消息正则,命令正则 - describe: "食物图鉴", //【命令】功能说明 - }, - RelicsInfo:{ - reg: "#圣遗物(.*)$", //匹配消息正则,命令正则 - describe: "圣遗物图鉴", //【命令】功能说明 - }, - monsterInfo:{ - reg: "#原魔(.*)$", //匹配消息正则,命令正则 - describe: "原魔图鉴", //【命令】功能说明 - }, ...adminRule }; diff --git a/resources/Atlas_alias/shiwu_tujian.json b/resources/Atlas_alias/shiwu_tujian.json new file mode 100644 index 0000000..d4dfe86 --- /dev/null +++ b/resources/Atlas_alias/shiwu_tujian.json @@ -0,0 +1,99 @@ +{ + "薄荷果冻": ["薄荷果冻", "饱腹感凝胶", "埃洛伊"], + "火火肉酱面": ["火火肉酱面", "魔法肉酱面", "丽莎"], + "白汁时蔬烩肉": ["白汁时蔬烩肉", "辣味时蔬烩肉", "芭芭拉"], + "庄园烤松饼": ["庄园烤松饼", "厚云朵松饼", "诺艾尔"], + "嘟嘟莲海鲜羹": ["嘟嘟莲海鲜羹", "极致一钓", "达达利亚"], + "黄油松茸": ["黄油松茸"], + "堆高高": ["堆高高", "蒙德往事", "迪卢克"], + "蒙德土豆饼": ["蒙德土豆饼", "爪爪土豆饼", "雷泽"], + "冷肉拼盘": ["冷肉拼盘", "祝圣交响乐", "菲谢尔"], + "鲜虾脆薯盏": ["鲜虾脆薯盏"], + "稠汁蔬菜炖肉": ["稠汁蔬菜炖肉"], + "黄油煎鱼": ["黄油煎鱼", "林之梦", "阿贝多"], + "蜜酱胡萝卜煎肉": ["蜜酱胡萝卜煎肉"], + "烤蘑菇披萨": ["烤蘑菇披萨", "提神醒脑披萨", "琴"], + "蟹黄火腿焗时蔬": ["蟹黄火腿焗时蔬", "伍玖叁式营养餐", "砂糖"], + "冒险家蛋堡": ["冒险家蛋堡"], + "月亮派": ["月亮派", "骇浪派", "优菈"], + "北地苹果焖肉": ["北地苹果焖肉"], + "烤吃虎鱼": ["烤吃虎鱼", "绝境求生烤鱼", "刻晴"], + "米窝窝": ["米窝窝"], + "香嫩椒椒鸡": ["香嫩椒椒鸡", "摇●滚●鸡!", "辛焱"], + "干炒鱼河": ["干炒鱼河"], + "岩港三鲜": ["岩港三鲜"], + "凉拌薄荷": ["凉拌薄荷"], + "素鲍鱼": ["素鲍鱼", "幽幽大行军", "胡桃"], + "水晶虾": ["水晶虾", "江湖百味", "行秋"], + "北地烟熏鸡": ["北地烟熏鸡"], + "山珍热卤面": ["山珍热卤面", "山珍凉卤面", "重云"], + "莲子禽蛋羹": ["莲子禽蛋羹", "云遮玉", "云堇"], + "蟹黄豆腐": ["蟹黄豆腐", "自有方圆", "烟绯"], + "四方和平": ["四方和平", "盛世太平", "甘雨"], + "松鼠鱼": ["松鼠鱼"], + "来来菜": ["来来菜", "没有未来菜", "七七"], + "轻策农家菜": ["轻策农家菜"], + "绝云锅巴": ["绝云锅巴"], + "干锅腊肉": ["干锅腊肉"], + "腌笃鲜": ["腌笃鲜", "文火慢炖腌笃鲜", "钟离"], + "清炒虾仁": ["清炒虾仁", "沾露虾仁", "夜兰"], + "兽肉薄荷卷": ["兽肉薄荷卷"], + "水煮黑背鲈": ["水煮黑背鲈", "万民堂水煮鱼", "香菱"], + "明月蛋": ["明月蛋"], + "金丝虾球": ["金丝虾球"], + "龙须面": ["龙须面", "连心面", "申鹤"], + "扣三丝": ["扣三丝", "海灯节特色扣三丝"], + "莲花酥": ["莲花酥"], + "鸡豆花": ["鸡豆花"], + "中原杂碎": ["中原杂碎"], + "仙跳墙": ["仙跳墙"], + "天枢肉": ["天枢肉"], + "翡玉什锦袋": ["翡玉什锦袋"], + "干烧香鱼": ["干烧香鱼", "雨奇晴好", "枫原万叶"], + "鸟蛋寿司": ["鸟蛋寿司", "奇策", "珊瑚宫心海"], + "鸟蛋烧": ["鸟蛋烧", "永恒的信仰", "九条裟罗"], + "荞麦面": ["荞麦面"], + "甜虾寿司": ["甜虾寿司"], + "味噌汤": ["味噌汤", "暖意", "托马"], + "黄金蟹": ["黄金蟹"], + "炸肉排三明治": ["炸肉排三明治"], + "爆炒肉片": ["爆炒肉片", "炝炒肉片", "北斗"], + "乌冬面": ["乌冬面", "福内乌冬", "八重神子"], + "山家烧": ["山家烧"], + "金枪鱼寿司": ["金枪鱼寿司"], + "鲜鱼炖萝卜": ["鲜鱼炖萝卜"], + "蒲烧鳗肉": ["蒲烧鳗肉"], + "杏仁豆腐": ["杏仁豆腐", "美梦", "魈"], + "若竹煮": ["若竹煮"], + "什锦炒面": ["什锦炒面", "强者之道", "荒泷一斗"], + "松茸酿肉卷": ["松茸酿肉卷"], + "树莓水馒头": ["树莓水馒头"], + "三彩团子": ["三彩团子", "夏祭游鱼", "宵宫"], + "蛋包饭": ["蛋包饭"], + "五宝腌菜": ["五宝腌菜"], + "多多烧": ["多多烧"], + "绯樱虾仙贝": ["绯樱虾仙贝"], + "珍珠翡翠白玉汤": ["珍珠翡翠白玉汤", "海灯节特色白玉汤"], + "串串三味": ["串串三味"], + "鳗肉茶泡饭": ["鳗肉茶泡饭"], + "日落鲷鱼烧": ["日落鲷鱼烧"], + "兽骨拉面": ["兽骨拉面", "常胜传说", "五郎"], + "摩拉肉": ["摩拉肉", "乾坤摩拉肉", "凝光"], + "蟹黄壳壳烧": ["蟹黄壳壳烧"], + "饭团": ["饭团", "头晕回避术·改", "早柚"], + "绯樱饼": ["绯樱饼", "红炉一点雪", "神里绫华"], + "绀田煮": ["绀田煮"], + "活力喵饭": ["活力喵饭"], + "渡来禽肉": ["渡来禽肉"], + "绯樱天妇罗": ["绯樱天妇罗", "静寂闲雅", "神里绫人"], + "黄油蟹蟹": ["黄油蟹蟹"], + "文心豆腐": ["文心豆腐"], + "米饭布丁": ["米饭布丁"], + "红烩兽肉": ["红烩兽肉"], + "脆脆鸡腿堡": ["脆脆鸡腿堡"], + "辣肉窝窝头": ["辣肉窝窝头"], + "大黄金吮指鸡": ["大黄金吮指鸡"], + "市井杂煮": ["市井杂煮"], + "丰年有余": ["丰年有余"], + "香浓土豆泥": ["香浓土豆泥"] +} diff --git a/resources/Atlas_alias/yuanmo_tujian.json b/resources/Atlas_alias/yuanmo_tujian.json new file mode 100644 index 0000000..b42e7af --- /dev/null +++ b/resources/Atlas_alias/yuanmo_tujian.json @@ -0,0 +1,146 @@ +{ + "公子": ["周本公子", "公子周本", "原魔公子", "原魔达达利亚", "周本达达利亚", "达达利亚周本"], + "女士": ["女士", "周本女士", "女士周本", "愚人众女士", "火之魔女", "火魔女"], + "北风的王狼": ["奔狼的领主", "北风狼", "狼王", "周本狼王", "狼王周本"], + "祸津御建鸣神命": ["原魔雷神", "原魔雷电将军", "周本雷电将军", "雷电将军周本", "周本雷神", "雷神周本"], + "若陀龙王": ["肥坨", "龙王", "若陀", "肥宅", "钟离坐骑"], + "裂空的魔龙": ["风魔龙", "风龙", "特瓦林", "温迪坐骑"], + + "雷史莱姆": ["小型雷史莱姆"], + "冰史莱姆": ["小型冰史莱姆"], + "火史莱姆": ["小型火史莱姆"], + "水史莱姆": ["小型水史莱姆"], + "风史莱姆": ["小型风史莱姆", "史莱姆"], + "岩史莱姆": ["小型岩史莱姆"], + "草史莱姆": ["小型草史莱姆"], + + "大型雷史莱姆": ["大雷史莱姆"], + "大型冰史莱姆": ["大冰史莱姆"], + "大型火史莱姆": ["大火史莱姆"], + "大型水史莱姆": ["大水史莱姆"], + "大型风史莱姆": ["大风史莱姆", "大史莱姆"], + "大型岩史莱姆": ["大岩史莱姆"], + "大型草史莱姆": ["大草史莱姆"], + "变异雷史莱姆": ["变异史莱姆", "大黄雷史莱姆", "黄雷史莱姆"], + + "雷飘浮灵": ["雷漂浮灵"], + "冰飘浮灵": ["冰漂浮灵"], + "火飘浮灵": ["火漂浮灵"], + "水飘浮灵": ["水漂浮灵"], + "风飘浮灵": ["风漂浮灵"], + "岩飘浮灵": ["岩漂浮灵"], + "浮游水蕈兽": ["水蕈兽", "浮游水"], + + "狂风之核": ["狂风核", "风核"], + + "无相之冰": ["无相冰", "塔勒特"], + "无相之雷": ["无相雷", "阿莱夫"], + "无相之火": ["无相火", "亚因"], + "无相之水": ["无相水", "希伊"], + "无相之岩": ["无相岩", "基末尔"], + "无相之风": ["无相风", "贝特"], + "纯水精灵": ["纯水", "洛蒂娅"], + "雷音权现": ["雷鸟", "雷霆的大鹫", "菅名卡帕奇莉", "卡帕奇莉"], + "黄金王兽": ["黄金狗", "大流血狗"], + "急冻树": ["冰树","急冻树"], + "爆炎树": ["火树","爆炎树"], + + "丘丘岩盔王": ["岩丘丘王"], + "丘丘雷兜王": ["雷丘丘王"], + "丘丘霜铠王": ["冰丘丘王"], + "射手丘丘人": ["弓箭丘丘人"], + "冰弹丘丘人": ["冰丘丘人"], + "冰箭丘丘人": ["冰弓丘丘人"], + "火箭丘丘人": ["火弓丘丘人"], + "爆弹丘丘人": ["火丘丘人"], + "雷箭丘丘人": ["雷弓丘丘人"], + "雷弹丘丘人": ["雷丘丘人"], + "冰盾丘丘暴徒": ["冰丘丘暴徒"], + "岩盾丘丘暴徒": ["岩丘丘暴徒"], + "火斧丘丘暴徒": ["火丘丘暴徒"], + "雷盾丘丘暴徒": ["雷丘丘暴徒"], + "奇怪的丘丘人": ["大伟丘"], + "冰丘丘萨满": ["冰萨满"], + "风丘丘萨满": ["风萨满"], + "岩丘丘萨满": ["岩萨满"], + "草丘丘萨满": ["草萨满"], + "雷丘丘萨满": ["雷萨满"], + "水丘丘萨满": ["水萨满"], + + "愚人众·冰萤术士": ["冰萤术士", "冰莹术士"], + "愚人众·火之债务处理人": ["火之债务处理人", "债务处理人", "债务人"], + "愚人众·藏镜仕女": ["藏镜仕女", "镜女"], + "愚人众·雷萤术士": ["原魔雷莹术士", "原魔雷萤术士"], + "愚人众先遣队·冰铳重卫士": ["冰铳重卫士", "愚人众冰铳", "冰铳", "冰胖"], + "愚人众先遣队·岩使游击兵": ["岩使游击兵", "愚人众岩铳", "岩铳", "岩使"], + "愚人众先遣队·水铳重卫士": ["水铳重卫士", "愚人众水铳", "水铳", "水胖"], + "愚人众先遣队·火铳游击兵": ["火铳游击兵", "愚人众火铳", "火铳", "火枪"], + "愚人众先遣队·雷锤前锋军": ["雷锤前锋军", "愚人众雷锤", "雷锤", "雷锤哥"], + "愚人众先遣队·风拳前锋军": ["风拳前锋军", "愚人众风拳", "风拳", "风拳哥"], + + "冰萤": ["冰荧", "冰莹"], + "水萤": ["水荧", "水莹"], + "雷萤": ["雷荧", "雷莹"], + + "盗宝团·雷之药剂师": ["雷之药剂师", "盗宝团雷"], + "盗宝团·粉碎者": ["粉碎者"], + "盗宝团·神射手": ["神射手"], + "盗宝团·火之药剂师": ["火之药剂师", "盗宝团火"], + "盗宝团·海上男儿": ["海上男儿"], + "盗宝团·水之药剂师": ["水之药剂师", "盗宝团水"], + "盗宝团·杂工": ["杂工"], + "盗宝团·斥候": ["斥候"], + "盗宝团·掘墓者": ["掘墓者"], + "盗宝团·拳术家": ["拳术家"], + "盗宝团·冰之药剂师": ["冰之药剂师", "盗宝团冰"], + + "海乱鬼·炎威": ["火海乱鬼", "火武士"], + "海乱鬼·雷腾": ["雷海乱鬼", "海乱鬼", "雷武士"], + "野伏·机巧番": ["机巧番"], + "野伏·火付番": ["火付番"], + "野伏·阵刀番": ["阵刀番", "野伏众"], + + "冰霜骗骗花": ["冰骗骗花"], + "炽热骗骗花": ["火骗骗花"], + "电气骗骗花": ["雷骗骗花", "骗骗花"], + + "恒常机关阵列": ["恒常机关", "无相铁"], + "遗迹巨蛇": ["巨蛇", "大蛇", "铁蛇", "岩蛇"], + "魔偶剑鬼": ["剑鬼", "魔偶"], + "遗迹守卫": ["独眼小宝", "小宝", "守卫"], + "遗迹猎者": ["猎者"], + "遗迹重机": ["重机", "独眼大宝", "大宝"], + "遗迹侦察者": ["侦察者"], + "遗迹巡弋者": ["巡弋者"], + "遗迹歼击者": ["歼击者"], + "遗迹防卫者": ["防卫者"], + + "古岩龙蜥": ["古龙蜥"], + "岩龙蜥": ["龙蜥"], + "幼岩龙蜥": ["幼龙蜥", "小龙蜥"], + + "大雪猪王": ["大雪猪", "雪猪王"], + + "深渊使徒·激流": ["激流", "水使徒"], + "深渊咏者·渊火": ["渊火", "火使徒", "火咏者"], + "深渊咏者·紫电": ["紫电", "雷使徒", "雷咏者"], + "火深渊法师": ["火法师"], + "水深渊法师": ["水法师"], + "冰深渊法师": ["冰法师"], + "雷深渊法师": ["雷法师"], + + "深海龙蜥·吞雷": ["吞雷", "雷龙蜥"], + "深海龙蜥·啮冰": ["啮冰", "冰龙蜥"], + "深海龙蜥·原种": ["原种", "原种龙蜥"], + "深海龙蜥之群": ["深海龙蜥", "深海龙蜥群"], + + "嗜岩·兽境幼兽": ["岩兽境幼兽", "小岩流血狗"], + "嗜雷·兽境幼兽": ["雷兽境幼兽", "小雷流血狗", "小流血狗"], + "嗜雷·兽境猎犬": ["雷兽境猎犬", "雷流血狗", "流血狗"], + "嗜岩·兽境猎犬": ["岩兽境猎犬", "岩流血狗"], + + "黑蛇骑士·斩风之剑": ["黑蛇骑士", "黑蛇众"], + "黯色空壳·旗令": ["黯色空壳", "火黯色空壳"], + "黯色空壳·破阵": ["雷黯色空壳"], + "黯色空壳·近卫": ["冰黯色空壳"] +} \ No newline at end of file