new ModmailConversation()
Example
// Get a Modmail Conversation with a given ID r.getNewModmailConversation('75hxt')
Extends
Methods
-
reply(body, isAuthorHidden, isInternal)
Reply to current ModmailConversation
-
Parameters:
Name Type Description body
string Markdown text
isAuthorHidden
boolean Subreddit-name reply if true, user's name if false
isInternal
boolean If reply should be to internal moderators only
Returns:
- Type
- Promise
-
archive()
Archives the ModmailConversation
-
Returns:
- Type
- Promise
Example
r.getNewModmailConversation('75hxt').archive()
-
unarchive()
Unarchives the ModmailConversation
-
Returns:
- Type
- Promise
Example
r.getNewModmailConversation('75hxt').unarchive()
-
highlight()
Marks a ModmailConversation as highlighted
-
Returns:
- Type
- Promise
Example
r.getNewModmailConversation('75hxt').highlight()
-
unhighlight()
Removed highlighted from a ModmailConversation
-
Returns:
- Type
- Promise
Example
r.getNewModmailConversation('75hxt').unhighlight()
-
mute()
Mute the participant of the ModmailConversation
-
Returns:
- Type
- Promise
Example
r.getNewModmailConversation('75hxt').mute()
-
unmute()
Unmute the participant of the ModmailConversation
-
Returns:
- Type
- Promise
Example
r.getNewModmailConversation('75hxt').unmute()
-
read()
Marks the ModmailConversation as read
-
Returns:
- Type
- Promise
Example
r.getNewModmailConversation('75hxt').read()
-
unread()
Marks the ModmailConversation as unread
-
Returns:
- Type
- Promise
Example
r.getNewModmailConversation('75hxt').unread()
-
getParticipant()
Fetches the participant of the conversation
-
Returns:
- Type
- Promise.<ModmailConversationAuthor>
Example
r.getNewModmailConversation('75hxt').getParticipant().then(console.log) // ModmailConversationAuthor { muteStatus: {...}, name: "SpyTec13", created: '2015-11-22T14:30:38.821292+00:00', ...}
-
isRead()
Returns whether the ModmailConversation is read.
-
Returns:
true, if read. false otherwise
- Type
- boolean
-
fetch()
Fetches this content from reddit.
-
This will not mutate the original content object; all Promise properties will remain as Promises after the content has been fetched. However, the information on this object will be cached, so it may become out-of-date with the content on reddit. To clear the cache and fetch this object from reddit again, use
refresh()
.If snoowrap is running in an environment that supports ES2015 Proxies (e.g. Chrome 49+), then
fetch()
will get automatically called when an unknown property is accessed on an unfetched content object.- Inherited From:
Returns:
A version of this object with all of its fetched properties from reddit. This will not mutate the object. Once an object has been fetched once, its properties will be cached, so they might end up out-of-date if this function is called again. To refresh an object, use refresh().
- Type
- Promise
Example
r.getUser('not_an_aardvark').fetch().then(userInfo => { console.log(userInfo.name); // 'not_an_aardvark' console.log(userInfo.created_utc); // 1419104352 }); r.getComment('d1xchqn').fetch().then(comment => comment.body).then(console.log) // => 'This is a little too interesting for my liking' // In environments that support ES2015 Proxies, the above line is equivalent to: r.getComment('d1xchqn').body.then(console.log); // => 'This is a little too interesting for my liking'
-
refresh()
Refreshes this content.
-
- Inherited From:
Returns:
A newly-fetched version of this content
- Type
- Promise
Example
var someComment = r.getComment('cmfkyus'); var initialCommentBody = some_comment.fetch().then(comment => comment.body); setTimeout(() => { someComment.refresh().then(refreshedComment => { if (initialCommentBody.value() !== refreshedComment.body) { console.log('This comment has changed since 10 seconds ago.'); } }); }, 10000);
-
toJSON()
Returns a stringifyable version of this object.
-
It is usually not necessary to call this method directly; simply running JSON.stringify(some_object) will strip the private properties anyway.
- Inherited From:
Returns:
A version of this object with all the private properties stripped
- Type
- object
Example
var user = r.getUser('not_an_aardvark'); JSON.stringify(user) // => '{"name":"not_an_aardvark"}'