Skip to content
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

参数解析模块识别不了 @某人 这种参数 #38

Closed
ctaoist opened this issue Jan 1, 2019 · 8 comments
Closed

参数解析模块识别不了 @某人 这种参数 #38

ctaoist opened this issue Jan 1, 2019 · 8 comments

Comments

@ctaoist
Copy link

ctaoist commented Jan 1, 2019

如果命令格式为

command @某人

使用 session.get('key', prompt='?')是获取不到参数的

@stdrc
Copy link
Member

stdrc commented Jan 1, 2019

目前需要 at 在消息开头

@ctaoist
Copy link
Author

ctaoist commented Jan 1, 2019

@某人 这个只是作为一个命令的参数,不是@机器人,这个在前面不好处理吧
这种情况用session.get('key', prompt='?')获取不到参数

@stdrc
Copy link
Member

stdrc commented Jan 1, 2019

噢噢,那你要在 args_parser 里面通过 session.current_arg 获取参数,可以详细看下文档的 https://none.rclab.tk/guide/command.html 这一部分

@ctaoist
Copy link
Author

ctaoist commented Jan 1, 2019

完全按照你那个来的啊,感觉 @某人 完全被忽略了。
如果我输入command+(不是@某人消息的参数)可以正常响应。
如果我只输入command,会提示我输入参数
入股我输入command+(@某人),也会提示我输入参数。

@stdrc
Copy link
Member

stdrc commented Jan 1, 2019

因为指南里面用的是 session.current_arg_text,这里面是纯文本,但 at 是 CQ 码,不一样的,你比较一下 session.current_arg_textsession.current_arg 就明白了

@ctaoist
Copy link
Author

ctaoist commented Jan 1, 2019

换成 session.current_arg 可以正常响应了。
这个不看源码找不到系列吧

@ctaoist ctaoist closed this as completed Jan 1, 2019
@stdrc
Copy link
Member

stdrc commented Jan 1, 2019

API 里面有的 https://none.rclab.tk/api.html#current-arg
不过这个确实不好找,毕竟现在进阶文档还没完成,精力不够

@ctaoist
Copy link
Author

ctaoist commented Jan 2, 2019

@richardchien 进阶文档写多少放多少啊,我们有用到的地方也可以补充

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants