Comment
Class: Comment
Accessors
approved
Get Signature
get approved():
boolean
Whether the comment has been approved by a moderator.
Returns
boolean
approvedAtUtc
Get Signature
get approvedAtUtc():
number
The moderation approval time as Unix seconds, or 0 when unavailable.
Use approved to check the current approval state. Convert a
nonzero value to a Date with new Date(comment.approvedAtUtc * 1000).
Returns
number
authorFlair
Get Signature
get authorFlair():
CommonFlair|undefined
The author's subreddit flair, or undefined when unavailable.
Returns
CommonFlair | undefined
authorId
Get Signature
get authorId():
`t2_${string}`|undefined
The creator's account identifier or undefined when unavailable.
Returns
`t2_${string}` | undefined
authorName
Get Signature
get authorName():
string
The creator's username without the leading u/. May be "[deleted]" when
the author is unavailable.
Example
"Example_User"
Returns
string
bannedAtUtc
Get Signature
get bannedAtUtc():
number
The ban time as Unix seconds, or 0 when unavailable.
Convert a nonzero value to a Date with
new Date(comment.bannedAtUtc * 1000).
Returns
number
body
Get Signature
get body():
string
The comment body in Markdown.
Returns
string
collapsedBecauseCrowdControl
Get Signature
get collapsedBecauseCrowdControl():
boolean
Whether Crowd Control caused the comment to be collapsed.
Returns
boolean
createdAt
Get Signature
get createdAt():
Date
The date when the comment was created.
Returns
Date
distinguishedBy
Get Signature
get distinguishedBy():
string|undefined
The comment's distinction category.
For example, a comment distinguished by a moderator or administrator
returns "moderator" or "admin". undefined means no distinction is
available.
Returns
string | undefined
edited
Get Signature
get edited():
boolean
Whether the comment body has been edited since it was created.
Returns
boolean
id
Get Signature
get id():
`t1_${string}`
Returns
`t1_${string}`
ignoringReports
Get Signature
get ignoringReports():
boolean
Whether reports on the comment are being ignored.
Returns
boolean
locked
Get Signature
get locked():
boolean
Whether the comment is locked and new replies are disabled.
Returns
boolean
modReportReasons
Get Signature
get modReportReasons():
string[]
Deprecated
Use modReports to retain each report's author.
Returns
string[]
modReports
Get Signature
get modReports():
ModeratorReport[]
Moderator reports and authors, or an empty array when unavailable.
Returns
numReports
Get Signature
get numReports():
number
The number of reports, or 0 when none are available.
Returns
number
parentId
Get Signature
get parentId():
`t1_${string}`|`t3_${string}`
The identifier of the comment's parent.
A top-level comment returns the containing post's T3. A reply returns its
parent comment's T1.
Returns
`t1_${string}` | `t3_${string}`
permalink
Get Signature
get permalink():
string
The comment's path relative to https://www.reddit.com.
Example
"/r/wallstreetbets/comments/abc123/example_post/def456/"
Returns
string
postId
Get Signature
get postId():
`t3_${string}`
The identifier of the post containing the comment.
Returns
`t3_${string}`
removed
Get Signature
get removed():
boolean
Whether the comment has been removed by a moderator.
Returns
boolean
replies
Get Signature
get replies():
Listing<Comment>
The comment's direct replies.
Returns
Listing<Comment>
score
Get Signature
get score():
number
The comment's upvotes minus downvotes, or 0 when unavailable.
Returns
number
spam
Get Signature
get spam():
boolean
Whether the comment has been marked as spam by a moderator.
Returns
boolean
stickied
Get Signature
get stickied():
boolean
Whether the comment is pinned to the top of its comment thread.
Returns
boolean
subredditId
Get Signature
get subredditId():
`t5_${string}`
The subreddit identifier where the comment was created.
Returns
`t5_${string}`
subredditName
Get Signature
get subredditName():
string
The name of the subreddit that contains the comment, without the leading
r/.
Example
"AskReddit"
Returns
string
url
Get Signature
get url():
string
The absolute https://www.reddit.com URL for the comment.
Example
"https://www.reddit.com/r/wallstreetbets/comments/abc123/post/def456/"
Returns
string
userReportReasons
Get Signature
get userReportReasons():
string[]
User report reasons, or an empty array when none are available.
Returns
string[]
Methods
addRemovalNote()
addRemovalNote(
opts):Promise<void>
Adds a moderator note explaining why the comment was removed.
Parameters
opts
Readonly<Omit<AddRemovalNoteOptions, "itemIds">>
Returns
Promise<void>
approve()
approve():
Promise<void>
Approves the comment and updates this instance's moderation state.
Returns
Promise<void>
delete()
delete():
Promise<void>
Deletes the comment as the app account.
The runAs option is ignored when editing a comment.
Returns
Promise<void>
distinguish()
distinguish(
makeSticky?):Promise<void>
Distinguishes the comment as a moderator and updates this instance.
Parameters
makeSticky?
boolean = false
Whether to pin the comment to the top of its thread.
Returns
Promise<void>
distinguishAsAdmin()
distinguishAsAdmin(
makeSticky?):Promise<void>
Distinguishes the comment as an employee and updates this instance.
Parameters
makeSticky?
boolean = false
Whether to pin the comment to the top of its thread.
Returns
Promise<void>
edit()
edit(
opts):Promise<Comment>
Replaces the comment body as the app account, then updates the cached body and edited state from the response.
The runAs option is ignored when editing a comment.
Parameters
opts
Readonly<CommentSubmissionOptions>
Returns
Promise<Comment>
filter()
filter(
options?):Promise<void>
Experimental
Filters the comment. When a comment is filtered, it is added to the ModQueue for review. By
default, filtered comments are hidden while in the queue. Set keep to true to keep the
comment visible. Set reason to show moderators a reason; when keep is true, the reason
is also shown on the comment.
Parameters
options?
FilterOptions
Returns
Promise<void>
getAuthor()
getAuthor():
Promise<User|undefined>
Fetches the author's account, or undefined if it is unavailable.
Returns
Promise<User | undefined>
ignoreReports()
ignoreReports():
Promise<void>
Ignores reports and updates this instance's report-ignore state.
Returns
Promise<void>
isApproved()
isApproved():
boolean
The comment's approval state.
Returns
boolean
isDistinguished()
isDistinguished():
boolean
The comment's distinguished category state.
Returns
boolean
isEdited()
isEdited():
boolean
The comment's edited state.
Returns
boolean
isIgnoringReports()
isIgnoringReports():
boolean
The comment's report-ignore state.
Returns
boolean
isLocked()
isLocked():
boolean
The comment's locked state.
Returns
boolean
isRemoved()
isRemoved():
boolean
The comment's removal state.
Returns
boolean
isSpam()
isSpam():
boolean
The comment's spam state.
Returns
boolean
isStickied()
isStickied():
boolean
The comment's stickied state.
Returns
boolean
lock()
lock():
Promise<void>
Disables new replies and updates this instance's locked state.
Returns
Promise<void>
remove()
remove(
isSpam?):Promise<void>
Removes the comment and updates this instance's moderation state.
Parameters
isSpam?
boolean = false
Whether to classify the removed comment as spam.
Returns
Promise<void>
reply()
reply(
opts):Promise<Comment>
Creates a direct reply to the comment.
Parameters
opts
Readonly<CommentSubmissionOptions>
Returns
Promise<Comment>
showComment()
showComment():
Promise<void>
Prevents Crowd Control from collapsing the comment. Other rules can still collapse it.
Returns
Promise<void>
snoozeReports()
snoozeReports(
reason):Promise<void>
Snoozes subsequent reports with the same reason from the same users for seven days. This only works for free-form reports.
Parameters
reason
string
The report reason to snooze.
Returns
Promise<void>
toJSON()
toJSON():
Pick<Comment,"id"|"authorName"|"subredditId"|"subredditName"|"body"|"createdAt"|"parentId"|"postId"|"replies"|"approved"|"locked"|"removed"|"stickied"|"spam"|"edited"|"distinguishedBy"|"numReports"|"collapsedBecauseCrowdControl"|"score"|"permalink"|"userReportReasons"|"modReports"|"modReportReasons"|"url"|"ignoringReports"|"authorFlair">
Returns the public fields included when the comment is serialized.
Returns
Pick<Comment, "id" | "authorName" | "subredditId" | "subredditName" | "body" | "createdAt" | "parentId" | "postId" | "replies" | "approved" | "locked" | "removed" | "stickied" | "spam" | "edited" | "distinguishedBy" | "numReports" | "collapsedBecauseCrowdControl" | "score" | "permalink" | "userReportReasons" | "modReports" | "modReportReasons" | "url" | "ignoringReports" | "authorFlair">
undistinguish()
undistinguish():
Promise<void>
Removes the distinction category and sticky status and updates this instance.
Returns
Promise<void>
unignoreReports()
unignoreReports():
Promise<void>
Stops ignoring reports and updates this instance's cached state.
Returns
Promise<void>
unlock()
unlock():
Promise<void>
Enables new replies and updates this instance's locked state.
Returns
Promise<void>
unsnoozeReports()
unsnoozeReports(
reason):Promise<void>
Unsnoozes reports with the given reason. This only works for free-form reports.
Parameters
reason
string
The report reason to unsnooze.
Returns
Promise<void>
