redditwarp.siteprocs.message.SYNC#

class redditwarp.siteprocs.message.SYNC.MessageProcedures(client: Client)[source]#

Bases: object

pulls: Pulls#

Pull messages.

get_thread(idy: int | str) Sequence[ComposedMessage][source]#

Get a message thread.

Specifying the ID of any message in the same thread gives you the same list.

Parameters:

idn (Union[int, str]) – Message ID.

Return type:

Sequence[ComposedMessage]

Raises:

redditwarp.http.exceptions.StatusCodeException

  • 403:

    The target message specified does not exist or you do not have permission to access it.

send(to: str, subject: str, body: str) None[source]#

Send a direct message to a user.

Parameters:
  • to (str) – Name of user in which to send the message to.

  • subject (str) – The subject of the message.

  • body (str) – The body text of the message.

Return type:

None

Raises:

redditwarp.exceptions.RedditError

  • USER_REQUIRED:

    There is no user context.

  • NO_USER:

    The user specified by to was empty.

  • NO_SUBJECT:

    The subject specified by subject was empty.

  • NO_TEXT:

    The body text specified by body was empty.

  • USER_DOESNT_EXIST:

    The user specified by to does not exist.

  • NOT_WHITELISTED_BY_USER_MESSAGE:

    The target user has direct messages from strangers disabled.

    On old Reddit, this setting can be configured at https://old.reddit.com/prefs/blocked by setting “Show private messages from” to “Only trusted users”.

send_from_sr(sr: str, to: str, subject: str, body: str) None[source]#

Send a direct message to a user on behalf of a subreddit.

Parameters:
  • sr (str) – The name of a subreddit you moderate.

  • to (str) – Name of user in which to send the message to.

  • subject (str) – The subject of the message.

  • body (str) – The body text of the message.

Return type:

None

Raises:
  • redditwarp.exceptions.RedditError

    • USER_REQUIRED:

      There is no user context.

    • NO_USER:

      The user specified by to was empty.

    • NO_SUBJECT:

      The subject specified by subject was empty.

    • NO_TEXT:

      The body text specified by body was empty.

    • SUBREDDIT_NOEXIST:

      The subreddit specified by sr does not exist.

    • NO_SR_TO_SR_MESSAGE:

      Both sr and to refer to subreddits. Subreddit to subreddit messages is not allowed.

  • redditwarp.http.exceptions.StatusCodeException

    • 403:

      The current user is not a moderator of the specified subreddit.

reply(idy: int | str, body: str) ComposedMessage[source]#

Reply to a message

Parameters:
  • idn (Union[int, str]) –

  • body (str) –

Returns:

The newly created message.

Return type:

ComposedMessage

Raises:
delete(idy: int | str) None[source]#

Delete a message.

If the message specified by the ID doesn’t exist, or is invalid, the action is treated as a success.

Parameters:

idn (Union[int, str]) –

Return type:

None

Raises:

redditwarp.exceptions.RedditError

  • USER_REQUIRED:

    There is no user context.

mark_read(idy: int | str) None[source]#

Mark a message as read.

Marking an already marked as read item is treated as a success.

Parameters:

idn (Union[int, str]) –

Return type:

None

Raises:
mark_unread(idy: int | str) None[source]#

Mark a message as unread.

Behaves similarly to mark_read().

mark_all_read() None[source]#

Mark all messages as read.

Return type:

None

Raises:

redditwarp.exceptions.RedditError

  • USER_REQUIRED:

    There is no user context.

mark_comment_read(idy: int | str) None[source]#

Mark a comment message as read.

Behaves similarly to mark_read().

mark_comment_unread(idy: int | str) None[source]#

Mark a comment message as unread.

Behaves similarly to mark_read().

collapse(idy: int | str) None[source]#

Collapse a message.

If the specified message does not exist or is valid, the action is treated as a success.

Parameters:

idn (Union[int, str]) –

Return type:

None

Raises:

redditwarp.exceptions.RedditError

  • USER_REQUIRED:

    There is no user context.

uncollapse(idy: int | str) None[source]#

Uncollapse a message.

Behaves similarly to mark_read().

class BlockAuthor(outer: MessageProcedures)[source]#

Bases: object

of_message(idy: int | str) None[source]#
of_comment(idy: int | str) None[source]#
of_submission(idy: int | str) None[source]#
property block_author: None#

Block the author of a message, comment, or submission.

  • Use __call__() to block the author of a message.

  • Use of_comment() to block the author of a comment.

  • Use of_submission() to block the author of a submission.

To block a user directly by ID or name, see block_user_by_id() and block_user_by_name() instead.

Parameters:

idn (Union[int, str]) –

Return type:

None

Raises:

redditwarp.exceptions.RedditError

  • USER_REQUIRED:

    There is no user context.