pmonks / futbot

A Discord bot that delivers football (soccer) information to Discord.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Responsive function: fake IST headlines

pmonks opened this issue · comments

Description of Problem:

When I see something provocative or ridiculous in the Discord server, I want to ask futbot to produce a fake IST headline, so I can highlight the incident.

UI:

Me: !IST
Futbot: CUP MATCH GETS UGLY!! DIRTY TACKLES, KNEE TO THE TEMPLE, CHEAP SHOT INJURY & HEARTLESS SMACK TALK!!

Potential Solutions:

Read IST's YouTube titles via this API call, process the headlines into a Markov chain and then, upon request, use it to generate fake IST headlines.

Implementation Notes:

  • This will require a YouTube API key.
  • Because of the bot's limited runtime environment (Heroku hobby dyno), it would be best to pre-generate the Markov chain and persist it to disk (i.e. as an EDN file), rather than regenerate it each time on startup.
    • There is a decision to be made about whether the Markov chain EDN file gets checked into source control, or is generated each time the bot is built (including by Heroku). I'm leaning towards the former, not only for cost/performance reasons but also because it means the Youtube API call / generate Markov chain code could be a separate project (and so that code would not deployed to Heroku and would not consume runtime resources).
  • The logic would be approximately the same as fake-tweets, except that for performance reasons, the Markov chain is generated in a separate batch job, rather than each time the bot starts
  • One improvement over and above fake-tweets would be to explicitly include an unambiguous "end of title" marker, so that the Markov chain is aware of where titles typically end. The logic that generates a fake title would then look for the last "end of title" marker in the generated text, and truncate the message there.