Skip to content

Commit

Permalink
feat: Add reply_to_message functionality in direct send
Browse files Browse the repository at this point in the history
  • Loading branch information
Revisto committed Jun 13, 2024
1 parent 6510679 commit 19d429e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions instagrapi/mixins/direct.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,7 @@ def direct_send(
user_ids: List[int] = [],
thread_ids: List[int] = [],
send_attribute: SEND_ATTRIBUTE = "message_button",
reply_to_message: Optional[DirectMessage] = None,
) -> DirectMessage:
"""
Send a direct message to list of users or threads
Expand Down Expand Up @@ -450,6 +451,10 @@ def direct_send(
kwargs["thread_ids"] = dumps([int(tid) for tid in thread_ids])
if user_ids:
kwargs["recipient_users"] = dumps([[int(uid) for uid in user_ids]])
if reply_to_message:
kwargs["replied_to_action_source"] = "swipe"
kwargs["replied_to_item_id"] = reply_to_message.id
kwargs["replied_to_client_context"] = reply_to_message.client_context
result = self.private_request(
f"direct_v2/threads/broadcast/{method}/",
data=self.with_default_data(kwargs),
Expand Down

0 comments on commit 19d429e

Please sign in to comment.