dilame / instagram-private-api

NodeJS Instagram private API SDK. Written in TypeScript.
MIT License
5.93k stars 1.14k forks source link

Real object oriented library #1045

Open Androz2091 opened 4 years ago

Androz2091 commented 4 years ago

I would like to know if it wouldn't be possible to create a real object-oriented library, a bit like discord.js. For example, a User class, with the following properties:

username: string;
followers: User[];
followed: Boolean; // Whether the client is following they
biography: string;
// etc...
// methods:
send()
follow()
block()
// etc...

And for example, for the message event (using your library, @Nerixyz):

client.on('message', (message) => {
    message.author; // User
    message.reply('content'); // shortcut for message.author.send()
    // so we can do
    message.author.follow();
});

I don't know if making a library like discord.js for instagram would be possible, maybe it's not at all the same and I'm imagining impossible things but it would still be great to be able to do that. Currently it's not optimized at all. When you want to send a message you have to fetch the thread, something like that would be more optimized, I think: https://hasteb.in/uxuvarib.ts

iMrDJAi commented 4 years ago

Oh god! It will be great like that! The msgs listeners will be very helpful.

Androz2091 commented 4 years ago

Yes, but I was talking more about the object-oriented side, which I think is really interesting. For example, it would be nice if the Message class has a markAsSeen() method. We could do:

client.on('message', (message) => {
    message.markAsSeen();
});
Androz2091 commented 4 years ago

I've started making insta.js