Skip to content

Commit

Permalink
feat: add a way to get wiki contributors
Browse files Browse the repository at this point in the history
  • Loading branch information
thislooksfun committed Mar 27, 2022
1 parent b0f7cef commit 03ab9ef
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/reddit/subreddit/controls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,23 @@ export class SubredditControls extends BaseControls {
await this.unfriend(subreddit, username, "wikicontributor");
}

/**
* Get the list of approved wiki contributors for a subreddit.
*
* @note Due to the way Reddit implements Listings, this will only contain the
* first 1000 wiki contributors.
*
* @param subreddit The name of the subreddit to get wiki contributors for.
*
* @returns A listing of approved wiki contributors.
*/
getWikiContributors(subreddit: string): Listing<ModeratorActionedUser> {
return new ModeratorActionedUserListing(fakeListingAfter(""), {
request: { url: `r/${subreddit}/about/wikicontributors`, query: {} },
client: this.client,
});
}

/**
* Ban a user from a subreddit.
*
Expand Down
12 changes: 12 additions & 0 deletions src/reddit/subreddit/object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -904,6 +904,18 @@ export class Subreddit extends Content implements SubredditData {
return this.controls.removeWikiContributor(this.displayName, username);
}

/**
* Get the list of approved wiki contributors for a subreddit.
*
* @note Due to the way Reddit implements Listings, this will only contain the
* first 1000 wiki contributors.
*
* @returns A listing of approved wiki contributors.
*/
getWikiContributors(): Listing<ModeratorActionedUser> {
return this.controls.getWikiContributors(this.displayName);
}

/**
* Mute a user in this subreddit.
*
Expand Down

0 comments on commit 03ab9ef

Please sign in to comment.