Skip to content

Commit

Permalink
Sort praw.models.reddit.modmail.ModmailConversation.reply arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
LilSpazJoekp committed Jan 8, 2022
1 parent dd839a1 commit 8f187b8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
13 changes: 8 additions & 5 deletions praw/models/reddit/modmail.py
Expand Up @@ -2,7 +2,7 @@
from typing import TYPE_CHECKING, Any, Dict, List, Optional

from ...const import API_PATH
from ...util import snake_case_keys
from ...util import _deprecate_args, snake_case_keys
from .base import RedditBase

if TYPE_CHECKING: # pragma: no cover
Expand Down Expand Up @@ -224,12 +224,15 @@ def read(
data = {"conversationIds": self._build_conversation_list(other_conversations)}
self._reddit.post(API_PATH["modmail_read"], data=data)

def reply(self, body: str, author_hidden: bool = False, internal: bool = False):
@_deprecate_args("body", "author_hidden", "internal")
def reply(
self, *, author_hidden: bool = False, body: str, internal: bool = False
) -> "ModmailMessage":
"""Reply to the conversation.
:param body: The Markdown formatted content for a message.
:param author_hidden: When ``True``, author is hidden from non-moderators
(default: ``False``).
:param body: The Markdown formatted content for a message.
:param internal: When ``True``, message is a private moderator note, hidden from
non-moderators (default: ``False``).
Expand All @@ -240,13 +243,13 @@ def reply(self, body: str, author_hidden: bool = False, internal: bool = False):
.. code-block:: python
conversation = reddit.subreddit("test").modmail("2gmz")
conversation.reply("Message body", author_hidden=True)
conversation.reply(body="Message body", author_hidden=True)
To create a private moderator note on the conversation:
.. code-block:: python
conversation.reply("Message body", internal=True)
conversation.reply(body="Message body", internal=True)
"""
data = {
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/models/reddit/test_modmail.py
Expand Up @@ -77,7 +77,7 @@ def test_reply(self):
self.reddit.read_only = False
conversation = self.reddit.subreddit("all").modmail("ik72")
with self.use_cassette():
reply = conversation.reply("A message")
reply = conversation.reply(body="A message")
assert isinstance(reply, ModmailMessage)

@mock.patch("time.sleep", return_value=None)
Expand Down

0 comments on commit 8f187b8

Please sign in to comment.