Repository: praw-dev/praw

Issue:
PRAW raises prawcore.exceptions.BadRequest when attempting to call send_removal_message()
## Issue Description

Any time I try to use `send_removal_message()`, PRAW gives me a 400 error. Looking at the official Reddit API, it appears the endpoints for that function have been removed.

**Attempt:**
```python
PS C:\Users\Michael\nobackup\Code\Projects\myproject> py
Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:06:47) [MSC v.1914 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import praw
>>> reddit = praw.Reddit(user_agent='[my user agent]')
>>> sub = reddit.comment('[a comment I have the ability to moderate]')
>>> sub
Comment(id='[same as before]')
>>> sub.body
'Test comment'
>>> sub.mod
<praw.models.reddit.comment.CommentModeration object at 0x00F20EF0>
>>> sub.mod.send_removal_message
<bound method ThingModerationMixin.send_removal_message of <praw.models.reddit.comment.CommentModeration object at 0x00F20EF0>>
>>> sub.mod.send_removal_message('hi')
{"item_id": ["t1_ew39cg7"], "message": "hi", "title": "ignored", "type": "public"}  # I added this for debugging
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\Michael\AppData\Local\Programs\Python\Python37-32\lib\site-packages\praw\models\reddit\mixins\__init__.py", line 174, in send_removal_message
    return self.thing._reddit.post(url, data={"json": dumps(data)}) or None
  File "C:\Users\Michael\AppData\Local\Programs\Python\Python37-32\lib\site-packages\praw\reddit.py", line 523, in post
    "POST", path, data=data or {}, files=files, params=params
  File "C:\Users\Michael\AppData\Local\Programs\Python\Python37-32\lib\site-packages\praw\reddit.py", line 577, in request
    method, path, data=data, files=files, params=params
  File "C:\Users\Michael\AppData\Local\Programs\Python\Python37-32\lib\site-packages\prawcore\sessions.py", line 185, in request
    params=params, url=url)
  File "C:\Users\Michael\AppData\Local\Programs\Python\Python37-32\lib\site-packages\prawcore\sessions.py", line 130, in _request_with_retries
    raise self.STATUS_EXCEPTIONS[response.status_code](response)
prawcore.exceptions.BadRequest: received 400 HTTP response
>>>
```

## System Information

- PRAW Version: 6.3.1
- Python Version: 3.7.0
- Operating System: Windows 10 x64



Discussion:
Thanks for the clear example of your attempt!

I played around with your code, which reproduced the same results. Then I looked at the test for the method:

https://github.com/praw-dev/praw/blob/8674ed520652746e1495cfbeb37125761f500b20/tests/integration/models/reddit/test_comment.py#L300-L307

Based on this code, it looks like you cannot send a removal message for a comment that isn't removed. Therefore, you must call `sub.mod.remove()` before calling `sub.mod.send_removal_message('hi')`. Making this change allowed my code to run without error.

---

I consider the fact that both you and I spent a significant amount of time trying to figure this out a failure in our documentation. At the very least, we need to have a prominent note next to [the method](https://praw.readthedocs.io/en/latest/code_overview/other/commentmoderation.html#praw.models.reddit.comment.CommentModeration.send_removal_message) in our documentation. An example would be nice as well.

In addition, there may be a better way to handle the exception that is thrown in this case to make it more informative of exactly what went wrong.

@michaelkolber, would you like to make a PR to fix the documentation? Totally fine if you don't want to (I'm happy to do it myself), but you should if you'd like to.
Sure, I'd be happy to.
I'll update the documentation as it clearly has been forgotten.

Resolving patch:
diff --git a/praw/models/reddit/mixins/__init__.py b/praw/models/reddit/mixins/__init__.py
--- a/praw/models/reddit/mixins/__init__.py
+++ b/praw/models/reddit/mixins/__init__.py
@@ -184,6 +184,11 @@ def send_removal_message(
     ):
         """Send a removal message for a :class:`~.Comment` or :class:`~.Submission`.
 
+        .. warning:: The object has to be removed before giving it a removal
+            reason. Remove the object with :meth:`.remove`. Trying to add a
+            removal reason without removing the object will result in
+            ``prawcore.exceptions.BadRequest`` being thrown.
+
         Reddit adds human-readable information about the object to the message.
 
         :param type: One of 'public', 'private', 'private_exposed'.


Test patch: