From d8b02de5e27c91b477cc699a064507201f53a139 Mon Sep 17 00:00:00 2001 From: Harmon Date: Mon, 11 Jan 2021 08:52:24 -0600 Subject: [PATCH] Allow sending Quick Reply Options with Direct Messages Replace API.send_direct_message quick_reply_type parameter with quick_reply_options Resolves #1280 --- tweepy/api.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tweepy/api.py b/tweepy/api.py index 5a46708..e07f690 100644 --- a/tweepy/api.py +++ b/tweepy/api.py @@ -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} -- 2.25.1