Skip to content
This repository has been archived by the owner on Jun 30, 2022. It is now read-only.

Make route command optional #200

Open
grokify opened this issue Sep 2, 2016 · 3 comments
Open

Make route command optional #200

grokify opened this issue Sep 2, 2016 · 3 comments

Comments

@grokify
Copy link

grokify commented Sep 2, 2016

Is there a way to optionally make a route a command using a config parameter?

For example:

route(/foo/, :bar, command: config.command, help: { 'foo' => 'returns bar' })
@jimmycuadra
Copy link
Collaborator

In the latest gem release of Lita, there isn't an easy way to do this. What you'd have to do is create an event callback for the "loaded" event and then define the route inside the callback. This makes it possible because the configuration values have been finalized at this point in the start up process.

On the master branch, which will someday be Lita 5, there's an after_config method that makes this pattern easier.

@grokify
Copy link
Author

grokify commented Sep 2, 2016

That's good news. Is there a planned date for Lita 5?

The reason I'm interested in this is because I've created handlers that I want to support for both chat-based bots and SMS bots.

  • A chatbot is more likely to interact in a group and also have multiple handlers so commands are important.
  • SMSbots, on the other hand, often have dedicated numbers and can be more single purpose, removing the need for the bot name prefix.

@jimmycuadra
Copy link
Collaborator

That's good news. Is there a planned date for Lita 5?

Not at the moment. I haven't been working on this project very actively, but intend to polish up master and release it at some point.

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

No branches or pull requests

2 participants