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

fix: tigger command in room #263

Merged
merged 1 commit into from
Dec 11, 2022
Merged

fix: tigger command in room #263

merged 1 commit into from
Dec 11, 2022

Conversation

sunshanpeng
Copy link
Contributor

群聊时输入的command经过替换后会多一个空格,比如' /reset’ /help,然后不能解析为命令

image

text.trim()一下就好了,我觉得在这边处理应该合适,去掉前后空格应该没什么问题吧

image

@sunshanpeng
Copy link
Contributor Author

      if (message.text().startsWith("/ping ")) {
        await message.say("pong");
        return;
      }

另外有点好奇/ping 这里为啥要加个空格,在微信聊天框输入的时候会自动trim一下,/ping 触发不了~
image

@RealTong
Copy link
Collaborator

首先感谢您的PR.

但是我不确定这是Bug还是本身就是这样设计. 可以等 @fuergaosi233 来回答

但是在群聊中本就不应该触发命令
如果谁都可以触发/reset 那bot就没得用了.

@RealTong
Copy link
Collaborator

      if (message.text().startsWith("/ping ")) {
        await message.say("pong");
        return;
      }

另外有点好奇/ping 这里为啥要加个空格,在微信聊天框输入的时候会自动trim一下,/ping 触发不了~ image

这个/ping 在最开始就有了, 用来检测wechaty是否正常工作
最开始的用意是将命令与内容(或者可以叫参数)隔开.

@fuergaosi233
Copy link
Owner

首先感谢您的PR.

但是我不确定这是Bug还是本身就是这样设计. 可以等 @fuergaosi233 来回答

但是在群聊中本就不应该触发命令 如果谁都可以触发/reset 那bot就没得用了.

It's bug

@fuergaosi233 fuergaosi233 merged commit 566a67a into fuergaosi233:main Dec 11, 2022
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

Successfully merging this pull request may close these issues.

3 participants