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

msg.say 重复执行 #1674

Closed
keyiis opened this issue Dec 24, 2018 · 1 comment
Closed

msg.say 重复执行 #1674

keyiis opened this issue Dec 24, 2018 · 1 comment

Comments

@keyiis
Copy link

keyiis commented Dec 24, 2018

我参考wechaty-getting-started的ding-dong-bot.js做了些修改。在接收到消息自动回复时,会无限循环执行mag.say操作,

async function onMessage (msg) {
  if (msg.age() > 60) {
    console.log('Message discarded because its TOO OLD(than 1 minute)')
    return
  }
  console.log(msg.toString())
  await msg.say('主人不在,我会通知他的!');
  return;
}

qq 20181224100131

@keyiis
Copy link
Author

keyiis commented Dec 24, 2018

已在文档中找到答案

// 过滤自己和自己说话
  if (msg.self()) {
    return
  }

@keyiis keyiis closed this as completed Dec 24, 2018
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

1 participant