Skip to content

Commit

Permalink
feat: add a way to get wikibanned users
Browse files Browse the repository at this point in the history
  • Loading branch information
thislooksfun committed Mar 27, 2022
1 parent de2f41b commit 7e4e603
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 @@ -335,6 +335,23 @@ export class SubredditControls extends BaseControls {
await this.unfriend(subreddit, username, "wikibanned");
}

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

/** @internal */
protected getSortedPosts(
subreddit: string | undefined,
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 @@ -967,6 +967,18 @@ export class Subreddit extends Content implements SubredditData {
return this.controls.unwikibanUser(this.displayName, username);
}

/**
* Get the list of wikibanned users for this subreddit.
*
* @note Due to the way Reddit implements Listings, this will only contain the
* first 1000 wikibanned users.
*
* @returns A listing of wikibanned users.
*/
getWikibannedUsers(): Listing<BannedUser> {
return this.controls.getWikibannedUsers(this.displayName);
}

/**
* Ban a user from this subreddit.
*
Expand Down

0 comments on commit 7e4e603

Please sign in to comment.