-
-
Notifications
You must be signed in to change notification settings - Fork 253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add plugin-baidu #153
Add plugin-baidu #153
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #153 +/- ##
========================================
Coverage 90.89% 90.89%
========================================
Files 53 53
Lines 10122 10122
Branches 1981 1981
========================================
Hits 9200 9200
Misses 922 922 Continue to review full report at Codecov.
|
packages/plugin-tools/src/baidu.ts
Outdated
koishi | ||
.command('tools/baidu <keyword>', '使用百度百科搜索') | ||
.example('百度一下最终幻想14') | ||
.shortcut(/^百度(一下)?(.+?)$/, { args: ['$2'] }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
实践证明目前的shortcut
非常容易误触,请看情况改进一下。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已解决
packages/plugin-tools/src/baidu.ts
Outdated
Number(answer) < 1 || | ||
Number(answer) > showedResult | ||
) { | ||
return session.send('编号输入有误!') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
经实践证明,这里的回复可能会有点吵。
也许可以加一个判断条件,例如输入的不是数字就不采取行动;或者回复“cancel”、“0”之类的取消搜索。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我建议默认行为不产生输出;以及你没有判断是否为整数。
packages/plugin-tools/src/baidu.ts
Outdated
* @param {...String} args | ||
* @return {String} | ||
*/ | ||
function _msg(msgKey: string, ...args: string[]): string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
koishi v3好像新增了一个模板语法,但我不太明白。这里可能存在重复造轮,请视情况帮忙改一改。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
改过了
This comment has been minimized.
This comment has been minimized.
|
|
|
依葫芦画瓢…
我说我是乱写的,我可真的是乱写的啊……