Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
/ rare-botanist Public archive

🌱🤖 /r/RareHouseplantsBST subreddit bot.

License

Notifications You must be signed in to change notification settings

erxclau/rare-botanist

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rare-botanist

Description

This repository contains code for the bot on the /r/RareHouseplantsBST subreddit.

The bot uses the Python Reddit API Wrapper (PRAW) to interact with Reddit. The bot also uses GitHub Actions workflows with cron schedules to run scripts.

Bot Roles

Create Review Thread

The bot will create a new review thread at the start of every month. This review thread post will have a 'Review Thread' flair and will also be pinned and distinguished. The previous month's thread will be unpinned and locked.

Relevant files: create_thread.py, thread.yml, current_thread.json

Validate Confirmed Trades

The bot will reply to correctly formatted interactions in the review thread at the end of every day and appropriately update a log based on the interaction. These interactions will be locked after validation. If a user reaches a certain number of interactions, their flair will be updated. Comments that do not follow the rules will be removed.

Relevant files: confirm_comments.py, comment.yml, current_thread.json, comment-data.json

Reply to BST Posts

The bot will continually respond to posts flaired with 'Buying', 'Selling', or 'Trading' with statistical comments based on the author.

Relevant files: stat_reply, reply.yml, comment-data.json

Deployment to github-actions branch

  1. Merge main into github-actions
  2. Create a pull request from github-actions to main
  3. Squash the PR and merge
  4. Go to main and pull
  5. Delete your local github-actions branch
  6. Create a new github-actions branch based on main
  7. Force push github-actions to GitHub

Configuration

config.json has been encrypted using the following command:

gpg --symmetric --cipher-algo AES256 config.json

config.json should look like the following:

{
    "CLIENT_ID": "",
    "CLIENT_SECRET": "",
    "USER_AGENT": "",
    "USERNAME": "",
    "PASSWORD": "",
    "REVIEW_FLAIR": "",
    "USER_FLAIRS": [],
    "POST_FLAIRS": [],
    "REMOVAL_REASONS": {},
    "SUBREDDIT": "",
    "CUTOFF": ""
}

CLIENT_ID, CLIENT_SECRET, USER_AGENT, USERNAME, and PASSWORD are needed to interact with the Reddit API via PRAW. See the quick start guide here.

REVIEW_FLAIR is the Flair ID associated with the flair each review thread has.

USER_FLAIRS contains a list of Flair IDs associated with the flairs that users receive when they reach a certain number of validated interactions.

POST_FLAIRS contains a list of Flair IDs associated with the flairs that users put on Buying, Selling, or Trading posts.

REMOVAL_REASONS contains a dictionary of removal reason names and their IDs.

SUBREDDIT is the name of the subreddit.

CUTOFF is the ISO 8601 date such that only posts after this date will be considered for receiving a statistics comment.

About

🌱🤖 /r/RareHouseplantsBST subreddit bot.

Resources

License

Stars

Watchers

Forks

Languages