How to do nested replies to comments? #1598
Unanswered
Basti117607
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello everyone,
I am working on a project where I need to automatically reply to certain comments on my Instagram posts. However, I am encountering an issue where, when I use the media_comment method, it posts a new comment instead of replying to the existing comment.
Here's a snippet of my code:
for media in user_medias:
comments = cl.media_comments(media.pk)
for i, comment in enumerate(comments, 1):
# ... (code for generating a response)
if response:
try:
# Post the generated response as a new comment on the media
cl.media_comment(media.pk, response)
print(f"Successfully responded to comment ID {comment_id}.")
except Exception as e:
print(f"Could not respond to comment ID {comment_id}: {e}")
In this code, cl is an instance of Client, user_medias is a list of media objects, and response is the text I want to post in reply to each comment.
I want the response to appear as a reply to the original comment, rather than a new comment on the post. Is there a way to achieve this? If not, are there any workarounds or other libraries/methods that might help me accomplish this?
So what am I missing, is there another possibility in the library that I didn't see?
Thank you in advance.
Beta Was this translation helpful? Give feedback.
All reactions