mioku-plugin-impact 1.1.0 → 1.1.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.
Files changed (2) hide show
  1. package/index.ts +3 -5
  2. package/package.json +2 -4
package/index.ts CHANGED
@@ -1,4 +1,3 @@
1
- import type { ConfigService, ScreenshotService } from "mioku";
2
1
  import { definePlugin, type MiokiContext } from "mioki";
3
2
  import {
4
3
  cloneConfig,
@@ -6,6 +5,7 @@ import {
6
5
  normalizeImpactConfig,
7
6
  type ImpactConfig,
8
7
  } from "./configs/base";
8
+ import { getService, Services } from "mioku";
9
9
  import { initImpactDatabase, type ImpactDatabase } from "./db";
10
10
  import { handleDajiao } from "./handlers/dajiao";
11
11
  import { handleOpenModule } from "./handlers/open-module";
@@ -39,9 +39,7 @@ const impactPlugin = definePlugin({
39
39
  }
40
40
 
41
41
  const cd = createCooldownState();
42
- const screenshot = ctx.services?.screenshot as
43
- | ScreenshotService
44
- | undefined;
42
+ const screenshot = getService(ctx, Services.Screenshot);
45
43
  if (!screenshot) {
46
44
  ctx.logger.warn(
47
45
  "impact: screenshot 服务未启用, jj排行榜 / 注入查询历史图表将不可用",
@@ -49,7 +47,7 @@ const impactPlugin = definePlugin({
49
47
  }
50
48
 
51
49
  let config: ImpactConfig = cloneConfig(DEFAULT_CONFIG);
52
- const configService = ctx.services?.config as ConfigService | undefined;
50
+ const configService = getService(ctx, Services.Config);
53
51
  if (configService) {
54
52
  await configService.registerConfig("impact", "base", config);
55
53
  const persisted = await configService.getConfig("impact", "base");
package/package.json CHANGED
@@ -1,13 +1,11 @@
1
1
  {
2
2
  "name": "mioku-plugin-impact",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "让群友们眼前一黑的淫趴插件",
5
5
  "main": "index.ts",
6
6
  "type": "module",
7
7
  "keywords": [
8
- "mioku",
9
- "impact",
10
- "牛子"
8
+ "mioku"
11
9
  ],
12
10
  "repository": {
13
11
  "type": "git",