Skip to main content

SubredditModeratorUser

@devvit/public-api v0.13.10-dev


Class: SubredditModeratorUser

Moderator of a subreddit; data from the AboutWhere response. Use getModerators() or subreddit.getModerators() to receive a listing of these.

Extends

Properties

date

readonly date: Date

When the moderator relationship was created (UTC).


moderatorInfo

readonly moderatorInfo: object

Moderator relationship data for the subreddit. Nested to avoid shadowing User.modPermissions, which stores permissions across all subreddits.

authorFlairCssClass?

optional authorFlairCssClass: string

User flair CSS class in the subreddit.

authorFlairText?

optional authorFlairText: string

User flair text in the subreddit.

modPermissions

modPermissions: ModeratorPermission[]

Moderator permissions for this subreddit.

Accessors

about

Get Signature

get about(): string

The user's public description about themselves. May be empty.

Returns

string

Inherited from

User.about


commentKarma

Get Signature

get commentKarma(): number

The amount of comment karma the user has.

Returns

number

Inherited from

User.commentKarma


createdAt

Get Signature

get createdAt(): Date

The date the user was created.

Returns

Date

Inherited from

User.createdAt


displayName

Get Signature

get displayName(): string

The display name of the user. May be different from their username.

Returns

string

Inherited from

User.displayName


hasRedditPremium

Get Signature

get hasRedditPremium(): boolean

Whether the user has Reddit Premium.

Returns

boolean

Inherited from

User.hasRedditPremium


hasVerifiedEmail

Get Signature

get hasVerifiedEmail(): boolean

Indicates whether or not the user has verified their email address.

Returns

boolean

Inherited from

User.hasVerifiedEmail


id

Get Signature

get id(): `t2_${string}`

The ID (starting with t2_) of the user to retrieve.

Example
't2_1w72'
Returns

`t2_${string}`

Inherited from

User.id


isAdmin

Get Signature

get isAdmin(): boolean

Whether the user is admin.

Returns

boolean

Inherited from

User.isAdmin


isModerator

Get Signature

get isModerator(): boolean

Whether the user is a moderator of any subreddit.

Returns

boolean

Inherited from

User.isModerator


linkKarma

Get Signature

get linkKarma(): number

The amount of link karma the user has.

Returns

number

Inherited from

User.linkKarma


modPermissions

Get Signature

get modPermissions(): Map<string, ModeratorPermission[]>

The permissions the user has on the subreddit.

Returns

Map<string, ModeratorPermission[]>

Inherited from

User.modPermissions


nsfw

Get Signature

get nsfw(): boolean

Whether the user's profile is marked as NSFW (Not Safe For Work).

Returns

boolean

Inherited from

User.nsfw


Get Signature

get permalink(): string

Returns a permalink path relative to https://www.reddit.com

Returns

string

Inherited from

User.permalink


showNsfw

Get Signature

get showNsfw(): boolean

Whether the user is over 18 and wishes to see NSFW content.

Returns

boolean

Inherited from

User.showNsfw


url

Get Signature

get url(): string

Returns the HTTP URL for the user

Returns

string

Inherited from

User.url


username

Get Signature

get username(): string

The username of the user omitting the u/.

Example
'spez'
Returns

string

Inherited from

User.username

Methods

getComments()

getComments(options): Listing<Comment>

Get the user's comments.

Parameters

options

Omit<GetCommentsByUserOptions, "username">

Options for the request

Returns

Listing<Comment>

A Listing of Comment objects.

Inherited from

User.getComments


getModPermissionsForSubreddit()

getModPermissionsForSubreddit(subredditName): Promise<ModeratorPermission[]>

Get the mod permissions the user has on the subreddit if they are a moderator.

Parameters

subredditName

string

name of the subreddit

Returns

Promise<ModeratorPermission[]>

the moderator permissions the user has on the subreddit

Inherited from

User.getModPermissionsForSubreddit


getPosts()

getPosts(options): Listing<Post>

Get the user's posts.

Parameters

options

Omit<GetPostsByUserOptions, "username">

Options for the request

Returns

Listing<Post>

A Listing of Post objects.

Inherited from

User.getPosts


getSnoovatarUrl()

getSnoovatarUrl(): Promise<undefined | string>

Returns

Promise<undefined | string>

Inherited from

User.getSnoovatarUrl


getSocialLinks(): Promise<UserSocialLink[]>

Gets social links of the user

Returns

Promise<UserSocialLink[]>

A Promise that resolves an Array of UserSocialLink objects

Example

const socialLinks = await user.getSocialLinks();

Inherited from

User.getSocialLinks


getTrophies()

getTrophies(): Promise<Trophy[]>

Get the trophies displayed on this user's profile.

Returns

Promise<Trophy[]>

A Promise that resolves to an array of Trophy objects.

Inherited from

User.getTrophies


getUserFlairBySubreddit()

getUserFlairBySubreddit(subreddit): Promise<undefined | UserFlair>

Retrieve the user's flair for the subreddit.

Parameters

subreddit

string

The name of the subreddit associated with the user's flair.

Returns

Promise<undefined | UserFlair>

Example

const username = "badapple"
const subredditName = "mysubreddit"
const user = await reddit.getUserByUsername(username);
const userFlair = await user.getUserFlairBySubreddit(subredditName);

Inherited from

User.getUserFlairBySubreddit


getUserKarmaFromCurrentSubreddit()

getUserKarmaFromCurrentSubreddit(): Promise<GetUserKarmaForSubredditResponse>

Returns the karma for this User in the current subreddit. The user making the request must be a moderator of the subreddit to read another user's karma in the subreddit. An exception is if the specified user is the same as the user making the request.

Returns

Promise<GetUserKarmaForSubredditResponse>

The GetUserKarmaForSubredditResponse, containing the user's karma for comments and posts in the subreddit.

Inherited from

User.getUserKarmaFromCurrentSubreddit


toJSON()

toJSON(): Pick<User, "username" | "id" | "createdAt" | "nsfw" | "linkKarma" | "commentKarma"> & object & Pick<SubredditModeratorUser, "date" | "moderatorInfo">

Returns

Pick<User, "username" | "id" | "createdAt" | "nsfw" | "linkKarma" | "commentKarma"> & object & Pick<SubredditModeratorUser, "date" | "moderatorInfo">

Overrides

User.toJSON