InboxableMixin

class asyncpraw.models.reddit.mixins.InboxableMixin

Interface for RedditBase subclasses that originate from the inbox.

__init__()
await block()

Block the user who sent the item.

Note

This method pertains only to objects which were retrieved via the inbox.

Example usage:

comment = await reddit.comment("dkk4qjd")
await comment.block()

# or, identically:
comment = await reddit.comment("dkk4qjd")
await comment.author.block()
await collapse()

Mark the item as collapsed.

Note

This method pertains only to objects which were retrieved via the inbox.

Example usage:

inbox = reddit.inbox()

# select first inbox item and collapse it
async for message in inbox:
    await message.collapse()
    break

See also

uncollapse()

await mark_read()

Mark a single inbox item as read.

Note

This method pertains only to objects which were retrieved via the inbox.

Example usage:

inbox = reddit.inbox.unread()

async for message in inbox:
    # process unread messages
    ...

See also

mark_unread()

To mark the whole inbox as read with a single network request, use Inbox.mark_all_read()

await mark_unread()

Mark the item as unread.

Note

This method pertains only to objects which were retrieved via the inbox.

Example usage:

inbox = reddit.inbox(limit=10)

async for message in inbox:
    # process messages
    ...

See also

mark_read()

await unblock_subreddit()

Unblock a subreddit.

Note

This method pertains only to objects which were retrieved via the inbox.

For example, to unblock all blocked subreddits that you can find by going through your inbox:

from asyncpraw.models import SubredditMessage

subs = set()
async for item in reddit.inbox.messages(limit=None):
    if isinstance(item, SubredditMessage):
        if (
            item.subject == "[message from blocked subreddit]"
            and str(item.subreddit) not in subs
        ):
            item.unblock_subreddit()
            subs.add(str(item.subreddit))
await uncollapse()

Mark the item as uncollapsed.

Note

This method pertains only to objects which were retrieved via the inbox.

Example usage:

inbox = reddit.inbox()

# select first inbox item and uncollapse it
async for message in inbox:
    await message.uncollapse()
    break

See also

collapse()