.. method:: API.destroy_direct_message(id)
- Destroy a direct message. Authenticating user must be the recipient of
- the direct message.
+ Deletes the direct message specified in the required ID parameter.
+ The authenticating user must be the recipient of the specified direct message.
+ Direct Messages are only removed from the interface of the user context provided.
+ Other members of the conversation can still access the Direct Messages.
- :param id: The ID of the direct message to destroy.
- :rtype: :class:`DirectMessage` object
+ :param id: The id of the Direct Message that should be deleted.
+ :rtype: None
Friendship Methods
@property
def destroy_direct_message(self):
- """ :reference: https://developer.twitter.com/en/docs/direct-messages/sending-and-receiving/api-reference/delete-message
+ """ :reference: https://developer.twitter.com/en/docs/direct-messages/sending-and-receiving/api-reference/delete-message-event
:allowed_param:'id'
"""
return bind_api(
api=self,
- path='/direct_messages/destroy.json',
- method='POST',
- payload_type='direct_message',
+ path='/direct_messages/events/destroy.json',
+ method='DELETE',
allowed_param=['id'],
require_auth=True
)
continue
retry_delay = self.retry_delay
# Exit request loop if non-retry error code
- if resp.status_code == 200:
+ if resp.status_code in (200, 204):
break
elif (resp.status_code == 429 or resp.status_code == 420) and self.wait_on_rate_limit:
if 'retry-after' in resp.headers: