koishi-plugin-disaster-warning 0.0.6 → 0.0.7

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.d.ts CHANGED
@@ -9,7 +9,6 @@ export interface Config {
9
9
  target_groups: string[];
10
10
  data_sources: {
11
11
  fan_studio: {
12
- enabled: boolean;
13
12
  china_earthquake_warning: boolean;
14
13
  taiwan_cwa_earthquake: boolean;
15
14
  china_cenc_earthquake: boolean;
@@ -19,13 +18,11 @@ export interface Config {
19
18
  china_tsunami: boolean;
20
19
  };
21
20
  p2p_earthquake: {
22
- enabled: boolean;
23
21
  japan_jma_eew: boolean;
24
22
  japan_jma_earthquake: boolean;
25
23
  japan_jma_tsunami: boolean;
26
24
  };
27
25
  wolfx: {
28
- enabled: boolean;
29
26
  japan_jma_eew: boolean;
30
27
  china_cenc_eew: boolean;
31
28
  taiwan_cwa_eew: boolean;
package/lib/index.js CHANGED
@@ -15,7 +15,6 @@ exports.Config = koishi_1.Schema.object({
15
15
  target_groups: koishi_1.Schema.array(koishi_1.Schema.string()).default([]).description('需要推送消息的群号列表'),
16
16
  data_sources: koishi_1.Schema.object({
17
17
  fan_studio: koishi_1.Schema.object({
18
- enabled: koishi_1.Schema.boolean().default(true).description('启用FAN Studio数据源'),
19
18
  china_earthquake_warning: koishi_1.Schema.boolean().default(true).description('中国地震网地震预警'),
20
19
  taiwan_cwa_earthquake: koishi_1.Schema.boolean().default(true).description('台湾中央气象署:强震即时警报'),
21
20
  china_cenc_earthquake: koishi_1.Schema.boolean().default(false).description('中国地震台网(CENC):地震测定'),
@@ -25,13 +24,11 @@ exports.Config = koishi_1.Schema.object({
25
24
  china_tsunami: koishi_1.Schema.boolean().default(false).description('自然资源部海啸预警中心:海啸预警信息'),
26
25
  }).description('FAN Studio WebSocket 数据源'),
27
26
  p2p_earthquake: koishi_1.Schema.object({
28
- enabled: koishi_1.Schema.boolean().default(false).description('启用P2P地震情報数据源'),
29
27
  japan_jma_eew: koishi_1.Schema.boolean().default(true).description('日本気象庁:緊急地震速報'),
30
28
  japan_jma_earthquake: koishi_1.Schema.boolean().default(true).description('日本気象庁(JMA):地震情報'),
31
29
  japan_jma_tsunami: koishi_1.Schema.boolean().default(true).description('日本気象庁:津波予報'),
32
30
  }).description('P2P地震情報 WebSocket 数据源'),
33
31
  wolfx: koishi_1.Schema.object({
34
- enabled: koishi_1.Schema.boolean().default(false).description('启用Wolfx数据源'),
35
32
  japan_jma_eew: koishi_1.Schema.boolean().default(true).description('日本気象庁:緊急地震速報'),
36
33
  china_cenc_eew: koishi_1.Schema.boolean().default(true).description('中国地震台网(CENC):地震预警'),
37
34
  taiwan_cwa_eew: koishi_1.Schema.boolean().default(true).description('台湾中央气象署:地震预警'),
package/lib/service.js CHANGED
@@ -36,16 +36,20 @@ class DisasterWarningService {
36
36
  }
37
37
  }
38
38
  connectAll() {
39
- if (this.config.data_sources.fan_studio.enabled) {
39
+ const ds = this.config.data_sources;
40
+ // Fan Studio: Connect if any sub-option is enabled
41
+ if (Object.values(ds.fan_studio).some(v => v)) {
40
42
  this.connectFanStudio();
41
43
  }
42
- if (this.config.data_sources.p2p_earthquake.enabled) {
44
+ // P2P: Connect if any sub-option is enabled
45
+ if (Object.values(ds.p2p_earthquake).some(v => v)) {
43
46
  this.connectP2P();
44
47
  }
45
- if (this.config.data_sources.wolfx.enabled) {
48
+ // Wolfx: Connect if any sub-option is enabled
49
+ if (Object.values(ds.wolfx).some(v => v)) {
46
50
  this.connectWolfx();
47
51
  }
48
- if (this.config.data_sources.global_quake.enabled) {
52
+ if (ds.global_quake.enabled) {
49
53
  this.connectGlobalQuake();
50
54
  }
51
55
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-disaster-warning",
3
3
  "description": "Koishi 灾害预警插件,支持多数据源(地震、海啸、气象预警)",
4
- "version": "0.0.6",
4
+ "version": "0.0.7",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [