{"id":21915329,"url":"https://github.com/tim-harding/community_chess","last_synced_at":"2025-03-22T09:23:54.158Z","repository":{"id":59925463,"uuid":"540075206","full_name":"tim-harding/community_chess","owner":"tim-harding","description":"A moderator bot for /r/CommunityChess","archived":false,"fork":false,"pushed_at":"2024-01-27T05:07:25.000Z","size":80,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-16T15:54:22.419Z","etag":null,"topics":["chess","reddit","reddit-bot"],"latest_commit_sha":null,"homepage":"","language":"Python","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/tim-harding.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2022-09-22T16:38:57.000Z","updated_at":"2022-09-22T19:13:57.000Z","dependencies_parsed_at":"2023-12-21T04:37:40.950Z","dependency_job_id":"76a46c4e-27c2-4882-89b2-6fbc7933d0c9","html_url":"https://github.com/tim-harding/community_chess","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tim-harding%2Fcommunity_chess","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tim-harding%2Fcommunity_chess/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tim-harding%2Fcommunity_chess/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tim-harding%2Fcommunity_chess/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tim-harding","download_url":"https://codeload.github.com/tim-harding/community_chess/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244933576,"owners_count":20534387,"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","reddit","reddit-bot"],"created_at":"2024-11-28T19:11:00.420Z","updated_at":"2025-03-22T09:23:54.139Z","avatar_url":"https://github.com/tim-harding.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Community Chess Bot\n\nA moderator bot for [Community Chess](https://www.reddit.com/r/CommunityChess/), a collaborative chess game on Reddit.\n\n## Contributing\n\n### Setup\n\nUse [pyenv](https://github.com/pyenv/pyenv) to manage your Python installation. Create a virtual environment and install the package.\n\n```sh\npython -m venv .venv\nsource .venv/bin/activate # Run each time you open the project\npip install --editable .[dev]\n```\n\n### Authentication \n\nThis bot uses Praw's [Code Flow](https://praw.readthedocs.io/en/stable/getting_started/authentication.html#code-flow) for authentication. \n\n1. Create an application in your Reddit [application preferences](https://www.reddit.com/prefs/apps/). Note your `client_secret`, shown when your press *edit*, and your `client_id`, listed below *personal use script*.\n\n2. Set up your `praw.ini` in the project root as follows:\n\n```ini\n[DEFAULT]\nredirect_uri=http://localhost:8080\nclient_id=MY_CLIENT_ID\nclient_secret=MY_CLIENT_SECRET\nuser_agent=script:com.MY_NAME.communitychess:v0.1.0 (by /u/MY_USERNAME)\n```\n\n3. Use `get_refresh_token` to generate a refresh token. \n\n4. Add this line to your `praw.ini`:\n\n```ini\nrefresh_token=MY_REFRESH_TOKEN\n```\n\n### Testing\n\n#### Type checking\n\n```sh\nmypy\n```\n\n#### Unit tests\n\n```sh\npython -m unittest\n```\n\n#### Running\n\nIf you wish to test the bot in a live environment, please do so over at [/r/testingground4bots](https://www.reddit.com/r/testingground4bots/) or somewhere else off the main sub. \n\n```sh\n# Show command documentation\nchessbot --help\n\n# Enable verbose logging and \n# check for moves on the current post every five seconds\nchessbot --log INFO --timeout 5\n```\n\n### Deployment\n\nThe bot is deployed with [Fly.io](https://fly.io/). \n\n#### Secrets\n\nSet [secrets](https://fly.io/docs/reference/secrets/) for the `CLIENT_ID`, `CLIENT_SECRET`, and `REFRESH_TOKEN` variables from `praw.ini`.\n\n```sh\nfly secrets set MY_VAR=xxxxxxxx --stage\n```\n\n#### Volume\n\nCreate the [volume](https://fly.io/docs/apps/volume-storage/) `community_chess_db`. \n\n```sh\nfly volumes create community_chess_db -r sea -n 1 -s 1\n```\n\n#### Publish\n\n```sh\n# High availability creates unnecessary extra machines\nfly deploy --ha=false\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftim-harding%2Fcommunity_chess","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftim-harding%2Fcommunity_chess","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftim-harding%2Fcommunity_chess/lists"}