chessbot


Namechessbot JSON
Version 0.1.0 PyPI version JSON
download
home_page
SummaryA Reddit bot for moderating the /r/communitychess subreddit
upload_time2024-01-23 00:19:43
maintainer
docs_urlNone
author
requires_python>=3.12
licenseCopyright 2024 Timothy Harding Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords reddit chess
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Community Chess Bot

A moderator bot for [Community Chess](https://www.reddit.com/r/CommunityChess/), a collaborative chess game on Reddit.

## Contributing

1. Create a virtual environment to work in
```sh
pyenv exec python -m venv .venv
```

2. Activate the virtual environment each time you open the project
```sh
source .venv/bin/activate
```

3. Install dependencies
```sh 
pyenv exec pip install -r requirements/dev.txt`
```

4. [Set up](#authentication) Reddit API authentication

5. To perform type checking, use
```sh
pyenv exec mypy src/__init__.py
```

5. To run the tests, use
```sh
pyenv exec python -m unittest discover -s src
```

5. Run the bot

- `--help` shows options
- `--timeout` sets how frequently the bot should look for moves to play
- `--log` sets the log level

```sh
# Enable verbose logging and 
# check for moves on the current post every five seconds
pyenv exec python src/main.py --log INFO --timeout 5
```

## Authentication 

This bot uses Praw's [Code Flow](https://praw.readthedocs.io/en/stable/getting_started/authentication.html#code-flow) for authentication. 

1. 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*.

2. Set up your `praw.ini` in the project root as follows:
```ini
[DEFAULT]
redirect_uri=http://localhost:8080
client_id=MY_CLIENT_ID
client_secret=MY_CLIENT_SECRET
user_agent=script:com.MY_NAME.communitychess:v0.1.0 (by /u/MY_USERNAME)
```

3. Use `python src/get_refresh_token.py` to generate a refresh token. 

4. Add this line to your `praw.ini`:

```ini
refresh_token=MY_REFRESH_TOKEN
```

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "chessbot",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.12",
    "maintainer_email": "",
    "keywords": "reddit,chess",
    "author": "",
    "author_email": "Timothy Harding <tim@timharding.co>",
    "download_url": "https://files.pythonhosted.org/packages/dd/cf/90a5de72fffe6746962c1c35292b4f4b403b9fd400f89e0fa6884aee7a0e/chessbot-0.1.0.tar.gz",
    "platform": null,
    "description": "# 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\n1. Create a virtual environment to work in\n```sh\npyenv exec python -m venv .venv\n```\n\n2. Activate the virtual environment each time you open the project\n```sh\nsource .venv/bin/activate\n```\n\n3. Install dependencies\n```sh \npyenv exec pip install -r requirements/dev.txt`\n```\n\n4. [Set up](#authentication) Reddit API authentication\n\n5. To perform type checking, use\n```sh\npyenv exec mypy src/__init__.py\n```\n\n5. To run the tests, use\n```sh\npyenv exec python -m unittest discover -s src\n```\n\n5. Run the bot\n\n- `--help` shows options\n- `--timeout` sets how frequently the bot should look for moves to play\n- `--log` sets the log level\n\n```sh\n# Enable verbose logging and \n# check for moves on the current post every five seconds\npyenv exec python src/main.py --log INFO --timeout 5\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```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 `python src/get_refresh_token.py` to generate a refresh token. \n\n4. Add this line to your `praw.ini`:\n\n```ini\nrefresh_token=MY_REFRESH_TOKEN\n```\n",
    "bugtrack_url": null,
    "license": "Copyright 2024 Timothy Harding  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \u201cSoftware\u201d), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \u201cAS IS\u201d, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "A Reddit bot for moderating the /r/communitychess subreddit",
    "version": "0.1.0",
    "project_urls": {
        "Repository": "https://github.com/tim-harding/community_chess"
    },
    "split_keywords": [
        "reddit",
        "chess"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8e6d1e75bae5db024c0242793855c2a12bab1e77fce7111d45fe8f09d555ae68",
                "md5": "286b4f44ac3a36731c40647a80e48b87",
                "sha256": "b6cbbc0d6c5b92dfab9b81bca2a534b72f6e30eb5ea484bd788255b75957a57e"
            },
            "downloads": -1,
            "filename": "chessbot-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "286b4f44ac3a36731c40647a80e48b87",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.12",
            "size": 10252,
            "upload_time": "2024-01-23T00:19:42",
            "upload_time_iso_8601": "2024-01-23T00:19:42.034556Z",
            "url": "https://files.pythonhosted.org/packages/8e/6d/1e75bae5db024c0242793855c2a12bab1e77fce7111d45fe8f09d555ae68/chessbot-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ddcf90a5de72fffe6746962c1c35292b4f4b403b9fd400f89e0fa6884aee7a0e",
                "md5": "2f24b7ee384b7759f9a77cf1b09fa1cd",
                "sha256": "3e54a4ecb68169333368b3f230b265ec65523c55792b9a39ad28872b16c5441f"
            },
            "downloads": -1,
            "filename": "chessbot-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "2f24b7ee384b7759f9a77cf1b09fa1cd",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.12",
            "size": 10259,
            "upload_time": "2024-01-23T00:19:43",
            "upload_time_iso_8601": "2024-01-23T00:19:43.538438Z",
            "url": "https://files.pythonhosted.org/packages/dd/cf/90a5de72fffe6746962c1c35292b4f4b403b9fd400f89e0fa6884aee7a0e/chessbot-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-23 00:19:43",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "tim-harding",
    "github_project": "community_chess",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "chessbot"
}
        
Elapsed time: 0.23540s