diff --git a/praw/models/reddit/modmail.py b/praw/models/reddit/modmail.py index 3d104cd9a..2325e426e 100644 --- a/praw/models/reddit/modmail.py +++ b/praw/models/reddit/modmail.py @@ -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 @@ -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``). @@ -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 = { diff --git a/tests/integration/models/reddit/test_modmail.py b/tests/integration/models/reddit/test_modmail.py index 87c56d28b..f9783f38e 100644 --- a/tests/integration/models/reddit/test_modmail.py +++ b/tests/integration/models/reddit/test_modmail.py @@ -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)