alexames / DeltaBot

GNU General Public License v3.0
65 stars 18 forks source link

DeltaBot Requirements #43

Closed chrisuehlinger closed 10 years ago

chrisuehlinger commented 10 years ago

I was working at trying to make deltaBot more testable, but it's becoming difficult to tell if I'm breaking features in the process.

I think DeltaBot could use a Requirements document. Nothing fancy, just a detailed list of features to help new developers figure out what things deltaBot needs to do.

I'm going to start here. Anyone familiar with the project, please chime in with anything that isn't included:

Constraints: 1 - DeltaBot cannot store anything in a database, aside from the most recently scanned comments' ID. 2 - DeltaBot should make the fewest possible calls to PRAW while still doing its job. 3 - DeltaBot should be able to stop and restart later, using the most recently scanned comment to resume where it left off. If this does not work, start from the oldest comment. We cannot assume that it is running continuously.

Features: 1 - DeltaBot should periodically scan any new comments that have been made in its subreddit. 2 - If a comment contains a Delta Symbol, DeltaBot should award 1 point to the author of the comment's parent, unless: 2.1 - The parent is OP, DeltaBot or the awarder. 2.2 - The commenter has already awarded a delta to this comment. 2.3 - The commenter has already awarded a delta to the parent's author at a higher point in the thread (but elsewhere in the comment tree or elsewhere in the submission's comment page are cool) 2.4 - The comment is shorter than [length] 3 - Awarding a delta to a user consists of: 3.1 - Adding 1 to the number in the user's flair or giving them a flair of "1" if they have no flair 3.2 - Checking if they have one of the top 10 scores this month. If so, update the high score chart in the sidebar to show this. 3.3 - If the user has their own wiki page, update it to show the correct number of deltas. 3.4 - If the user does not have a wiki page, create one with the correct number of deltas. 4 - DeltaBot should periodically scan its inbox to check for commands from mods. 4.1 - If there is a message from a mod, it scans the message for commands 4.1.1 - If it receives the command "STOP" it will save the ID of its most recently scanned comment and terminate 4.1.2 - [If it receives etc. etc. etc.]

PixelOrange commented 10 years ago

For the 3rd constraint, if it can't find the old comment it should just start from the oldest comment and keep going. Sometimes, if too many comments have passed, it freaks out if you don't do that.

For feature 2.1, mods can receive deltas.

Feature 3.4 should say, "If they don't have their own wiki page, create one. Then complete feature 3.3"

chrisuehlinger commented 10 years ago

For the 3rd constraint, if it can't find the old comment it should just start from the oldest comment and keep going. Sometimes, if too many comments have passed, it freaks out if you don't do that.

The oldest comment? As in it crawls the entire history of /r/CMV? Or is there a milestone, like first of the month?

For feature 2.1, mods can receive deltas. Feature 3.4 should say, "If they don't have their own wiki page, create one. Then complete feature 3.3"

Fixed these. I also added to 2.1 that commenters cannot award themselves.

alexames commented 10 years ago

The oldest comment? As in it crawls the entire history of /r/CMV? Or is there a milestone, like first of the month?

Reddit imposes a limit of 1000 results max per query, so if you ask for the newest comments, you'll get at most the most recent 1000 comments.

It only takes a few minutes to scan the last 1000 comments in the case where deltabot is down for an extended period of time.

Snorrrlax commented 10 years ago

Adding 1 to the number in the user's flair or giving them a flair of "1" if they have no flair

It originally just added "1" to the flair and the delta symbol was added through CSS, but this was changed so that the delta symbol was added as text to flair through DeltaBot. You might have already realised this, but just in case, the sentence should read: "Adding 1 to the number in the user's flair or giving them a flair of "1∆" if they have no flair."

Apart from that, and a couple of the coding details Amablue and PixelOrange have mentioned, its looking pretty good to me. One question though - are these features that are already implemented, or do we want to add things to the list that we'd like to see in the future?

chrisuehlinger commented 10 years ago

Reddit imposes a limit of 1000 results max per query, so if you ask for the newest comments, you'll get at most the most recent 1000 comments.

OK good, I need to look more into how the Reddit API works, this is my first time working with it. My only concern here would be if deltabot were down for so long that more than 1000 comments were posted. Would that cause there to be a gap where deltas wouldn't be recognized? Has this situation ever occured before? (I'm unfamiliar with CMV's comments/day or traffic numbers)

One question though - are these features that are already implemented, or do we want to add things to the list that we'd like to see in the future?

Let's start with the features that are already implemented. The testing framework will allow us to make sure that we actually have those features, then we can add new features and tests one at a time.

If you don't mind I'm going to add some contributor guidelines to the readme when I'm done, so that future devs will know to properly test the things they add. The tests will also allow them to tell if they've broken anything an older dev may have built, and the requirements list will help them to understand why each part of deltabot exists.

If these requirements look good to you, I'll get right to work.

chrisuehlinger commented 10 years ago

Actually, jmu303's stylistic changes will completely conflict with everything I'm about to do. If you guys can accept his pull request, I'll clone the repo again after that and then get started.

PixelOrange commented 10 years ago

@chrisuehlinger I pulled it and fixed a few mistakes (not every line was below the 80 char threshold). I'm not super familiar with line breaks in code, so will you validate the last commit diff?

chrisuehlinger commented 10 years ago

Looks good so far, I'll fix any problems I find.

I added the requirements document to the repo and submitted a pull request. I'll get to work on the actual code, and post updates as I go.