yetibot / yetibot.github.io

🕸 Source for yetibot.com built on Cryogen
https://yetibot.com
3 stars 4 forks source link

When a command isn't configured, don't completely disable it #22

Open devth opened 6 years ago

devth commented 6 years ago

From @devth on March 19, 2016 2:53

Instead, set its evaluation to return a message about how to configure it

Copied from original issue: yetibot/yetibot#559

devth commented 6 years ago

Would also be useful to have a command that lists non-configured commands.

devth commented 6 years ago

From @jkieberk on March 25, 2017 5:11

Would it be more idiomatic to have all of the config information in one file? (maybe in yetibot.core?) and then just pass the command name to a function in that file that would return how to configure that command?

Versus having individual functions in all the command files that need to be configured?

New to clojure (and <1 year of software engineering in general) so not sure what the best way to handle this is... Having the config requirements in one place might be good? But at the same time I could see it also being a good idea to keep the config in the same place as the file that is using it...

devth commented 6 years ago

@jkieberk yeah, I definitely want to avoid stuff like when model/configured? and maybe even avoid having to explicitly fetch config from various places.

I'm thinking about working something into cmd-hook where the users of cmd-hook might pass in a config path and a clojure-spec that the expected config should conform to. If it doesn't exist or doesn't conform, then the command would still get hooked but output of that command would just be a friendly error message that maybe links to docs on how to configure the command.

I need to put a little more thought into this, but that's the gist of what I'm imaging as of now. This idea would depend on migrating to clojure-spec from schema, and I'm sorta waiting for Clojure 1.9 to be released before I do it.

devth commented 6 years ago

From @jkieberk on March 27, 2017 17:43

Sounds good!