Updated readme and sample config

This commit is contained in:
Collin Rapp
2020-02-04 14:18:46 -08:00
parent 107e5f6bfb
commit cc68a5f706
4 changed files with 26 additions and 76 deletions

View File

@@ -4,7 +4,7 @@
* [Description](#description) * [Description](#description)
* [Installation](#installation) * [Installation](#installation)
* [Configuration](#configuration) * [Setup](#setup)
* [Usage](#usage) * [Usage](#usage)
* [Terms of Use for a bot for Reddit](#terms-of-use-for-a-bot-for-reddit) * [Terms of Use for a bot for Reddit](#terms-of-use-for-a-bot-for-reddit)
* [License](#license) * [License](#license)
@@ -60,44 +60,31 @@ To uninstall (i.e. delete the project's virtual environment and the installed
python packages), navigate to the project root directory and instead run python packages), navigate to the project root directory and instead run
`pipenv --rm`. `pipenv --rm`.
## Configuration ## Setup
The bot can be configured by changing the values in the configuration files in ### Configuration file
the project root directory:
* `praw.ini` The bot can be configured by changing or adding to the values in the
- Contains the account information for the bot configuration file, `pointsbot.toml`.
* `pointsbot.ini`
- Contains settings for bot behavior
You shouldn't have to worry about it, but if you need it, the syntax for the You shouldn't have to worry about it, but if you need it, information on the
config files can be found on the TOML syntax used for the file can be found on
[INI file format's Wikipedia page](https://en.wikipedia.org/wiki/INI_file). [Github](https://github.com/toml-lang/toml).
If this is your first time running the bot, you will need to copy If this is your first time running the bot, you will need to copy
`praw.sample.ini` to a new file called `praw.ini`, and likewise copy `pointsbot.sample.toml` to a new file called `pointsbot.toml`. Any instances of
`pointsbot.sample.ini` to a new file called `pointsbot.ini`. Any instances of the word "REDACTED" should be replaced with the appropriate values; other values
the word "REDACTED" should be replaced with the desired values; other values should work as-is, but can be changed as needed.
should work as-is, but can be changed as desired.
The reason for this is that these config files (especially `praw.ini`) can This is because the config file can contain sensitive information, and
contain sensitive information, and maintaining only sample versions of these maintaining only sample versions of these files helps developers to avoid
files helps developers to avoid accidentally uploading that sensitive accidentally uploading that sensitive information to a public (or even private)
information to a public (or even private) code repository. code repository.
### praw.ini More information on the specific config options can be found in the comments in
the sample config file.
Several credentials are needed for running your bot, each of which is listed in ### Bot account
the `praw.ini` config file:
* `client_id`: Copy from your app preferences, as specified in the steps below.
* `client_secret`: Copy from your app preferences, as specified in the steps
below.
* `user-agent`: This field can be left as-is, thought if you'd like, you can
change it by following
[these guidelines](https://github.com/reddit-archive/reddit/wiki/API).
* `username`: The username for the bot account.
* `password`: The password for the bot account.
In order to make a bot, you must first have a bot account. This could be a In order to make a bot, you must first have a bot account. This could be a
personal account, but it is wise to create a dedicate account for the bot, personal account, but it is wise to create a dedicate account for the bot,
@@ -127,32 +114,6 @@ can be found by navigating to your
[app preferences](https://www.reddit.com/prefs/apps) and selecting the "edit" [app preferences](https://www.reddit.com/prefs/apps) and selecting the "edit"
button for the app under the "developed applications" section. button for the app under the "developed applications" section.
### pointsbot.ini
For now, these settings are pretty straightforward.
The `Core` section:
* `subreddit_name`: The name of the subreddit to monitor
* `praw_site_name`: This should probably be left alone; it tells the bot which
credentials to use when authenticating with Reddit. It's useful for
development and easy testing with different accounts without having to
modify values in the code.
* `database_name`: This is the filepath to the SQLite database file, which ends
with the `.db` file extension.
The `Levels` section is used to determine the available user levels and
corresponding flair texts.
* The key on the left-hand side specifies the title and flair text for the
level; the case is ignored, and the text is converted to title case (first
letter of each word capitalized, and the rest lowercase).
* The value on the right-hand side of each line is the total number of points
required to reach that level.
The order of these lines doesn't matter; the bot will sort them in order of
point totals.
### Make the bot a mod in your subreddit ### Make the bot a mod in your subreddit
Some of the bot's behaviors, e.g. altering redditor flairs, require moderator Some of the bot's behaviors, e.g. altering redditor flairs, require moderator

View File

@@ -1,9 +0,0 @@
[Core]
subreddit_name = REDACTED
praw_site_name = bot
database_name = pointsbot.db
[Levels]
Helper = 5
Trusted Helper = 15
Super Helper = 40

View File

@@ -32,10 +32,10 @@ database = "pointsbot.db"
################################################################################ ################################################################################
[credentials] [credentials]
client_id = "" client_id = "REDACTED"
client_secret = "" client_secret = "REDACTED"
username = "" username = "REDACTED"
password = "" password = "REDACTED"
################################################################################ ################################################################################
@@ -54,6 +54,10 @@ password = ""
# #
# The flair_template_id field is optional, so it may be omitted or left as the # The flair_template_id field is optional, so it may be omitted or left as the
# empty string, "". # empty string, "".
#
# Furthermore, the order of these levels does not matter: they will be sorted by
# point values when the bot is run. However, it may be preferable to order them
# by point values for readability.
################################################################################ ################################################################################
[[levels]] [[levels]]

View File

@@ -1,6 +0,0 @@
[bot]
client_id = REDACTED
client_secret = REDACTED
user_agent = PointsBot (by /u/GlipGlorp7)
username = REDACTED
password = REDACTED