After having some fun letting my Fish Play Piano and then letting Twitch play some Battle Chess with OpenTwitchPlays, I figured, that I would get back into Python and write my own little bot. The NES chess engine of Battle Chess was not very impressive. After a long night and a lot of coffee, I had my bot running thanks to some tutorials and plenty of documentation on Python on the internet.
I took the scripts from Make your own Twitch-Plays stream by Wituz as a starting point and improved on some functions (like being able to join a different channel than your username) and console output. I then added my features for clicking and dragging to interact with the UI of Lucas Chess (Windows) as well as the required !move command for players to specify coordinates. The script does only emulate player input and can therefore not output and results or give feedback on false input other than the proper use of syntax.
To avoid trolling (by just restarting a running game), I have added a simple voting system, which can be easily modified. You can use this script as a framework for your other games by removing everything related to the chess software and modifying it for your needs. If you need to emulate a longer button press for your game / emulator / tool to react properly, you can add the keyholder.py as outlined by Wituz to your script.
I have run into some problems with Lucas Chess and its very inconsistent UI, so if you intend to run another chess software, maybe check out something that supports hotkeys, so you can ideally avoid the mouse inputs since they are prone to problems. 🙂 I would love to see someone else having fun with these scripts!