koishi-plugin-node-async-bot-all 2.24.8 → 2.24.9
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 +20 -4
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -372,6 +372,7 @@ async function getServer(ctx, session) {
|
|
|
372
372
|
if (type == "a2s") {
|
|
373
373
|
const info = await queryA2S(api, log);
|
|
374
374
|
if (info.success) {
|
|
375
|
+
log.debug(info);
|
|
375
376
|
const temp = {
|
|
376
377
|
"count": count,
|
|
377
378
|
"players": info.players,
|
|
@@ -402,6 +403,7 @@ async function getServer(ctx, session) {
|
|
|
402
403
|
const host = api.split(":");
|
|
403
404
|
const serverInfo = await slpInfo(log, host[0], Number(host[1]), ctx.config.timeout);
|
|
404
405
|
if (serverInfo.success) {
|
|
406
|
+
log.debug(serverInfo);
|
|
405
407
|
if (serverInfo.data.players.sample == null) {
|
|
406
408
|
const temp = {
|
|
407
409
|
"count": count,
|
|
@@ -566,6 +568,7 @@ async function getRandomWord(ctx, session) {
|
|
|
566
568
|
}
|
|
567
569
|
const response = await request(ctx.config.rwAPI + "?format=json", {}, ctx.config.timeout, log);
|
|
568
570
|
if (response.success) {
|
|
571
|
+
log.debug(response.data);
|
|
569
572
|
msg = {
|
|
570
573
|
"time": time,
|
|
571
574
|
"data": response.data.data,
|
|
@@ -602,7 +605,7 @@ async function getBlueArchive(ctx, session) {
|
|
|
602
605
|
const vid = await session.send(session.text(".wait", { "quote": import_koishi2.h.quote(session.messageId), "time": time }));
|
|
603
606
|
const ms = random(0, 0, 1500);
|
|
604
607
|
const link = random(2, ctx.config.baAPI) + `?cacheBuster=${random(1, 1, 2147483647)}`;
|
|
605
|
-
log.
|
|
608
|
+
log.debug(`Link: ${link}`);
|
|
606
609
|
await (0, import_koishi2.sleep)(ms);
|
|
607
610
|
const status2 = await session.send(session.text(".msg", { "quote": import_koishi2.h.quote(session.messageId), "image": import_koishi2.h.image(link) }));
|
|
608
611
|
if (!status2) await session.send(session.text(".msg", { "quote": import_koishi2.h.quote(session.messageId), "image": import_koishi2.h.image(link) }));
|
|
@@ -628,6 +631,7 @@ async function centerServerTest(ctx, session) {
|
|
|
628
631
|
});
|
|
629
632
|
const response = await request("https://status.scpslgame.com/api/status-page/heartbeat/nw", {}, ctx.config.timeout, log);
|
|
630
633
|
if (response.success) {
|
|
634
|
+
log.debug(response.data);
|
|
631
635
|
for (const server of ctx.config.slTest) {
|
|
632
636
|
const lastTime = response.data.heartbeatList[server.id].at(-1);
|
|
633
637
|
if (lastTime) {
|
|
@@ -725,6 +729,7 @@ async function getCat(ctx, session) {
|
|
|
725
729
|
const time = getHongKongTime();
|
|
726
730
|
if (ctx.config.catAPI == void 0) {
|
|
727
731
|
await session.send(session.text(".failed", { "quote": import_koishi2.h.quote(session.messageId), "data": "未指定 API", "time": time }));
|
|
732
|
+
log.warn("未指定 API");
|
|
728
733
|
return 1;
|
|
729
734
|
}
|
|
730
735
|
const vid = await session.send(session.text(".wait", { "quote": import_koishi2.h.quote(session.messageId), "time": time }));
|
|
@@ -756,11 +761,13 @@ async function getQQInfo(ctx, session, qq) {
|
|
|
756
761
|
const time = getHongKongTime();
|
|
757
762
|
if (ctx.config.qqAPI == void 0) {
|
|
758
763
|
await session.send(session.text(".failed", { "quote": import_koishi2.h.quote(session.messageId), "data": "未指定 API", "time": time }));
|
|
764
|
+
log.warn("未指定 API");
|
|
759
765
|
return 1;
|
|
760
766
|
}
|
|
761
767
|
const response = await request(ctx.config.qqAPI + `?qq=${qq}`, {}, ctx.config.timeout, log);
|
|
762
768
|
if (response.success) {
|
|
763
769
|
const fullHtml = await readUserCardFile(response.data);
|
|
770
|
+
log.debug(fullHtml);
|
|
764
771
|
const page = await ctx.puppeteer.page();
|
|
765
772
|
try {
|
|
766
773
|
await page.setViewport({
|
|
@@ -799,7 +806,7 @@ async function getQQInfo(ctx, session, qq) {
|
|
|
799
806
|
}
|
|
800
807
|
__name(getQQInfo, "getQQInfo");
|
|
801
808
|
async function getMsg(ctx, session) {
|
|
802
|
-
const log = ctx.logger("
|
|
809
|
+
const log = ctx.logger("getMsg");
|
|
803
810
|
log.debug(`Got: {"form":"${session.platform}:${session.event.guild?.id}","user":"${session.event.user?.id}","timestamp":${session.event.timestamp},"messageId":"${session.event.message?.id}"}`);
|
|
804
811
|
const time = getHongKongTime();
|
|
805
812
|
if (!session.quote || !session.quote.user) {
|
|
@@ -809,6 +816,7 @@ async function getMsg(ctx, session) {
|
|
|
809
816
|
}
|
|
810
817
|
if (session.quote.user.id == session.event.selfId) {
|
|
811
818
|
await session.send(session.text(".matroska", { "quote": import_koishi2.h.quote(session.messageId) }));
|
|
819
|
+
log.debug("套娃");
|
|
812
820
|
return 1;
|
|
813
821
|
}
|
|
814
822
|
const user = await session.bot.getUser(session.quote.user.id, session.channelId);
|
|
@@ -820,7 +828,14 @@ async function getMsg(ctx, session) {
|
|
|
820
828
|
return 1;
|
|
821
829
|
}
|
|
822
830
|
const page = await ctx.puppeteer.page();
|
|
823
|
-
const html = await readUserMsgFile(user.name, user.avatar, msg.replace(
|
|
831
|
+
const html = await readUserMsgFile(user.name, user.avatar, msg.replace(
|
|
832
|
+
/<at\s+(?:id=["']([^"']*)["']\s+name=["']([^"']*)["']|name=["']([^"']*)["']\s+id=["']([^"']*)["'])\s*\/?>/g,
|
|
833
|
+
(match, id1, name1, name2, id2) => {
|
|
834
|
+
const name3 = name1 || name2 || id1 || id2 || match;
|
|
835
|
+
return `@${name3}`;
|
|
836
|
+
}
|
|
837
|
+
));
|
|
838
|
+
log.debug(html);
|
|
824
839
|
try {
|
|
825
840
|
await page.setViewport({
|
|
826
841
|
width: 450,
|
|
@@ -876,6 +891,7 @@ async function getNewsMsg(ctx, type) {
|
|
|
876
891
|
{ id: response.data.appnews.newsitems[0].gid, data: html[0] }
|
|
877
892
|
]);
|
|
878
893
|
}
|
|
894
|
+
log.debug(html);
|
|
879
895
|
const page = await ctx.puppeteer.page();
|
|
880
896
|
try {
|
|
881
897
|
await page.setViewport({
|
|
@@ -912,7 +928,7 @@ async function getNewsMsg(ctx, type) {
|
|
|
912
928
|
__name(getNewsMsg, "getNewsMsg");
|
|
913
929
|
|
|
914
930
|
// package.json
|
|
915
|
-
var version = "2.24.
|
|
931
|
+
var version = "2.24.9";
|
|
916
932
|
|
|
917
933
|
// src/index.ts
|
|
918
934
|
var inject = ["database", "installer", "puppeteer", "cron"];
|