Skip to content

Commit

Permalink
Merge 68e0e21 into c2b4c6b
Browse files Browse the repository at this point in the history
  • Loading branch information
kungming2 committed Nov 15, 2019
2 parents c2b4c6b + 68e0e21 commit 302697f
Show file tree
Hide file tree
Showing 4 changed files with 360 additions and 0 deletions.
1 change: 1 addition & 0 deletions praw/endpoints.py
Expand Up @@ -100,6 +100,7 @@
"mentions": "message/mentions",
"message": "message/messages/{id}/",
"messages": "message/messages/",
"moderated": "user/{user}/moderated_subreddits/",
"moderator_messages": "r/{subreddit}/message/moderator/",
"moderator_unread": "r/{subreddit}/message/moderator/unread/",
"modmail_archive": "api/mod/conversations/{id}/archive",
Expand Down
22 changes: 22 additions & 0 deletions praw/models/reddit/redditor.py
Expand Up @@ -180,6 +180,28 @@ def gild(self, months=1):
data={"months": months},
)

def moderated(self):
"""Return a list of the redditor's moderated subreddits.
:returns: A ``list`` of :class:`~praw.models.Subreddit` objects.
Return ``[]`` if the redditor has no moderated subreddits.
Usage:
.. code:: python
for subreddit in reddit.redditor('spez').moderated():
print(subreddit.name)
print(subreddit.title)
"""
d = self._reddit.get(API_PATH["moderated"].format(user=self))
if "data" not in d:
return []
else:
subreddits = [self._reddit.subreddit(x["sr"]) for x in d["data"]]
return subreddits

def multireddits(self):
"""Return a list of the redditor's public multireddits."""
return self._reddit.get(API_PATH["multireddit_user"].format(user=self))
Expand Down

0 comments on commit 302697f

Please sign in to comment.