Simplified docs

This commit is contained in:
Collin R
2020-02-08 00:42:48 -08:00
parent dc51398492
commit de01671e98
5 changed files with 91 additions and 74 deletions

View File

@@ -130,7 +130,7 @@ Some of the bot's behaviors, e.g. altering redditor flairs, require moderator
permissions. It should require just the "Flair" and "Posts" permissions and
perhaps the "Access" permission, so you don't need to grant it full permissions.
## Terms of Use for a bot for Reddit
## Terms of use for a bot for Reddit
Since this is an open-source, unmonetized program, it should be considered
non-commercial, and is thus allowed to use the Reddit API without registration.

48
docs/DONE.md Normal file
View File

@@ -0,0 +1,48 @@
# DONE
## General
## File-Specific
### bot.py
* [X] Allow mods to mark a post as solved with "/[Ss]olved"
* [X] Allow mods to use "/[Ss]olved" in any context
* [X] When replying to solution, the bot should...
- [X] Reply to the comment containing the "![Ss]olved" string
- [X] Tag the solver so they will be notified
- ~~Delete the automod message~~
* ~~Add a star to the user flair for every 100 points~~
* ~~Add a way to look up user points~~
- i.e. summon bot by tagging it and provide a username to look up
- the bot will reply with the last message that the user received
### config.py
* [X] Change from `ini` to `toml `
* [X] Consolidate `pointsbot.ini` and `praw.ini` into a single config file.
* [X] Add option for flair_template_id
* [X] Check for config file in a well-known location, e.g. `~` directory
- Probably named `~/.pointsbot` or something similar
- Could do something similar to packages like PRAW:
1. Look in current working directory first.
2. Look in OS-dependent location next.
3. (Maybe) Finally, could look in the directory containing the source files
(using `__file__`).
* [X] Add interactive config scipt
* ~~Fix titlecase problem with roman numerals~~
- Only an issue with `ini` format
* ~~Separate the development-handy config items into separate section~~
- Don't really have any right now
### database.py
### reply.py
* [X] Fix progress bar
* ~~For the footer section of the reply comment regarding the bot, could have the
bot make a post on its account explaining itself, and link to that (and then
also link to the source code separately, and perhaps in that post, too).
Could even have the bot make this post automatically if it doesn't have a
link to the post in its config, and then store the link for future use.~~

27
docs/IDEAS.md Normal file
View File

@@ -0,0 +1,27 @@
# IDEAS
## Determining when to award points
To ensure that points are only awarded for the first comment marked as a
solution:
* Alter the database to allow for tracking of each submission and the first
comment marked as the solution. Then, everytime a new solution comment is
detected, simply check the database to see if the submission is already
counted. This will avoid unnecessary calls to Reddit, which would include
scanning all the submission comments each time.
* This approach could also make it simpler to check whether a solution comment
has been edited. Instead of having to do a daily search for edits, it could
just check the original solution comment to ensure that it still contains
the "!solved" string. If not, it can remove points from that author and
award points to the new author.
To ensure that a point is awarded to the correct user:
* We could expand the "!solved" bot summons to include an optional username
argument. Without the argument, the bot will award the point to either the
top-level comment or the parent comment of the "!solved" comment, whichever
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
that user, and then award them the point.
- Honestly, this is probably overcomplicated and unnecessary, though.

View File

@@ -6,6 +6,8 @@
* [ ] Logging
* [ ] Testing
- Any PRAW model that inherits from `praw.PRAWBase` has a `parse` method
that could perhaps be used to make fake objects for testing.
* [ ] GUI
- [ ] Create a GUI for configuring and running the bot, and performing other jobs
like adding or subtracting points for specific redditors
@@ -37,11 +39,10 @@
solved until you've actually tried the proposed solution"
* [ ] As mentioned in the previous section, implement a recovery mode
## File-Specific Tasks
## File-Specific
### bot.py
* [ ] Allow mods to use "/[Ss]olved" in any context
* [ ] Allow mods and/or bot owner to add or remove points from specific users
* [ ] Make the algorithm for determining the problem solver more sophisticated
- e.g. check entire comment tree instead of just ignoring if the OP also
@@ -49,85 +50,19 @@
- Ask OP for clarification only if solver cannot be sufficiently determined
- Again, this behavior could also perhaps be better enforced through
subreddit rules rather than algorithmically
* [X] Allow mods to mark a post as solved with "/solved"
* [X] When replying to solution, the bot should...
- [X] Reply to the comment containing the "![Ss]olved" string
- [X] Tag the solver so they will be notified
- ~~Delete the automod message~~
* ~~Add a star to the user flair for every 100 points~~
* ~~Add a way to look up user points~~
- i.e. summon bot by tagging it and provide a username to look up
- the bot will reply with the last message that the user received
### config.py
* [ ] Switch from `toml` package to `tomlkit` package
- Preserves style, comments, etc.
* [X] Change from `ini` to `toml `
* [X] Consolidate `pointsbot.ini` and `praw.ini` into a single config file.
* [X] Add option for flair_template_id
* [X] Check for config file in a well-known location, e.g. `~` directory
- Probably named `~/.pointsbot` or something similar
- Could do something similar to packages like PRAW:
1. Look in current working directory first.
2. Look in OS-dependent location next.
3. (Maybe) Finally, could look in the directory containing the source files
(using `__file__`).
* [X] Add interactive config scipt
* ~~Fix titlecase problem with roman numerals~~
- Only an issue with `ini` format
* ~~Separate the development-handy config items into separate section~~
- Don't really have any right now
### database.py
* [ ] Store date for each "!solved" comment
- This basically means storing a link to each "![Ss]olved" comment, and
perhaps a link to the submission, although that can be derived as long
as the comment doesn't get deleted
* [ ] Possibly refactor for a datastore type thing instead of database
- Maybe even make models like Redditor to combine data storage/access with
logic, e.g. determining current level
### reply.py
* [X] Fix progress bar
* ~~For the footer section of the reply comment regarding the bot, could have the
bot make a post on its account explaining itself, and link to that (and then
also link to the source code separately, and perhaps in that post, too).
Could even have the bot make this post automatically if it doesn't have a
link to the post in its config, and then store the link for future use.~~
## Ideas
### Config
### Database
* Should it keep track of the solved posts for future reference and calculate
points on the fly, rather than just keeping track of points? If so, should
have a column denoting whether the post has been deleted, if that
information is decided to be useful when determining a user's points.
### Determining when to award points
To ensure that points are only awarded for the first comment marked as a
solution:
* Alter the database to allow for tracking of each submission and the first
comment marked as the solution. Then, everytime a new solution comment is
detected, simply check the database to see if the submission is already
counted. This will avoid unnecessary calls to Reddit, which would include
scanning all the submission comments each time.
* This approach could also make it simpler to check whether a solution comment
has been edited. Instead of having to do a daily search for edits, it could
just check the original solution comment to ensure that it still contains
the "!solved" string. If not, it can remove points from that author and
award points to the new author.
To ensure that a point is awarded to the correct user:
* We could expand the "!solved" bot summons to include an optional username
argument. Without the argument, the bot will award the point to either the
top-level comment or the parent comment of the "!solved" comment, whichever
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
that user, and then award them the point.
- Honestly, this is probably overcomplicated and unnecessary, though.

View File

@@ -1,8 +1,15 @@
#!/usr/bin/env bash
# If files specified, only make them; otherwise, make all
if [[ $# -gt 0 ]]; then
docfiles=( "$@" )
else
docfiles=( $(ls *.md) )
fi
for fname in "${docfiles[@]}"; do
outname="${fname/%md/html}"
outname="_${fname/%md/html}"
echo $fname "->" $outname
pandoc -s -f gfm -t html $fname -o $outname --metadata pagetitle="$outname"
open $outname
done