Skip to content

ProjectComment

Properties

id : int

The ID of the comment.

parent_id : int | None

If the comment is a reply, this is the ID of its parent comment. Otherwise, it is None.

commentee_id : int | None

If the comment is a reply, this is the user ID of the author of the parent comment. Otherwise, it is None.

content : str

The content of the comment.

reply_count : int

The number of replies the comment has. If the comment is a reply, this is simply 0.

author : str

The username of the author of the comment.

author_id : int

The user ID of the author of the comment.

created_timestamp : str

An ISO 8601 timestamp representing the date the comment was created.

Example:

import datetime

def iso_to_readable(iso):
    timezone = datetime.datetime.now(datetime.timezone.utc).astimezone().tzinfo

    date = datetime.datetime.fromisoformat(iso.replace("Z", "+00:00"))
    date.astimezone(timezone)

    return date.strftime("%Y-%m-%d %I:%M %p")

print(session.get_project(104).get_comments()[0].created_timestamp)
# 2022-08-04 10:47 AM

last_modified_timestamp : str

An ISO 8601 timestamp representing the date the comment was last modified.

Note

I have no idea what the hell this means.

visible : bool

A boolean value representing whether the comment has been deleted or not.

project : Project

The project that the comment is on, as a Project object.

Methods

delete()

Deletes the comment. You must be logged in and the owner of the project that the comment is on for this to not throw an error.

Example:

project = session.get_project(193293231031)
for comment in project.get_comments(all=True):
  if "bad" in comment.content:
    comment.delete()

report()

Reports the comment. You must be logged in for this to not throw an error.

reply(content) { #reply data-toc-label="reply"

}

Replies to the comment. You must be logged in for this to not throw an error. Returns the reply once it is posted as a ProjectComment.

PARAMETERS

  • content (str) - The content of your reply.

RETURNS - ProjectComment

Example:

comment = session.get_project(104).get_comments()[0]
comment.reply("Go away")

get_replies(all=False, limit=20, offset=0)

Gets a list of replies to the comment. Returns an array of ProjectComment objects.

PARAMETERS

  • all (Optional[bool]) - Whether to retrieve every single reply or just limit replies.
  • limit (Optional[int]) - How many replies to retrieve if all is False.
  • offset (Optional[int]) - The offset of the replies from the newest ones - i.e. an offset of 20 would give you the next 20 replies after the first 20.

RETURNS - list[ProjectComment]