Androz2091 / insta.js

💬 Object-oriented library for sending and receiving messages via Instagram
138 stars 42 forks source link

Save full message paylod #40

Closed dcts closed 3 years ago

dcts commented 3 years ago

Hey @Androz2091,

thanks a lot for this library, it's really usefull. I would love to contribute. For example it would be really usefull if the Message objects would not loose any information and store the whole message payload. This would make it easy to work with this library when you already know the dilame/instagram-private-api repo, because it is the same object.

I also added an example how to use the changes in this pull request. For example: when you send a DM to the bot of type media_share like this:

You get the following metadata:

{
  messageSender: '...',
  creatorIgHandle: 'infatuation_london',
  images: [
    'https://scontent-ams4-1.cdninstagram.com/v/t51.2885-15/e35/p1080x1080/122424970_416215039738380_6670327433957071078_n.jpg?_nc_ht=scontent-ams4-1.cdninstagram.com&_nc_cat=100&_nc_ohc=-FjiuS3q_vYAX_grDQ-&tp=1&oh=ef64ad92eb09e7043a63ae3e60debb05&oe=5FF677F9&ig_cache_key=MjQyNzk1MzM4OTc5OTEzMzc4OA%3D%3D.2'
  ],
  mediaShareUrl: 'https://www.instagram.com/p/CGx0r6CLtJc',
  timestamp: 1603654620,
  location: {
    coordinates: { lat: 51.48765183, lng: -0.16903313884126 },
    address: '151 Sydney St',
    city: 'London, United Kingdom',
    name: 'Phat Phuc Noodle Bar',
    shortName: 'Phat Phuc Noodle Bar'
  }
}

Let me know if you would like to see that as a function on the message object. For example I thought these two methods could be added:

Let me know if you think that is valuable and if you want me to continue :)

dcts commented 3 years ago

@Bicepsfako I am happy to improve it, but maybe you could leave a hint why you think its bad. Anyways I was not sure if the feature is wanted at all, so I didnt implement the changes suggested by @Snowflake107 at all. When @Androz2091 agrees on the feature I will happily improve it :)

dcts commented 3 years ago

thanks @Androz2091 ! I updaed it! :)