AndrewYatzkan / Twitch-Chat-vs-Streamer-Lichess

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Twitch-Chat-vs-Streamer-Lichess

Setup:

  1. Install Node.js.

  2. Download Twitch-Chat-vs-Streamer-Lichess and navigate to the folder in Terminal (Mac/Linux) or Command Prompt (Windows).

  3. Run npm i. Note: if you get an error, try running sudo npm i on Mac/Linux or running the Command Prompt as Administrator on Windows.

  4. Create a file named config.js with the following data:

module.exports = {
	STREAMER: "streamer", (streamer's twitch username)
	STREAMER_LICHESS: "lichess", (streamer's lichess username)
	AUTHORIZED_USERS: ["user1", "user2"], (twitch users allowed to use the !setvotingperiod command)
	TWITCH_OAUTH: "oauth:...", (oauth token for bot's twitch account)
	LICHESS_OAUTH: "...", (oauth token for bot's lichess account)
	CHAT_COOLDOWN: 2000, (time in milliseconds to wait between sending messages (1-2 seconds is good) not needed if bot is vip or mod)
	VOTING_PERIOD: 20, (time in seconds that chat has to vote)
	ACKNOWLEDGE_VOTE: true (whether or not the twitch bot should acknowledge users' votes in chat)
};

(You can get the twitch oauth token here, and the lichess oauth token here)

  1. Run node index.js to start the bot. The voting page should be at localhost:3000 (will be a black screen if there aren't currently any votes).

  2. Challenge the lichess bot-it will automatically accept challenges from the STREAMER_LICHESS account and instructions will be sent to chat!

Bugs:

  • if the bot is restarted on its turn, it doesn't reconnect
    • would need to save ongoing games dictionary before it exists
  • tmi.js 'join' event is called late sometimes -> message queue doesn't work at first

To-do:

  • vote to offer draw
  • vote to resign
  • web page to put on stream that visualizes the voting process
  • multiple streamers at once! shouldn't be too hard with current setup
    • Update: won't work unless lichess authorizes the host ip to bypass their rate limiting
  • support for different initial starting positions
  • support for variants with different rules (anti-chess, atomic, etc.)
  • blacklist moves
  • auto-reconnect when lichess is down & bot crashes
  • automatically set voting period to increment? (disallows +0 games, but do we care?)
  • Bug: offer/accept draw & resign % doesn't update on each vote, only updates when people vote for it

About


Languages

Language:JavaScript 90.5%Language:HTML 9.5%