rikai / Showbot

🤖 An omnipresent multi-platform bot who's goal in life is become Skynet 🤖
MIT License
40 stars 18 forks source link

Possibly resolves #42 #75

Open ObserverHerb opened 7 years ago

ObserverHerb commented 7 years ago

Possibly resolves #42.

shows.json can now contain a "limit" member that specifies a character limit for the specific show's title.

Changed hard limit in DataMapper class in suggestion.rb from 40 to the value of live show's limit. Not sure of workflow. May be a problem there is no live show in data.json? Also bumped setting LIVE_URL to immediately after call to Dotenv.load, otherwise it gets set too late to initialize the Suggestion class.

rikai commented 7 years ago

I'd like to see this be able to fall back to the hard limit (40) when no limit is specified, i think if that can be done, this can be accepted. 👍

ObserverHerb commented 7 years ago

It already does. The condition in show.rb...

@limit = json_hash.key?("limit") ? json_hash["limit"] : 40

This pulls the limit key from the json if it exists, otherwise defaults to 40.

rikai commented 7 years ago

Whoops, my bad! Totally missed that when i skimmed over the code!

ObserverHerb commented 7 years ago

Added stability fix but that now puts the default in two different places as a literal, which will haunt us later.

Do you have a preferred place to set the default limit as a global constant? .env?

rikai commented 7 years ago

Generally, anything plugin-related we try to find a way to define in cinchize.yml. .env is usually a last resort location, but is where things should go if it doesn't make sense in cinchize.yml.

rikai commented 7 years ago

Any update on this? :)

ObserverHerb commented 7 years ago

Same as #76.