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

manage commands #28

Closed
lenny76 opened this issue Sep 10, 2015 · 2 comments
Closed

manage commands #28

lenny76 opened this issue Sep 10, 2015 · 2 comments

Comments

@lenny76
Copy link

lenny76 commented Sep 10, 2015

hi,
what is the best way to manage list of commands and replies?
now I'm filling the app with a lot of 'if'...
if command = 'xxx' {}
if command = 'xxx' {}
if command = 'xxx' {}

is there a better way, so I can manage easily the app?
thanks

@yagop
Copy link
Owner

yagop commented Oct 10, 2015

I implemented a new feature on new version (0.15.0) to work around this.

bot.onText(/\/echo (.+)/, function (msg, match) {
  var fromId = msg.from.id;
  var resp = match[1];
  bot.sendMessage(fromId, resp);
});

@lenny76
Copy link
Author

lenny76 commented Oct 19, 2015

+1

@yagop yagop closed this as completed Oct 19, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants