Skip to content

Commit

Permalink
Added MediaShare to Message types
Browse files Browse the repository at this point in the history
  • Loading branch information
0x0arash committed Mar 11, 2021
1 parent 0505933 commit 8df94ba
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/structures/Message.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,15 @@ class Message {
}
}
}

/**
* @typedef {object} MediaShareLocation
* @property {string?} coordinates: Util.extractLocationCoordinates(messageData),
* @property {string?} address: Util.extractLocationAddress(messageData),
* @property {string?} city: Util.extractLocationCity(messageData),
* @property {string?} name: Util.extractLocationName(messageData),
* @property {string?} shortName: Util.extractLocationShortName(messageData),
*/
/**
* @typedef {object} MessageMediaData
* @property {boolean} isLike Whether the media is a like (mediaData.url will be `null`)
Expand All @@ -95,11 +104,24 @@ class Message {
* @property {boolean} isRandom Whether the media was chosen randomly
* @property {string?} url The URL of the media
*/
/**
* @typedef {object} MessageMediaShareData
* @property {string} messageSender The username of the message sender
* @property {string} creatorIgHandle The username of the media creator
* @property {string[]} images Array of urls to images in the media share
* @property {string?} mediaShareUrl The url to the media share
* @property {string} timestamp The creation time of the media share
* @property {MediaShareLocation?} location The location data of the media share
*/
/**
* @type {MessageMediaData?}
* The data concerning the media
*/
this.mediaData = undefined
/**
* @type {MessageMediaShareData?}
* The data concerning the media share
*/
this.mediaShareData = undefined;
if (data.item_type === 'animated_media') {
this.mediaData = {
Expand Down

0 comments on commit 8df94ba

Please sign in to comment.