Androz2091 / insta.js

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

First message not processed when chat is not approved #42

Closed dcts closed 3 years ago

dcts commented 3 years ago

When a new user DM's the bot for the first time, the message usually gets added to pendingRequests. When you try to approve the chat directly and message back instantly, there is an error. Approving the new user works fine, however the message will not be emitted and throw an error.

Example of breaking code:

client.on('pendingRequest', (chat) => {
  chat.approve();
});

I fixed this issue with this pull request. Leaving here in case someone has the same issue.

dcts commented 3 years ago

fixed with pull request #41