Skip to main content

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

  1. Create a virtual environment to work in
pyenv exec python -m venv .venv
  1. Activate the virtual environment each time you open the project
source .venv/bin/activate
  1. Install dependencies
pyenv exec pip install -r requirements/dev.txt`
  1. Set up Reddit API authentication

  2. To perform type checking, use

pyenv exec mypy src/__init__.py
  1. To run the tests, use
pyenv exec python -m unittest discover -s src
  1. Run the bot
  • --help shows options
  • --timeout sets how frequently the bot should look for moves to play
  • --log sets 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.

  1. Create an application in your Reddit application preferences. 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:

[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)
  1. Use python src/get_refresh_token.py to generate a refresh token.

  2. Add this line to your praw.ini:

refresh_token=MY_REFRESH_TOKEN

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

chessbot-0.1.0.tar.gz (10.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

chessbot-0.1.0-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

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

Hashes for chessbot-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3e54a4ecb68169333368b3f230b265ec65523c55792b9a39ad28872b16c5441f
MD5 2f24b7ee384b7759f9a77cf1b09fa1cd
BLAKE2b-256 ddcf90a5de72fffe6746962c1c35292b4f4b403b9fd400f89e0fa6884aee7a0e

See more details on using hashes here.

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

Hashes for chessbot-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b6cbbc0d6c5b92dfab9b81bca2a534b72f6e30eb5ea484bd788255b75957a57e
MD5 286b4f44ac3a36731c40647a80e48b87
BLAKE2b-256 8e6d1e75bae5db024c0242793855c2a12bab1e77fce7111d45fe8f09d555ae68

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page