Skip to content

Commit

Permalink
Merge pull request #3 from jagmeetb/feature-stop
Browse files Browse the repository at this point in the history
Add "stop" function
  • Loading branch information
rawxfish committed Jan 14, 2019
2 parents a09e509 + c5f2952 commit 5d51af4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
Create a file called "tokens.py" with

```
import praw
KEY = <Steam Web API Key>
SUBREDDIT = "dota2"
Expand Down
14 changes: 13 additions & 1 deletion get_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"crimson589", "lestye", "JohnScofield"]
SUBJECTS = ["matchbot", "stop"]
TOURNAMENT_SUB = TOURNAMENT_ACCT.subreddit(SUBREDDIT)
WIKI = praw.models.WikiPage(TOURNAMENT_ACCT, "dota2", "live_matches")
WIKI = praw.models.WikiPage(TOURNAMENT_ACCT, SUBREDDIT, "live_matches")
REQUIRED_FIELDS = ["match_id", "post_id"]
TRACKED_POSTS = dict()

Expand Down Expand Up @@ -89,6 +89,18 @@ def update(message):

mark(message)

def stop(message):
post = message.body

if post in TRACKED_POSTS:
message.reply("Post %s will be stopped PepeHands" % post)
TRACKED_POSTS[post].terminate()
TRACKED_POSTS.pop(post, None)
log("Stopping post %s" % post)
else:
message.reply("Post %s is not currently being updated FeelsWeirdMan" % post)

mark(message)

def wiki():
while True:
Expand Down

0 comments on commit 5d51af4

Please sign in to comment.