redditwarp.siteprocs.message.ASYNC#
- class redditwarp.siteprocs.message.ASYNC.MessageProcedures(client: Client)[source]#
Bases:
object- pulls: Pulls#
Pull messages.
- async 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.
- async 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
towas empty.
NO_SUBJECT:The subject specified by
subjectwas empty.
NO_TEXT:The body text specified by
bodywas empty.
USER_DOESNT_EXIST:The user specified by
todoes 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”.
- async 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
towas empty.
NO_SUBJECT:The subject specified by
subjectwas empty.
NO_TEXT:The body text specified by
bodywas empty.
SUBREDDIT_NOEXIST:The subreddit specified by
srdoes not exist.
NO_SR_TO_SR_MESSAGE:Both
srandtorefer 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.
- async 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:
- Raises:
redditwarp.exceptions.RedditError –
USER_REQUIRED:There is no user context.
NO_TEXT:The body text specified by
bodywas empty.
redditwarp.http.exceptions.StatusCodeException –
403:The specified message ID does not exist.
- async 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.
- async 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:
redditwarp.exceptions.RedditError –
USER_REQUIRED:There is no user context.
redditwarp.http.exceptions.StatusCodeException –
400:The message specified by the ID doesn’t exist or is invalid.
- async mark_unread(idy: int | str) None[source]#
Mark a message as unread.
Behaves similarly to
mark_read().
- async mark_all_read() None[source]#
Mark all messages as read.
- Return type:
None
- Raises:
redditwarp.exceptions.RedditError –
USER_REQUIRED:There is no user context.
- async mark_comment_read(idy: int | str) None[source]#
Mark a comment message as read.
Behaves similarly to
mark_read().
- async mark_comment_unread(idy: int | str) None[source]#
Mark a comment message as unread.
Behaves similarly to
mark_read().
- async 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.
- async uncollapse(idy: int | str) None[source]#
Uncollapse a message.
Behaves similarly to
mark_read().
- class BlockAuthor(outer: MessageProcedures)[source]#
Bases:
object
- 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()andblock_user_by_name()instead.- Parameters:
idn (Union[int, str]) –
- Return type:
None
- Raises:
redditwarp.exceptions.RedditError –
USER_REQUIRED:There is no user context.