koishi-plugin-stock 1.0.3 → 1.0.5

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/lib/index.js +17 -5
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -59,26 +59,32 @@ function apply(ctx) {
59
59
  ctx.command('选股 <strategy:text>', '根据指定策略选股(支持策略:N型、填坑、少妇、突破、补票、少妇pro)')
60
60
  .action(async ({ session }, strategy) => {
61
61
  if (!strategy) {
62
- return '请输入选股策略,格式:选股 [策略名称或编号]\n支持的策略:N型(n_shape)、填坑(fill_pit)、少妇(young_woman)、突破(breakthrough)、补票(ticket)、少妇pro(young_woman_pro)';
62
+ return '请输入选股策略,格式:选股 [策略名称或编号]\n支持的策略:N型(1)、填坑(2)、少妇(3)、突破(4)、补票(5)、少妇pro(6)';
63
63
  }
64
64
  // 映射策略名称到API端点
65
65
  const strategyMap = {
66
66
  'N型': 'n_shape',
67
67
  'n_shape': 'n_shape',
68
+ '1': 'n_shape',
68
69
  '填坑': 'fill_pit',
69
70
  'fill_pit': 'fill_pit',
71
+ '2': 'fill_pit',
70
72
  '少妇': 'young_woman',
71
73
  'young_woman': 'young_woman',
74
+ '3': 'young_woman',
72
75
  '突破': 'breakthrough',
73
76
  'breakthrough': 'breakthrough',
77
+ '4': 'breakthrough',
74
78
  '补票': 'ticket',
75
79
  'ticket': 'ticket',
80
+ '5': 'ticket',
76
81
  '少妇pro': 'young_woman_pro',
77
82
  'young_woman_pro': 'young_woman_pro',
83
+ '6': 'young_woman_pro',
78
84
  };
79
85
  const apiStrategy = strategyMap[strategy.trim()];
80
86
  if (!apiStrategy) {
81
- return `不支持的选股策略:${strategy}\n支持的策略:N型(n_shape)、填坑(fill_pit)、少妇(young_woman)、突破(breakthrough)、补票(ticket)、少妇pro(young_woman_pro)`;
87
+ return `不支持的选股策略:${strategy}\n支持的策略:N型(1)、填坑(2)、少妇(3)、突破(4)、补票(5)、少妇pro(6)`;
82
88
  }
83
89
  try {
84
90
  // 使用Koishi的HTTP服务发起请求获取数据
@@ -100,7 +106,7 @@ function apply(ctx) {
100
106
  // 使用Koishi的HTTP服务发起请求获取数据
101
107
  const responseText = await ctx.http.get('http://stock.svip886.com/api/indexes', { responseType: 'text' });
102
108
  // 直接返回API返回的数据
103
- return `📊 活跃市值数据:\n\n${responseText}`;
109
+ return `📊 指数看板:\n\n${responseText}`;
104
110
  }
105
111
  catch (error) {
106
112
  console.error('获取活跃市值数据失败:', error);
@@ -116,7 +122,7 @@ function apply(ctx) {
116
122
  // 使用Koishi的HTTP服务发起请求获取数据
117
123
  const responseText = await ctx.http.get(`http://stock.svip886.com/api/analyze?code=${stockCode}`, { responseType: 'text' });
118
124
  // 直接返回API返回的数据
119
- return `📈 股票 ${stockCode} 异动分析:\n\n${responseText}`;
125
+ return `📈 异动分析:\n\n${responseText}`;
120
126
  }
121
127
  catch (error) {
122
128
  console.error('获取股票异动数据失败:', error);
@@ -149,20 +155,26 @@ function apply(ctx) {
149
155
  const strategyMap = {
150
156
  'N型': 'n_shape',
151
157
  'n_shape': 'n_shape',
158
+ '1': 'n_shape',
152
159
  '填坑': 'fill_pit',
153
160
  'fill_pit': 'fill_pit',
161
+ '2': 'fill_pit',
154
162
  '少妇': 'young_woman',
155
163
  'young_woman': 'young_woman',
164
+ '3': 'young_woman',
156
165
  '突破': 'breakthrough',
157
166
  'breakthrough': 'breakthrough',
167
+ '4': 'breakthrough',
158
168
  '补票': 'ticket',
159
169
  'ticket': 'ticket',
170
+ '5': 'ticket',
160
171
  '少妇pro': 'young_woman_pro',
161
172
  'young_woman_pro': 'young_woman_pro',
173
+ '6': 'young_woman_pro',
162
174
  };
163
175
  const apiStrategy = strategyMap[strategy];
164
176
  if (!apiStrategy) {
165
- return `不支持的选股策略:${strategy}\n支持的策略:N型(n_shape)、填坑(fill_pit)、少妇(young_woman)、突破(breakthrough)、补票(ticket)、少妇pro(young_woman_pro)`;
177
+ return `不支持的选股策略:${strategy}\n支持的策略:N型(1)、填坑(2)、少妇(3)、突破(4)、补票(5)、少妇pro(6)`;
166
178
  }
167
179
  try {
168
180
  // 使用Koishi的HTTP服务发起请求获取数据
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "koishi-plugin-stock",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "A Koishi plugin that fetches stock data when user sends '活跃市值' or '异动 [stock code]'",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",