Redditor

class asyncpraw.models.Redditor(reddit: asyncpraw.Reddit, name: Optional[str] = None, fullname: Optional[str] = None, _data: Optional[Dict[str, Any]] = None)

A class representing the users of reddit.

Typical Attributes

This table describes attributes that typically belong to objects of this class. Since attributes are dynamically provided (see Determine Available Attributes of an Object), there is not a guarantee that these attributes will always be present, nor is this list necessarily complete.

Note

Shadowbanned accounts are treated the same as non-existent accounts, meaning that they will not have any attributes.

Note

Suspended/banned accounts will only return the name and is_suspended attributes.

Attribute

Description

comment_karma

The comment karma for the Redditor.

comments

Provide an instance of SubListing for comment access.

created_utc

Time the account was created, represented in Unix Time.

has_verified_email

Whether or not the Redditor has verified their email.

icon_img

The url of the Redditors’ avatar.

id

The ID of the Redditor.

is_employee

Whether or not the Redditor is a Reddit employee.

is_friend

Whether or not the Redditor is friends with the authenticated user.

is_mod

Whether or not the Redditor mods any subreddits.

is_gold

Whether or not the Redditor has active Reddit Premium status.

is_suspended

Whether or not the Redditor is currently suspended.

link_karma

The link karma for the Redditor.

name

The Redditor’s username.

subreddit

If the Redditor has created a user-subreddit, provides a dictionary of additional attributes. See below.

subreddit["banner_img"]

The URL of the user-subreddit banner.

subreddit["name"]

The fullname of the user-subreddit.

subreddit["over_18"]

Whether or not the user-subreddit is NSFW.

subreddit["public_description"]

The public description of the user- subreddit.

subreddit["subscribers"]

The number of users subscribed to the user-subreddit.

subreddit["title"]

The title of the user-subreddit.

__init__(reddit: asyncpraw.Reddit, name: Optional[str] = None, fullname: Optional[str] = None, _data: Optional[Dict[str, Any]] = None)

Initialize a Redditor instance.

Parameters
  • reddit – An instance of Reddit.

  • name – The name of the redditor.

  • fullname – The fullname of the redditor, starting with t2_.

Exactly one of name, fullname or _data must be provided.

await block()

Block the Redditor.

For example, to block Redditor spez:

redditor = await reddit.redditor("spez")
await redditor.block()
comments()asyncpraw.models.listing.mixins.redditor.SubListing

Provide an instance of SubListing for comment access.

For example, to output the first line of all new comments by u/spez try:

redditor = await reddit.redditor("spez")
async for comment in redditor.comments.new(limit=None):
    print(comment.body.split("\n", 1)[0][:79])
controversial(time_filter: str = 'all', **generator_kwargs: Union[str, int, Dict[str, str]])AsyncIterator[Any]

Return a ListingGenerator for controversial submissions.

Parameters

time_filter – Can be one of: all, day, hour, month, week, year (default: all).

Raises

ValueError if time_filter is invalid.

Additional keyword arguments are passed in the initialization of ListingGenerator.

This method can be used like:

reddit.domain("imgur.com").controversial("week")

multireddit = await reddit.multireddit("samuraisam", "programming")
multireddit.controversial("day")

redditor = await reddit.redditor("spez")
redditor.controversial("month")

redditor = await reddit.redditor("spez")
redditor.comments.controversial("year")

redditor = await reddit.redditor("spez")
redditor.submissions.controversial("all")

subreddit = await reddit.subreddit("all")
subreddit.controversial("hour")
downvoted(**generator_kwargs: Union[str, int, Dict[str, str]])AsyncIterator[Any]

Return a ListingGenerator for items the user has downvoted.

Raises

asyncprawcore.Forbidden if the user is not authorized to access the list.

Note

Since this function returns a ListingGenerator the exception may not occur until sometime after this function has returned.

Additional keyword arguments are passed in the initialization of ListingGenerator.

For example, to get all downvoted items of the authenticated user:

current_user = await reddit.user.me()
async for item in current_user.downvoted():
    print(item.id)
await friend(note: Optional[str] = None)

Friend the Redditor.

Parameters

note – A note to save along with the relationship. Requires Reddit Premium (default: None).

Calling this method subsequent times will update the note.

For example, to friend Redditor spez:

redditor = await reddit.redditor("spez")
await redditor.friend()

To add a note to the friendship (requires Reddit Premium):

redditor = await reddit.redditor("spez")
await redditor.friend(note="My favorite admin")
await friend_info()asyncpraw.models.Redditor

Return a Redditor instance with specific friend-related attributes.

Returns

A Redditor instance with fields date, id, and possibly note if the authenticated user has Reddit Premium.

For example, to get the friendship information of Redditor spez:

redditor = await reddit.redditor("spez")
info = await redditor.friend_info
friend_data = info.date
classmethod from_data(reddit, data)

Return an instance of Redditor, or None from data.

fullname

Return the object’s fullname.

A fullname is an object’s kind mapping like t3 followed by an underscore and the object’s base36 ID, e.g., t1_c5s96e0.

await gild(months: int = 1)

Gild the Redditor.

Parameters

months – Specifies the number of months to gild up to 36 (default: 1).

For example, to gild Redditor spez for 1 month:

redditor = await reddit.redditor("spez")
await redditor.gild(months=1)
gilded(**generator_kwargs: Union[str, int, Dict[str, str]])AsyncIterator[Any]

Return a ListingGenerator for gilded items.

Additional keyword arguments are passed in the initialization of ListingGenerator.

For example, to get gilded items in subreddit r/test:

subreddit = await reddit.subreddit("test")
async for item in subreddit.gilded():
    print(item.id)
gildings(**generator_kwargs: Union[str, int, Dict[str, str]])AsyncIterator[Any]

Return a ListingGenerator for items the user has gilded.

Raises

asyncprawcore.Forbidden if the user is not authorized to access the list.

Note

Since this function returns a ListingGenerator the exception may not occur until sometime after this function has returned.

Additional keyword arguments are passed in the initialization of ListingGenerator.

For example, to get all gilded items of the authenticated user:

current_user = await reddit.user.me()
async for item in current_user.gildings():
    print(item.id)
hidden(**generator_kwargs: Union[str, int, Dict[str, str]])AsyncIterator[Any]

Return a ListingGenerator for items the user has hidden.

Raises

asyncprawcore.Forbidden if the user is not authorized to access the list.

Note

Since this function returns a ListingGenerator the exception may not occur until sometime after this function has returned.

Additional keyword arguments are passed in the initialization of ListingGenerator.

For example, to get all hidden items of the authenticated user:

current_user = await reddit.user.me()
async for item in current_user.hidden():
    print(item.id)
hot(**generator_kwargs: Union[str, int, Dict[str, str]])AsyncIterator[Any]

Return a ListingGenerator for hot items.

Additional keyword arguments are passed in the initialization of ListingGenerator.

This method can be used like:

reddit.domain("imgur.com").hot()

multireddit = await reddit.multireddit("samuraisam", "programming")
multireddit.hot()

redditor = await reddit.redditor("spez")
redditor.hot()

redditor = await reddit.redditor("spez")
redditor.comments.hot()

redditor = await reddit.redditor("spez")
redditor.submissions.hot()

subreddit = await reddit.subreddit("all")
subreddit.hot()
await load()

Re-fetches the object.

This is used to explicitly fetch or re-fetch the object from reddit. This method can be used on any RedditBase object.

await reddit_base_object.load()
await message(subject: str, message: str, from_subreddit: Optional[Union[asyncpraw.models.Subreddit, str]] = None)

Send a message to a redditor or a subreddit’s moderators (mod mail).

Parameters
  • subject – The subject of the message.

  • message – The message content.

  • from_subreddit

    A Subreddit instance or string to send the message from. When provided, messages are sent from the subreddit rather than from the authenticated user.

    Note

    The authenticated user must be a moderator of the subreddit and have the mail moderator permission.

For example, to send a private message to u/spez, try:

redditor = await reddit.redditor("spez", lazy=True)
await redditor.message("TEST", "test message from Async PRAW")

To send a message to u/spez from the moderators of r/test try:

redditor = await reddit.redditor("spez", lazy=True)
await redditor.message("TEST", "test message from r/test", from_subreddit="test")

To send a message to the moderators of r/test, try:

subreddit = await reddit.subreddit("test")
await subreddit.message("TEST", "test PM from Async PRAW")
await moderated()List[asyncpraw.models.Subreddit]

Return a list of the redditor’s moderated subreddits.

Returns

A list of Subreddit objects. Return [] if the redditor has no moderated subreddits.

Note

The redditor’s own user profile subreddit will not be returned, but other user profile subreddits they moderate will be returned.

Usage:

redditor = await reddit.redditor("spez")
async for subreddit in redditor.moderated():
    print(subreddit.display_name)
    print(subreddit.title)
await multireddits()List[asyncpraw.models.Multireddit]

Return a list of the redditor’s public multireddits.

For example, to to get Redditor spez’s multireddits:

redditor = await reddit.redditor("spez")
multireddits = await redditor.multireddits()
new(**generator_kwargs: Union[str, int, Dict[str, str]])AsyncIterator[Any]

Return a ListingGenerator for new items.

Additional keyword arguments are passed in the initialization of ListingGenerator.

This method can be used like:

reddit.domain("imgur.com").new()

multireddit = await reddit.multireddit("samuraisam", "programming")
multireddit.new()

redditor = await reddit.redditor("spez")
redditor.new()

redditor = await reddit.redditor("spez")
redditor.comments.new()

redditor = await reddit.redditor("spez")
redditor.submissions.new()

subreddit = await reddit.subreddit("all")
subreddit.new()
classmethod parse(data: Dict[str, Any], reddit: asyncpraw.Reddit)Any

Return an instance of cls from data.

Parameters
  • data – The structured data.

  • reddit – An instance of Reddit.

saved(**generator_kwargs: Union[str, int, Dict[str, str]])AsyncIterator[Any]

Return a ListingGenerator for items the user has saved.

Raises

asyncprawcore.Forbidden if the user is not authorized to access the list.

Note

Since this function returns a ListingGenerator the exception may not occur until sometime after this function has returned.

Additional keyword arguments are passed in the initialization of ListingGenerator.

For example, to get all saved items of the authenticated user:

current_user = await reddit.user.me()
async for item in current_user.saved(limit=None):
    print(item.id)
stream()asyncpraw.models.reddit.redditor.RedditorStream

Provide an instance of RedditorStream.

Streams can be used to indefinitely retrieve new comments made by a redditor, like:

redditor = await reddit.redditor("spez")
async for comment in redditor.stream.comments():
    print(comment)

Additionally, new submissions can be retrieved via the stream. In the following example all submissions are fetched via the redditor spez:

redditor = await reddit.redditor("spez")
async for submission in redditor.stream.submissions():
    print(submission)
submissions()asyncpraw.models.listing.mixins.redditor.SubListing

Provide an instance of SubListing for submission access.

For example, to output the title’s of top 100 of all time submissions for u/spez try:

redditor = await reddit.redditor("spez")
async for submission in redditor.submissions.top("all"):
    print(submission.title)
top(time_filter: str = 'all', **generator_kwargs: Union[str, int, Dict[str, str]])AsyncIterator[Any]

Return a ListingGenerator for top submissions.

Parameters

time_filter – Can be one of: all, day, hour, month, week, year (default: all).

Raises

ValueError if time_filter is invalid.

Additional keyword arguments are passed in the initialization of ListingGenerator.

This method can be used like:

reddit.domain("imgur.com").top("week")

multireddit = await reddit.multireddit("samuraisam", "programming")
multireddit.top("day")

redditor = await reddit.redditor("spez")
redditor.top("month")

redditor = await reddit.redditor("spez")
redditor.comments.top("year")

redditor = await reddit.redditor("spez")
redditor.submissions.top("all")

subreddit = await reddit.subreddit("all")
subreddit.top("hour")
await trophies()List[asyncpraw.models.Trophy]

Return a list of the redditor’s trophies.

Returns

A list of Trophy objects. Return an empty list ([]) if the redditor has no trophies.

Raises

RedditAPIException if the redditor doesn’t exist.

Usage:

redditor = await reddit.redditor("spez")
async for trophy in redditor.trophies():
    print(trophy.name)
    print(trophy.description)
await unblock()

Unblock the Redditor.

For example, to unblock Redditor spez:

redditor = await reddit.redditor("spez")
await redditor.unblock()
await unfriend()

Unfriend the Redditor.

For example, to unfriend Redditor spez:

redditor = await reddit.redditor("spez")
await redditor.unfriend()
upvoted(**generator_kwargs: Union[str, int, Dict[str, str]])AsyncIterator[Any]

Return a ListingGenerator for items the user has upvoted.

Raises

asyncprawcore.Forbidden if the user is not authorized to access the list.

Note

Since this function returns a ListingGenerator the exception may not occur until sometime after this function has returned.

Additional keyword arguments are passed in the initialization of ListingGenerator.

For example, to get all upvoted items of the authenticated user:

current_user = await reddit.user.me()
async for item in current_user.upvoted():
    print(item.id)

Note

This list of attributes is not complete. Async PRAW dynamically provides the attributes that Reddit returns via the API. Because those attributes are subject to change on Reddit’s end, Async PRAW makes no effort to document them, other than to instruct you on how to discover what is available. See Determine Available Attributes of an Object for detailed information.