{"id":21316100,"url":"https://github.com/cjsaylor/chessbot","last_synced_at":"2025-07-12T01:31:39.168Z","repository":{"id":45067420,"uuid":"143943472","full_name":"cjsaylor/chessbot","owner":"cjsaylor","description":"Slack bot for playing chess.","archived":false,"fork":false,"pushed_at":"2022-01-11T10:14:49.000Z","size":20810,"stargazers_count":36,"open_issues_count":14,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-06T12:22:33.668Z","etag":null,"topics":["chess","golang","hacktoberfest","slack","slackbot"],"latest_commit_sha":null,"homepage":"https://www.chris-saylor.com/chessbot/","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cjsaylor.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-08-08T01:08:34.000Z","updated_at":"2024-11-25T10:55:04.000Z","dependencies_parsed_at":"2022-08-26T09:23:24.473Z","dependency_job_id":null,"html_url":"https://github.com/cjsaylor/chessbot","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cjsaylor/chessbot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cjsaylor%2Fchessbot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cjsaylor%2Fchessbot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cjsaylor%2Fchessbot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cjsaylor%2Fchessbot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cjsaylor","download_url":"https://codeload.github.com/cjsaylor/chessbot/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cjsaylor%2Fchessbot/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264923080,"owners_count":23683716,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chess","golang","hacktoberfest","slack","slackbot"],"created_at":"2024-11-21T18:29:42.927Z","updated_at":"2025-07-12T01:31:37.691Z","avatar_url":"https://github.com/cjsaylor.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ChessBot\n\n[![Build Status](https://drone1.chris-saylor.com/api/badges/cjsaylor/chessbot/status.svg)](https://drone1.chris-saylor.com/cjsaylor/chessbot)\n[![GoDoc](https://godoc.org/github.com/cjsaylor/chessbot?status.svg)](https://godoc.org/github.com/cjsaylor/chessbot)\n[![Player Documentation](https://img.shields.io/badge/doc-player-blue)](https://www.chris-saylor.com/chessbot)\n\nThis is a Slack bot that allows players to challenge each other to a game of Chess.\n\n![](./doc/screenshot.png)\n\n## Hosted Version\n\n[![Add to Slack](https://platform.slack-edge.com/img/add_to_slack.png)](https://slack.com/oauth/authorize?client_id=4813578032.414983030853\u0026scope=bot)\n\n## Requirements\n\n* Go `1.12` - Older versions will work, but `go mod` is being used to manage dependencies.\n\n## Quick Start\n\n```\ncp .env.sample .env\nexport $(cat .env | xargs) \u0026\u0026 go run cmd/web/web.go\n```\n\n## Configuration\n\n| Environment Variable | Default | Description\n| --- | --- | ---\n| PORT | `8080` | Port that the web server will listen\n| HOSTNAME | `localhost:8080` | Used for generating links to render the game board state images\n| SIGNINGKEY | N/A | Key used to sign the signature for board rendering URLs\n| SQLITEPATH | N/A | Path to a sqlite3 database file. If not included, falls back to memory store.\n| SLACKAPPID | N/A | The app ID that operates the slack bot.\n| SLACKCLIENTID | N/A | Slack app client ID\n| SLACKCLIENTSECRET | N/A | Slack app client secret\n| SLACKSIGNINGKEY | N/A | Used to verify the request signature originates from slack\n\n## Installing\n\n```\nhttps://slack.com/oauth/authorize?client_id=\u003cclient_id_here\u003e\u0026scope=bot\n```\n\n## Endpoints\n\n```\nGET /board?fen=\u0026signature=\u0026from=\u0026to=\u0026check=\n```\n\nRenders the game board based on the state of a game by FEN.\n\n```\nPOST /slack\n```\n\nAll slack event subscription callbacks flow through this.\n\n* This is used for all typed commands mentioning `@ChessBot` in the channel.\n\n```\nPOST /slack/action\n```\n\nAll slack interactive component callbacks flow through this.\n\n* This is used for accepting/rejecting challenges.\n\n```\nGET /slack/oauth\n```\n\nSlack app installation requests flow through here. A bot token is generated as part of the key exchange and stored keyed by team ID.\n\n```\nGET /analyze?game_id=\n```\n\n* This endpoint is used to generate an analysis of a game. It will redirect the user upon successful import to an analysis provider.\n\n## Testing with Slack\n\nIn order to do end-to-end testing with Slack, you will need to use a service that exposes your environment to Slack to allow webhooks to enter your application.\nI use [ngrok](https://ngrok.com/), but any local tunnelling software should work.\n\nBecause our application needs to know what the external hostname is, you'll need to start the tunneling service first to get a provided hostname from the service:\n\n```bash\nngrok http 8080\n```\n\nThe `8080` port is what we specify by default in `.env`.\nOnce the service is started and established, copy the hostname into `.env` for `HOSTNAME` environment variable, then start the application.\n\nYou will then need to enter the hostname into slack and allow them to prob your application with a challenge to ensure your app is authorized with the correct API tokens.\n\n![](./doc/slack_integration/event_subscriptions.png)\n\nFinally, configure the interactive components to point to the action endpoint:\n\n![](./doc/slack_integration/interactive_components.png)\n\nSee the [Slack integration docs](./doc/slack_integration/README.md) for more info.\n\n## Testing the Chess Engine\n\n```\ngo run cmd/repl/main.go\n```\n\n```\nλ go run cmd/repl/main.go\nGame REPL\nNote: piece colors may appear reversed on dark background terminals.\nGame ID: jcghocxkvgakyefcjgsd\n\n A B C D E F G H\n8♜ ♞ ♝ ♛ ♚ ♝ ♞ ♜\n7♟ ♟ ♟ ♟ ♟ ♟ ♟ ♟\n6- - - - - - - -\n5- - - - - - - -\n4- - - - - - - -\n3- - - - - - - -\n2♙ ♙ ♙ ♙ ♙ ♙ ♙ ♙\n1♖ ♘ ♗ ♕ ♔ ♗ ♘ ♖\n\nplayer2's turn (White)\n\n\u003e d2d4\n\n A B C D E F G H\n8♜ ♞ ♝ ♛ ♚ ♝ ♞ ♜\n7♟ ♟ ♟ ♟ ♟ ♟ ♟ ♟\n6- - - - - - - -\n5- - - - - - - -\n4- - - ♙ - - - -\n3- - - - - - - -\n2♙ ♙ ♙ - ♙ ♙ ♙ ♙\n1♖ ♘ ♗ ♕ ♔ ♗ ♘ ♖\n\nplayer1's turn (Black)\n\n\u003e export\n[Site \"Slack ChessBot match\"]\n[White \"player2\"]\n[Black \"player1\"]\n\n1.d4 *\n\n\u003e fen\nrnbqkbnr/pppppppp/8/8/3P4/8/PPP1PPPP/RNBQKBNR b KQkq d3 0 1\n\n\u003e\n```\n\n## Why not use Slack's RTM API?\n\n1. We do not need realtime communication, webhooks perform perfectly fine for the asynchonous nature of Chess.\n2. We have to implement a web server anyways for serving the game board as a PNG to be unfurled by Slack.\n3. RTM messages don't support attachments.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcjsaylor%2Fchessbot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcjsaylor%2Fchessbot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcjsaylor%2Fchessbot/lists"}