From: Harmon Date: Mon, 11 Jan 2021 14:52:24 +0000 (-0600) Subject: Allow sending Quick Reply Options with Direct Messages X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=d8b02de5e27c91b477cc699a064507201f53a139;p=tweepy.git Allow sending Quick Reply Options with Direct Messages Replace API.send_direct_message quick_reply_type parameter with quick_reply_options Resolves #1280 --- 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}