koishi-plugin-w-ygo 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/apis.d.ts +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +6 -5
- package/package.json +5 -5
- package/readme.md +3 -0
package/lib/apis.d.ts
CHANGED
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -43,7 +43,7 @@ var API;
|
|
|
43
43
|
return "禁止";
|
|
44
44
|
}
|
|
45
45
|
}, "showMdmBanStatus");
|
|
46
|
-
API2.
|
|
46
|
+
API2.cardImage = /* @__PURE__ */ __name((template, query) => template.replaceAll("{id}", String(query.id)), "cardImage");
|
|
47
47
|
})(API || (API = {}));
|
|
48
48
|
|
|
49
49
|
// src/index.tsx
|
|
@@ -52,7 +52,8 @@ var name = "w-ygo";
|
|
|
52
52
|
var Config = import_koishi.Schema.object({
|
|
53
53
|
retry: import_koishi.Schema.number().default(3).description("API 请求失败时的重试次数"),
|
|
54
54
|
mdmDefault: import_koishi.Schema.boolean().default(false).description("是否默认启用 Master Duel Meta 信息"),
|
|
55
|
-
showExpiredPacks: import_koishi.Schema.boolean().default(false).description("是否显示过期的 MD 卡包")
|
|
55
|
+
showExpiredPacks: import_koishi.Schema.boolean().default(false).description("是否显示过期的 MD 卡包"),
|
|
56
|
+
cardImageUrl: import_koishi.Schema.string().default("https://cdn.233.momobako.com/ygoimg/sc/{id}.webp").description("卡图 URL 模板,使用 {id} 表示卡片密码")
|
|
56
57
|
});
|
|
57
58
|
function apply(ctx, config) {
|
|
58
59
|
const get = /* @__PURE__ */ __name(async (url, { retry = config.retry } = {}) => {
|
|
@@ -93,16 +94,16 @@ function apply(ctx, config) {
|
|
|
93
94
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { children: [
|
|
94
95
|
"[MD 卡包] ",
|
|
95
96
|
mdmcard.obtain.map((it) => {
|
|
96
|
-
const expired =
|
|
97
|
+
const expired = it.source.expires && new Date(it.source.expires) < /* @__PURE__ */ new Date();
|
|
97
98
|
return { ...it, expired };
|
|
98
|
-
}).filter((it) => !it.expired || config.showExpiredPacks).sort((
|
|
99
|
+
}).filter((it) => !it.expired || config.showExpiredPacks).sort((it) => +it.expired).map((obtain) => `${obtain.source.name}${obtain.expired ? " (过期)" : ""}`).join(", ") || "无"
|
|
99
100
|
] })
|
|
100
101
|
] });
|
|
101
102
|
}
|
|
102
103
|
}
|
|
103
104
|
session.send(/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("message", { forward: true, children: [
|
|
104
105
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("message", { children: [
|
|
105
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", { src: API.
|
|
106
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", { src: API.cardImage(config.cardImageUrl, { id: card.id }), alt: card.en_name }),
|
|
106
107
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { children: [
|
|
107
108
|
"[MD 卡名] ",
|
|
108
109
|
card.md_name || "无"
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "koishi-plugin-w-ygo",
|
|
3
3
|
"description": "WillBot: YuGiOh function",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.4",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
7
7
|
"files": [
|
|
@@ -15,14 +15,14 @@
|
|
|
15
15
|
"plugin"
|
|
16
16
|
],
|
|
17
17
|
"peerDependencies": {
|
|
18
|
-
"koishi": "^4.18.
|
|
18
|
+
"koishi": "^4.18.10"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@satorijs/element": "^3.1.8"
|
|
22
22
|
},
|
|
23
23
|
"scripts": {
|
|
24
|
-
"build": "yarn
|
|
25
|
-
"bump": "yarn
|
|
26
|
-
"pub": "yarn
|
|
24
|
+
"build": "yarn run -T build w-ygo",
|
|
25
|
+
"bump": "yarn run -T bump w-ygo",
|
|
26
|
+
"pub": "yarn run -T pub w-ygo"
|
|
27
27
|
}
|
|
28
28
|
}
|
package/readme.md
CHANGED
|
@@ -3,3 +3,6 @@
|
|
|
3
3
|
[](https://www.npmjs.com/package/koishi-plugin-w-ygo)
|
|
4
4
|
|
|
5
5
|
WillBot: YuGiOh function
|
|
6
|
+
|
|
7
|
+
卡图默认使用百鸽提供的简体中文卡图,也可以通过 `cardImageUrl` 配置含 `{id}` 占位符的 URL 模板。
|
|
8
|
+
如需使用 YGOPRODeck 的英文卡图,可以配置为 `https://images.ygoprodeck.com/images/cards/{id}.jpg`。
|