koishi-plugin-starfx-bot 0.11.0 → 0.11.2
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/index.js +11 -9
- package/package.json +1 -1
- package/readme.md +2 -0
package/lib/index.js
CHANGED
|
@@ -118,14 +118,6 @@ async function getImageSrc(session, param, option) {
|
|
|
118
118
|
} else if (noParam && !param?.length) {
|
|
119
119
|
return `https://q1.qlogo.cn/g?b=qq&nk=${session.userId}&s=640`;
|
|
120
120
|
}
|
|
121
|
-
const elementArray = session.elements;
|
|
122
|
-
for (const element of elementArray) {
|
|
123
|
-
if (img && element?.type === "img") {
|
|
124
|
-
return element?.attrs?.src;
|
|
125
|
-
} else if (at && element?.type === "at" && element?.attrs?.id) {
|
|
126
|
-
return `https://q1.qlogo.cn/g?b=qq&nk=${element.attrs.id}&s=640`;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
121
|
if (quote) {
|
|
130
122
|
const quoteElementArray = session?.quote?.elements;
|
|
131
123
|
if (quoteElementArray?.length) {
|
|
@@ -138,6 +130,14 @@ async function getImageSrc(session, param, option) {
|
|
|
138
130
|
}
|
|
139
131
|
}
|
|
140
132
|
}
|
|
133
|
+
const elementArray = session.elements;
|
|
134
|
+
for (const element of elementArray) {
|
|
135
|
+
if (img && element?.type === "img") {
|
|
136
|
+
return element?.attrs?.src;
|
|
137
|
+
} else if (at && element?.type === "at" && element?.attrs?.id) {
|
|
138
|
+
return `https://q1.qlogo.cn/g?b=qq&nk=${element.attrs.id}&s=640`;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
141
|
return "";
|
|
142
142
|
}
|
|
143
143
|
__name(getImageSrc, "getImageSrc");
|
|
@@ -504,7 +504,9 @@ function apply(ctx, cfg) {
|
|
|
504
504
|
const p = session.send("图片处理中请稍等...");
|
|
505
505
|
console.log(param);
|
|
506
506
|
const drawConfig = await handleBanGDreamConfig(options);
|
|
507
|
-
const
|
|
507
|
+
const imgSrc = await getImageSrc(session, param);
|
|
508
|
+
if (!imgSrc?.length) return "输入无效";
|
|
509
|
+
const imageBase64 = await drawBanGDream(imgSrc, drawConfig);
|
|
508
510
|
await p;
|
|
509
511
|
return import_koishi2.h.image(imageBase64);
|
|
510
512
|
}
|
package/package.json
CHANGED