Remove API._send_direct_message
authorHarmon <Harmon758@gmail.com>
Sun, 10 Jan 2021 02:10:55 +0000 (20:10 -0600)
committerHarmon <Harmon758@gmail.com>
Sun, 10 Jan 2021 02:10:55 +0000 (20:10 -0600)
tweepy/api.py

index 6d61da4d78e78806a33085a7413cd2218906fa68..9421f92b154038980bb17796c25364a1e4930d5e 100644 (file)
@@ -445,9 +445,9 @@ class API:
 
     def send_direct_message(self, recipient_id, text, quick_reply_type=None,
                             attachment_type=None, attachment_media_id=None):
-        """
-        Send a direct message to the specified user from the authenticating
-        user
+        """ :reference: https://developer.twitter.com/en/docs/direct-messages/sending-and-receiving/api-reference/new-event
+            :allowed_param: 'recipient_id', 'text', 'quick_reply_type',
+                            'attachment_type', attachment_media_id'
         """
         json_payload = {
             'event': {'type': 'message_create',
@@ -463,21 +463,13 @@ class API:
         if attachment_type is not None and attachment_media_id is not None:
             message_data['attachment'] = {'type': attachment_type}
             message_data['attachment']['media'] = {'id': attachment_media_id}
-        return self._send_direct_message(json_payload=json_payload)
-
-    @property
-    def _send_direct_message(self):
-        """ :reference: https://developer.twitter.com/en/docs/direct-messages/sending-and-receiving/api-reference/new-event
-            :allowed_param: 'recipient_id', 'text', 'quick_reply_type',
-                            'attachment_type', attachment_media_id'
-        """
         return bind_api(
             api=self,
             path='/direct_messages/events/new.json',
             method='POST',
             payload_type='direct_message',
             require_auth=True
-        )
+        )(json_payload=json_payload)
 
     @property
     def destroy_direct_message(self):