koishi-plugin-minecraft-notifier 1.3.1 → 1.4.0

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.cjs CHANGED
@@ -389,10 +389,7 @@ async function exportXaml(ctx, cfg, summary, version) {
389
389
  "master"
390
390
  ).then((result) => {
391
391
  if (result.success) {
392
- ctx.logger("minecraft-notifier").info(
393
- "Upsert successful:",
394
- result.data?.data
395
- );
392
+ ctx.logger("minecraft-notifier").info("Upsert successful");
396
393
  } else {
397
394
  ctx.logger("minecraft-notifier").warn(
398
395
  "Upsert failed:",
@@ -462,7 +459,8 @@ async function checkVersionUpdate(ctx, cfg, articleRecord, notifierRecord, versi
462
459
  if (success) {
463
460
  await updateArticleRecord(ctx, {
464
461
  [versionKey]: newVersion,
465
- [tryTimeKey]: 0
462
+ [tryTimeKey]: 0,
463
+ latestVersion: newVersion
466
464
  });
467
465
  return true;
468
466
  }
@@ -470,7 +468,8 @@ async function checkVersionUpdate(ctx, cfg, articleRecord, notifierRecord, versi
470
468
  if (newTryTime >= 5) {
471
469
  await updateArticleRecord(ctx, {
472
470
  [versionKey]: newVersion,
473
- [tryTimeKey]: 0
471
+ [tryTimeKey]: 0,
472
+ latestVersion: newVersion
474
473
  });
475
474
  } else {
476
475
  await updateArticleRecord(ctx, {
@@ -746,7 +745,8 @@ function apply(ctx, cfg) {
746
745
  lastRelease: "string",
747
746
  lastSnapshot: "string",
748
747
  releaseTryTime: "integer",
749
- snapshotTryTime: "integer"
748
+ snapshotTryTime: "integer",
749
+ latestVersion: "string"
750
750
  },
751
751
  { primary: "id" }
752
752
  );
@@ -818,18 +818,16 @@ function apply(ctx, cfg) {
818
818
  let fullHomePagePath = import_node_path2.default.join(xamlPath, "PCL.HomePage.xaml");
819
819
  koaCtx.response.body = await import_node_fs2.promises.readFile(fullHomePagePath);
820
820
  });
821
- ctx.command("test").action(async ({ session }) => {
822
- await upsertFileToGitee(
823
- ctx,
824
- "pynickle",
825
- "PCL-AI-Summary-HomePage",
826
- "Custom.xaml",
827
- "111",
828
- `feat: update PCL HomePage XAML for version 111`,
829
- "c8629ca06822133e7d8b497c6e71cc7a",
830
- "master"
831
- );
821
+ ctx.server.get("/Custom.xaml.ini", async (koaCtx) => {
822
+ koaCtx.set("charset=utf-8");
823
+ const articleRecord = (await ctx.database.get("minecraft_article_version", 1))[0];
824
+ koaCtx.response.body = articleRecord.latestVersion;
832
825
  });
826
+ ctx.command("mc.trigger", "\u624B\u52A8\u89E6\u53D1 AI \u66F4\u65B0\u65E5\u5FD7\u603B\u7ED3\u751F\u6210").action(
827
+ async () => {
828
+ await checkNewVersionArticle(ctx, cfg);
829
+ }
830
+ );
833
831
  ctx.setInterval(async () => {
834
832
  try {
835
833
  await loadData();
package/lib/index.d.ts CHANGED
@@ -12,6 +12,7 @@ export interface ArticleLatestVersion {
12
12
  lastSnapshot: string;
13
13
  releaseTryTime: number;
14
14
  snapshotTryTime: number;
15
+ latestVersion: string;
15
16
  }
16
17
  export interface ArticleRecord {
17
18
  id: number;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-minecraft-notifier",
3
3
  "description": "A Minecraft new version notification plugin, also featuring a PCL homepage.",
4
- "version": "1.3.1",
4
+ "version": "1.4.0",
5
5
  "main": "lib/index.cjs",
6
6
  "typings": "lib/index.d.ts",
7
7
  "type": "module",