@zhin.js/cli 1.0.4 → 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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @zhin.js/cli
2
2
 
3
+ ## 1.0.5
4
+
5
+ ### Patch Changes
6
+
7
+ - f347667: fix: runtime error
8
+
3
9
  ## 1.0.4
4
10
 
5
11
  ### Patch Changes
@@ -252,7 +252,7 @@ const logger = useLogger();
252
252
  // 添加命令
253
253
  addCommand(new MessageCommand('hello')
254
254
  .action(async (message) => {
255
- logger.info('Hello command called by:', message.sender.name);
255
+ logger.info('Hello command called by:', message.$sender.name);
256
256
  return '你好!欢迎使用 Zhin 机器人框架!';
257
257
  })
258
258
  );
@@ -272,14 +272,14 @@ addCommand(new MessageCommand('status')
272
272
 
273
273
  // 添加中间件
274
274
  addMiddleware(async (message, next) => {
275
- logger.info(\`收到消息: \${message.raw}\`);
275
+ logger.info(\`收到消息: \${message.$raw || 'undefined'}\`);
276
276
  await next();
277
277
  });
278
278
 
279
279
  // 监听消息
280
280
  onMessage(async (message) => {
281
- if (message.raw.includes('帮助')) {
282
- await message.reply('可用命令:hello, status\\n输入命令即可使用!');
281
+ if (message.$raw && message.$raw.includes('帮助')) {
282
+ await message.$reply('可用命令:hello, status\\n输入命令即可使用!');
283
283
  }
284
284
  });
285
285
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhin.js/cli",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "Zhin机器人框架CLI工具",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",
@@ -280,7 +280,7 @@ const logger = useLogger();
280
280
  // 添加命令
281
281
  addCommand(new MessageCommand('hello')
282
282
  .action(async (message) => {
283
- logger.info('Hello command called by:', message.sender.name);
283
+ logger.info('Hello command called by:', message.$sender.name);
284
284
  return '你好!欢迎使用 Zhin 机器人框架!';
285
285
  })
286
286
  );
@@ -300,14 +300,14 @@ addCommand(new MessageCommand('status')
300
300
 
301
301
  // 添加中间件
302
302
  addMiddleware(async (message, next) => {
303
- logger.info(\`收到消息: \${message.raw}\`);
303
+ logger.info(\`收到消息: \${message.$raw || 'undefined'}\`);
304
304
  await next();
305
305
  });
306
306
 
307
307
  // 监听消息
308
308
  onMessage(async (message) => {
309
- if (message.raw.includes('帮助')) {
310
- await message.reply('可用命令:hello, status\\n输入命令即可使用!');
309
+ if (message.$raw && message.$raw.includes('帮助')) {
310
+ await message.$reply('可用命令:hello, status\\n输入命令即可使用!');
311
311
  }
312
312
  });
313
313