Allow sending Quick Reply Options with Direct Messages
authorHarmon <Harmon758@gmail.com>
Mon, 11 Jan 2021 14:52:24 +0000 (08:52 -0600)
committerHarmon <Harmon758@gmail.com>
Mon, 11 Jan 2021 14:52:37 +0000 (08:52 -0600)
Replace API.send_direct_message quick_reply_type parameter with quick_reply_options
Resolves #1280

tweepy/api.py

index 5a46708e15b6c8f1984c638f5874853e1f9dd467..e07f690caf013f490dc04e39c129ecab448b92eb 100644 (file)
@@ -440,7 +440,7 @@ class API:
             require_auth=True
         )
 
-    def send_direct_message(self, recipient_id, text, quick_reply_type=None,
+    def send_direct_message(self, recipient_id, text, quick_reply_options=None,
                             attachment_type=None, attachment_media_id=None):
         """ :reference: https://developer.twitter.com/en/docs/direct-messages/sending-and-receiving/api-reference/new-event
             :allowed_param: 'recipient_id', 'text', 'quick_reply_type',
@@ -455,8 +455,11 @@ class API:
             }
         }
         message_data = json_payload['event']['message_create']['message_data']
-        if quick_reply_type is not None:
-            message_data['quick_reply'] = {'type': quick_reply_type}
+        if quick_reply_options is not None:
+            message_data['quick_reply'] = {
+                'type': 'options',
+                'options': quick_reply_options
+            }
         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}