@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 +6 -0
- package/lib/commands/init.js +4 -4
- package/package.json +1 -1
- package/src/commands/init.ts +4 -4
package/CHANGELOG.md
CHANGED
package/lib/commands/init.js
CHANGED
|
@@ -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
|
|
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
|
|
275
|
+
logger.info(\`收到消息: \${message.$raw || 'undefined'}\`);
|
|
276
276
|
await next();
|
|
277
277
|
});
|
|
278
278
|
|
|
279
279
|
// 监听消息
|
|
280
280
|
onMessage(async (message) => {
|
|
281
|
-
if (message
|
|
282
|
-
await message
|
|
281
|
+
if (message.$raw && message.$raw.includes('帮助')) {
|
|
282
|
+
await message.$reply('可用命令:hello, status\\n输入命令即可使用!');
|
|
283
283
|
}
|
|
284
284
|
});
|
|
285
285
|
|
package/package.json
CHANGED
package/src/commands/init.ts
CHANGED
|
@@ -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
|
|
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
|
|
303
|
+
logger.info(\`收到消息: \${message.$raw || 'undefined'}\`);
|
|
304
304
|
await next();
|
|
305
305
|
});
|
|
306
306
|
|
|
307
307
|
// 监听消息
|
|
308
308
|
onMessage(async (message) => {
|
|
309
|
-
if (message
|
|
310
|
-
await message
|
|
309
|
+
if (message.$raw && message.$raw.includes('帮助')) {
|
|
310
|
+
await message.$reply('可用命令:hello, status\\n输入命令即可使用!');
|
|
311
311
|
}
|
|
312
312
|
});
|
|
313
313
|
|