Class LockableAbstract

The base for all content that can be locked.

Hierarchy (view full)

Implements

Properties

approved?: boolean

Whether or not this item was approved.

approvedAtUtc: Maybe<number>

The unix timestamp of when this was approved.

This can be undefined if the item either hasn't been approved or you don't have permission to know (i.e. you're not a mod on that subreddit).

approvedBy: Maybe<string>

The username of the mod who approved this post.

This can be undefined if the item either hasn't been approved or you don't have permission to know (i.e. you're not a mod on that subreddit).

archived: boolean

Whether or not this post is archived.

author: string

The username of the user who created this item.

authorPatreonFlair: boolean

Whether or not the author has a Patreon flair.

authorPremium: boolean

Whether or not the author has Reddit Premium.

banNote?: string

The note of why this item was banned (removed).

bannedAtUtc: Maybe<number>

The unix timestamp of when this item was banned (removed).

This can be undefined if the item either hasn't been banned or you don't have permission to know (i.e. you're not a mod on that subreddit).

bannedBy: Maybe<string>

The username of the mod who banned (removed) this item.

This can be undefined if the item either hasn't been banned or you don't have permission to know (i.e. you're not a mod on that subreddit).

canGild: boolean

Whether or not this you can guild this item.

canModPost: boolean

Whether or not you can moderate this item.

createdUtc: number

The unix timestamp when this object was created.

dismissedUserReports?: string[]

The old reports on this item.

distinguished: Maybe<"admin" | "moderator">

Whether or not this item was distinguished, and by whom.

edited: number | false

The unix timestamp when this item was edited, or false if it wasn't.

gilded: number

How many times this item has been gilded.

gildings: Gildings

The gildings that this item has received.

id: string

The ID of this object.

ignoreReports: boolean

Whether or not future reports of this item will be ignored.

likes: Maybe<boolean>

Whether and how you voted on this item.

Value Meaning
true You upvoted this item.
false You downvoted this item.
undefined You have not voted on this item.
locked: boolean

Whether or not this item is locked.

modNote: Maybe<string>

A note about why this item was removed that only the moderators can see, or undefined if no note was added or this item hasn't been removed.

modReasonBy: Maybe<string>

The username of the mod who added a removal reason to this item, or undefined if no reason was given or this item hasn't been removed.

modReasonTitle: Maybe<string>

The reason this item was removed, or undefined if no reason was given or this item hasn't been removed.

modReports: [string, string][]

The current reports on this item that were made by mods.

Each entry is of the form [report, username].

modReportsDismissed?: [string, string][]

The old reports on this item that were made by mods.

Each entry is of the form [report, username].

numReports: number

The number of reports this item has.

This seems to be calculated as follows:

max(
modReports.length - modReportsDismissed.length,
userReports.length - userReportsDismissed.length
)

This means that it will be negative if there were reports that have been dismissed.

permalink: string

The permalink to this item, relative to reddit.com.

removed: boolean

Whether or not this item has been removed.

saved: boolean

Whether or not you have saved this item.

score: number

The score that this item has received.

sendReplies: boolean

Whether or not replies to this item will notify the author.

spam?: boolean

Whether or not this item has been marked as spam.

stickied: boolean

Whether or not this item has been sticked.

subreddit: string

The name of the subreddit this item was posted in.

subredditType: SubredditType

The type of the subreddit this item was posted in.

userReports: [string, number][]

The current reports on this item that were made by users.

Each entry is of the form [report, count].

userReportsDismissed?: [string, number][]

The old reports on this item that were made by users.

Each entry is of the form [report, count].

Methods

  • Approve this item.

    Returns Promise<void>

    A promise that resolves when the item has been approved.

    Note

    This requires the authenticated user to be a moderator of the subreddit with the posts permission.

  • Block the author of this item.

    Returns Promise<void>

    A promise that resolves when the request is complete.

    Note

    Apparently this only works if this item is in modmail or the user's inbox, and if it's not the request silently succeeds anyway.

  • Edit this item.

    Parameters

    • newText: string

      The new text to use.

    Returns Promise<void>

    A promise that resolves when the edit is complete.

  • Give Reddit gold to the author of this item.

    Returns Promise<void>

    A promise that resolves when this item has been gilded.

  • Ignore any future reports on this item.

    Returns Promise<void>

    A promise that resolves when the setting has been changed.

    Note

    This requires the authenticated user to be a moderator of the subreddit with the posts permission.

  • Lock this item, preventing non-moderators from being able to post replies.

    Returns Promise<void>

    A promise that resolves when this item has been locked.

  • Remove this item, optionally marking it as spam.

    Parameters

    • spam: boolean = false

      Whether or not to mark this item as spam. Defaults to false.

    Returns Promise<void>

    A promise that resolves when this item has been removed.

    Note

    This requires the authenticated user to be a moderator of the subreddit with the posts permission.

  • Report this item to the mods.

    The report will be anonymous if you are not a mod of the subreddit. If you are a mod the report will be tied to your username.

    Parameters

    • Optional reason: string

      The reason you are reporting this item.

    Returns Promise<void>

    A promise that resolves when this item has been reported.

  • Save this item.

    This will make this item show up at reddit.com/saved.

    Returns Promise<void>

    A promise that resolves when this item has been saved.

  • Unignore any future reports on this item.

    Returns Promise<void>

    A promise that resolves when the setting has been changed.

    Note

    This requires the authenticated user to be a moderator of the subreddit with the posts permission.

  • Unlock this item, allowing non-moderators to post replies.

    Returns Promise<void>

    A promise that resolves when this item has been unlocked.

  • Unsave this item.

    This will make this item no longer show up at reddit.com/saved.

    Returns Promise<void>

    A promise that resolves when this item has been unsaved.