@devvit/public-api v0.13.2-dev
A class representing a user.
get about():
string
The user's public description about themselves. May be empty.
string
get commentKarma():
number
The amount of comment karma the user has.
number
get createdAt():
Date
The date the user was created.
Date
get displayName():
string
The display name of the user. May be different from their username.
string
get hasRedditPremium():
boolean
Whether the user has Reddit Premium.
boolean
get hasVerifiedEmail():
boolean
Indicates whether or not the user has verified their email address.
boolean
get id():
`t2_${string}`
The ID (starting with t2_) of the user to retrieve.
't2_1w72'`t2_${string}`
get isAdmin():
boolean
Whether the user is admin.
boolean
get isModerator():
boolean
Whether the user is a moderator of any subreddit.
boolean
get linkKarma():
number
The amount of link karma the user has.
number
get modPermissions():
Map<string,ModeratorPermission[]>
The permissions the user has on the subreddit.
Map<string, ModeratorPermission[]>
get nsfw():
boolean
Whether the user's profile is marked as NSFW (Not Safe For Work).
boolean
get permalink():
string
Returns a permalink path relative to https://www.reddit.com
string
get showNsfw():
boolean
Whether the user is over 18 and wishes to see NSFW content.
boolean
get url():
string
Returns the HTTP URL for the user
string
get username():
string
The username of the user omitting the u/.
'spez'string
Get the user's comments.
Omit<GetCommentsByUserOptions, "username">
Options for the request
A Listing of Comment objects.
getModPermissionsForSubreddit(
subredditName):Promise<ModeratorPermission[]>
Get the mod permissions the user has on the subreddit if they are a moderator.
string
name of the subreddit
Promise<ModeratorPermission[]>
the moderator permissions the user has on the subreddit
Get the user's posts.
Omit<GetPostsByUserOptions, "username">
Options for the request
A Listing of Post objects.
getSnoovatarUrl():
Promise<undefined|string>
Promise<undefined | string>
getSocialLinks():
Promise<UserSocialLink[]>
Gets social links of the user
Promise<UserSocialLink[]>
A Promise that resolves an Array of UserSocialLink objects
const socialLinks = await user.getSocialLinks();getTrophies():
Promise<Trophy[]>
Get the trophies displayed on this user's profile.
Promise<Trophy[]>
A Promise that resolves to an array of Trophy objects.
getUserFlairBySubreddit(
subreddit):Promise<undefined|UserFlair>
Retrieve the user's flair for the subreddit.
string
The name of the subreddit associated with the user's flair.
Promise<undefined | UserFlair>
const username = "badapple"
const subredditName = "mysubreddit"
const user = await reddit.getUserByUsername(username);
const userFlair = await user.getUserFlairBySubreddit(subredditName);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.
Promise<GetUserKarmaForSubredditResponse>
The GetUserKarmaForSubredditResponse, containing the user's karma for comments and posts in the subreddit.
toJSON():
Pick<User,"username"|"id"|"createdAt"|"nsfw"|"linkKarma"|"commentKarma"> &object
Pick<User, "username" | "id" | "createdAt" | "nsfw" | "linkKarma" | "commentKarma"> & object