Updated readme

This commit is contained in:
Collin R
2020-01-15 18:05:08 -08:00
parent 47ea3d01fe
commit 5a897fd819
2 changed files with 22 additions and 93 deletions

View File

@@ -18,11 +18,12 @@ subreddit and awards points to the user responsible for the solution.
This bot is based on the description in This bot is based on the description in
[this request](https://www.reddit.com/r/RequestABot/comments/emdeim/expert_level_bot_coding/). [this request](https://www.reddit.com/r/RequestABot/comments/emdeim/expert_level_bot_coding/).
While this could be used for other subreddits, this means that it is intended While this could be used for other subreddits, this means that it is intended
for r/MinecraftHelp. for [r/MinecraftHelp](https://www.reddit.com/r/MinecraftHelp/).
The bot will award a point to a redditor when the OP of a submission includes The bot will award a point to a redditor when the OP of a submission includes
"!Solved" somewhere in a reply to the redditor's comment on that submission. "!Solved" or "!solved" somewhere in a reply to the redditor's comment on that
These points will allow the redditor to advance to different levels: submission. These points will allow the redditor to advance to different
levels:
* Helper (5 points) * Helper (5 points)
* Trusted Helper (15 points) * Trusted Helper (15 points)
@@ -40,15 +41,19 @@ The first time a point is awarded, the bot's reply comment will also include a
brief message detailing the points system. brief message detailing the points system.
Only the submission OP's first "!Solved" comment should result in a point being Only the submission OP's first "!Solved" comment should result in a point being
awarded. awarded for each submission.
## Installation ## Installation
Requirements: Requirements:
* python3 (specifically, version 3.7 or greater) * [python3](www.python.org) (specifically, version 3.7 or greater)
* pip (should be installed alongside python) * pip (should be installed automatically alongside python)
* pipenv * [pipenv](https://pipenv.readthedocs.io/en/latest/)
* Install by running `pip install pipenv`
First, download this project using `git` or by downloading a zipfile from the
Github repository.
To install, navigate to the project root directory and run `pipenv install`. To install, navigate to the project root directory and run `pipenv install`.
To uninstall (i.e. delete the project's virtual environment and the installed To uninstall (i.e. delete the project's virtual environment and the installed
@@ -56,6 +61,13 @@ python packages), instead run `pipenv --rm`.
## Usage ## Usage
The bot can be configured by changing the values in the configuration files:
* `praw.ini`
- Contains the account information for the bot
* `pointsbot.ini`
- Contains settings for bot behavior
The simplest way to run the bot is to navigate to the project root directory and The simplest way to run the bot is to navigate to the project root directory and
run: run:
@@ -63,11 +75,7 @@ run:
pipenv run python -m pointsbot pipenv run python -m pointsbot
``` ```
## TODO ## Ideas & To-Do
* Logging
## Ideas
### Config ### Config
@@ -81,6 +89,7 @@ pipenv run python -m pointsbot
* Could also allow use of environment variables, but this seems unnecessary and * Could also allow use of environment variables, but this seems unnecessary and
could be a little too technical (though any more technically-minded users could be a little too technical (though any more technically-minded users
might appreciate the option). might appreciate the option).
* Consolidate `pointsbot.ini` and `praw.ini` into a single config file.
### Database ### Database
@@ -91,16 +100,6 @@ decided to be useful when determining a user's points.
### Determining when to award points ### Determining when to award points
Methods for awarding points, in ascending order of difficulty:
* Could just observe and wait for !Solved in addition to automoderator doing the
same, but this will create duplicate logic between automoderator and the
bot.
* Could instruct automoderator to send modmail and then have the bot use that as
its trigger to action.
* Assuming that only mods can change flairs, could find a way to check when a
submission's flair is changed to solved, and then award the points.
To ensure that points are only awarded for the first comment marked as a To ensure that points are only awarded for the first comment marked as a
solution: solution:
@@ -123,6 +122,7 @@ To ensure that a point is awarded to the correct user:
is decided upon. However, if the username argument is provided, the bot is decided upon. However, if the username argument is provided, the bot
could simple check that one of the comments in the comment tree belongs to could simple check that one of the comments in the comment tree belongs to
that user, and then award them the point. that user, and then award them the point.
- Honestly, this is probably overcomplicated and unnecessary, though.
## Questions ## Questions

View File

@@ -1,71 +0,0 @@
# Reference
A quick reference for useful API elements.
## PRAW
Attributes are dynamically generated by PRAW and thus are not guaranteed.
### Redditor model
Attributes:
* id
* name
Methods & properties:
* message(subject, message, from_subreddit=None)
### Submission model
Attributes:
* author
* comments
* created_utc
* id
* is_self
* name
* permalink
* selftext
* title
Methods & properties:
* comments
* delete()
* flair
* fullname
* mod
* reply
* shortlink
### Comment model
Attributes:
* author
* body
* created_utc
* edited
* id
* is_submitter
- if author is OP of the comment's submission
* link_id
- submission id
* parent_id
- parent comment id, which is same as link_id if top-level
* submission
- Submission instance
Methods & properties:
* is_root()
- True if top-level comment
* parent()
- Submission if top-level, else Comment for parent comment
* reply(body)
- Reply to the comment with the body string
* submission
- Same as submission above