Community Chess Bot
A moderator bot for Community Chess, a collaborative chess game on Reddit.
Contributing
- Create a virtual environment to work in
pyenv exec python -m venv .venv
- Activate the virtual environment each time you open the project
source .venv/bin/activate
- Install dependencies
pyenv exec pip install -r requirements/dev.txt`
-
Set up Reddit API authentication
-
To perform type checking, use
pyenv exec mypy src/__init__.py
- To run the tests, use
pyenv exec python -m unittest discover -s src
- Run the bot
--helpshows options--timeoutsets how frequently the bot should look for moves to play--logsets the log level
# 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 for authentication.
-
Create an application in your Reddit application preferences. Note your
client_secret, shown when your press edit, and yourclient_id, listed below personal use script. -
Set up your
praw.iniin the project root as follows:
[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)
-
Use
python src/get_refresh_token.pyto generate a refresh token. -
Add this line to your
praw.ini:
refresh_token=MY_REFRESH_TOKEN
Metadata
Release files for chessbot 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| chessbot-0.1.0.tar.gz | 10.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| chessbot-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.5 kB
Release files / chessbot-0.1.0.tar.gz
| Download URL | chessbot-0.1.0.tar.gz |
|---|---|
| Size | 10.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3e54a4ecb68169333368b3f230b265ec65523c55792b9a39ad28872b16c5441f
|
|
BLAKE2b-256 checksum How to use checksums |
ddcf90a5de72fffe6746962c1c35292b4f4b403b9fd400f89e0fa6884aee7a0e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.12.1
|
Release files / chessbot-0.1.0-py3-none-any.whl
| Download URL | chessbot-0.1.0-py3-none-any.whl |
|---|---|
| Size | 10.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b6cbbc0d6c5b92dfab9b81bca2a534b72f6e30eb5ea484bd788255b75957a57e
|
|
BLAKE2b-256 checksum How to use checksums |
8e6d1e75bae5db024c0242793855c2a12bab1e77fce7111d45fe8f09d555ae68
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.12.1
|