hubot-markov icon indicating copy to clipboard operation
hubot-markov copied to clipboard

HUBOT_MARKOV_RESPOND_CHANCE env var cannot contain '.'

Open bnfinet opened this issue 7 years ago • 4 comments

we've set the env var HUBOT_MARKOV_RESPOND_CHANCE to 0.005 for very infrequent but very humorous responses.

Unfortunately this line... https://github.com/smashwilson/hubot-markov/blob/master/src/config.coffee#L6 tests for digits and fails on '.'

can I suggest /^[-+]?[0-9]*\.?[0-9]+$/.test

Thanks for helping us to brighten our days with markov enabled hubot!

bnfinet avatar Jun 28 '17 22:06 bnfinet

I fixed it by setting it like this:

    respondChance: parseFloat(hash.HUBOT_MARKOV_RESPOND_CHANCE)

baudehlo avatar Aug 02 '17 18:08 baudehlo

The fix also requires in default-listeners.coffee changing preprocessor.words( to processors.words.pre(

baudehlo avatar Aug 02 '17 18:08 baudehlo

@bnfinet have you sent a pull request for this? Your fix worked for me.

scarolan avatar Sep 20 '18 16:09 scarolan

Fixed in #29

Bajotumn avatar Feb 06 '19 02:02 Bajotumn