Class: ModmailConversationAuthor

ModmailConversationAuthor

A class representing an author from a modmail conversation


new ModmailConversationAuthor()

Example
// Get a Modmail Conversation author with a given ID
r.getNewModmailConversation('75hxt').getParticipant()

Extends

Methods


getUser()

Gets information on a Reddit user for the given modmail.

Returns:

An unfetched RedditUser object for the requested user

Type
RedditUser
Example
r.getNewModmailConversation('efy3lax').getParticipant().getUser()
// => RedditUser { name: 'not_an_aardvark' }
r.getNewModmailConversation('efy3lax').getParticipant().getUser().link_karma.then(console.log)
// => 6

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:
Overrides:
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:
Overrides:
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:
Overrides:
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"}'