From: Harmon Date: Mon, 11 Jan 2021 16:40:01 +0000 (-0600) Subject: Improve clarity of and optimize API.send_direct_message X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=83e406ae029dab5c74b9e39ce757a3fade08c538;p=tweepy.git Improve clarity of and optimize API.send_direct_message --- diff --git a/tweepy/api.py b/tweepy/api.py index e07f690..1f5984b 100644 --- a/tweepy/api.py +++ b/tweepy/api.py @@ -461,8 +461,10 @@ class API: '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} + message_data['attachment'] = { + 'type': attachment_type, + 'media': {'id': attachment_media_id} + } return bind_api( api=self, path='/direct_messages/events/new.json',