A Reddit bot for moderating the /r/communitychess subreddit
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file chessbot-0.1.0.tar.gz.
File metadata
- Download URL: chessbot-0.1.0.tar.gz
- Upload date:
- Size: 10.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3e54a4ecb68169333368b3f230b265ec65523c55792b9a39ad28872b16c5441f
|
|
| MD5 |
2f24b7ee384b7759f9a77cf1b09fa1cd
|
|
| BLAKE2b-256 |
ddcf90a5de72fffe6746962c1c35292b4f4b403b9fd400f89e0fa6884aee7a0e
|
File details
Details for the file chessbot-0.1.0-py3-none-any.whl.
File metadata
- Download URL: chessbot-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b6cbbc0d6c5b92dfab9b81bca2a534b72f6e30eb5ea484bd788255b75957a57e
|
|
| MD5 |
286b4f44ac3a36731c40647a80e48b87
|
|
| BLAKE2b-256 |
8e6d1e75bae5db024c0242793855c2a12bab1e77fce7111d45fe8f09d555ae68
|