Twitch is a popular streaming site. One of the things people do are called ‘Twitch plays [game name here’. It takes chat as input to some sort of emulator while streaming it.
I used a few tools to do the same thing. You can connect to the twitch chat channels through an IRC channel, output the chat to a local log file and use that as input to AutoHotKey which is software used to send user keyboard inputs to other applications.
In the screen shot you can kind of see what’s going on.
It reads the chat input and if it’s one of the game buttons it will enter it into the game.