Giter VIP home page Giter VIP logo

insta.js's Introduction

Hey there ๐Ÿ‘‹

I'm Androz2091, a code-addicted guy from France, now studying at EPFL, Switzerland.

I sometimes write things on my blog. ๐Ÿ“

My life's goal is to learn Rust.

Projects โœจ

I open source every single line of code I write.

I'm the maintainer of hundreds of open source projects, such as:

Skills & Tools ๐Ÿ–ฑ๏ธ

When I need to build things, I usually go for vue Vue.js to code my websites and node-js Node.js with typescript TypeScript for my bots and APIs. My favorite database is definitely postgresql PostgreSQL.

I love discovering languages or frameworks that increase my productivity for my new projects such as Svelte, Golang, Flutter or tools like Sentry so feel free to send me a message with your recommendations on Discord or Twitter! ๐Ÿ˜

Contact me ๐Ÿค

I'm available on Discord and Twitter.

insta.js's People

Contributors

androz2091 avatar busybox11 avatar dcts avatar luizpvas avatar meseven avatar shaynlink avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

insta.js's Issues

User.followers()

User.followers() is limited to 100 people. is it possible to have all followers?

ConnectionFailedError while trying to login the client

For me the repo somehow stopped working. I have multiple bots running and all of them consistently show the following error when trying to log in:

(node:27822) UnhandledPromiseRejectionWarning: ConnectionFailedError: CONNACK returnCode: 3 errorName: Server unavailable
    at Object.next (/home/dcts/code/insta.js/node_modules/instagram_mqtt/dist/mqttot/mqttot.client.js:72:23)
    at MQTToTClient.continueFlows (/home/dcts/code/insta.js/node_modules/mqtts/dist/mqtt.client.js:212:104)
    at MQTToTClient.handlePacket (/home/dcts/code/insta.js/node_modules/mqtts/dist/mqtt.client.js:291:19)
    at /home/dcts/code/insta.js/node_modules/mqtts/dist/mqtt.client.js:247:43
    at Array.forEach (<anonymous>)
    at MQTToTClient.parseData (/home/dcts/code/insta.js/node_modules/mqtts/dist/mqtt.client.js:247:25)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:27822) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:27822) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Anyone having the same issue?

I investigated a bit and the piece of code inside the client class that causes the error is this one

"ClientDisconnectedError: MQTToTClient got disconnected" and "IgCookieNotFoundError: Cookie "sessionid" not found" errors after logout

Hello.
I always get these errors after client.logout():

ClientDisconnectedError: MQTToTClient got disconnected. at SafeSubscriber._next (C:\PROJ\IG\node_modules\instagram_mqtt\dist\realtime\realtime.client.js:154:30) at SafeSubscriber.__tryOrUnsub (C:\PROJ\IG\node_modules\rxjs\internal\Subscriber.js:205:16) at SafeSubscriber.next (C:\PROJ\IG\node_modules\rxjs\internal\Subscriber.js:143:22) at Subscriber._next (C:\PROJ\IG\node_modules\rxjs\internal\Subscriber.js:89:26) at Subscriber.next (C:\PROJ\IG\node_modules\rxjs\internal\Subscriber.js:66:18) at Subject.next (C:\PROJ\IG\node_modules\rxjs\internal\Subject.js:60:25) at MQTToTClient.setDisconnected (C:\PROJ\IG\node_modules\mqtts\dist\mqtt.client.js:330:30) at Object.disconnect (C:\PROJ\IG\node_modules\mqtts\dist\mqtt.client.js:98:26) at TLSSocket.<anonymous> (C:\PROJ\IG\node_modules\mqtts\dist\transport\tls.transport.js:36:52) at TLSSocket.emit (events.js:327:22) at endReadableNT (internal/streams/readable.js:1327:12) at processTicksAndRejections (internal/process/task_queues.js:80:21)

IgCookieNotFoundError: Cookie "sessionid" not found at State.extractCookieValue (C:\PROJ\IG\node_modules\instagram-private-api\dist\core\state.js:142:19) at RealtimeClient.constructConnection (C:\PROJ\IG\node_modules\instagram_mqtt\dist\realtime\realtime.client.js:42:53) at MQTToTClient.payloadProvider [as connectPayloadProvider] (C:\PROJ\IG\node_modules\instagram_mqtt\dist\realtime\realtime.client.js: 92:22) at MQTToTClient.connect (C:\PROJ\IG\node_modules\instagram_mqtt\dist\mqttot\mqttot.client.js:38:42) at MQTToTClient.setDisconnected (C:\PROJ\IG\node_modules\mqtts\dist\mqtt.client.js:339:18) at Object.disconnect (C:\PROJ\IG\node_modules\mqtts\dist\mqtt.client.js:98:26) at TLSSocket.<anonymous> (C:\PROJ\IG\node_modules\mqtts\dist\transport\tls.transport.js:36:52) at TLSSocket.emit (events.js:327:22) at endReadableNT (internal/streams/readable.js:1327:12) at processTicksAndRejections (internal/process/task_queues.js:80:21)

And if I try to log in again WITHOUT RESTARTING the server, I will get this error:

ConnectionFailedError: CONNACK returnCode: 2 errorName: Identifier rejected at Object.next (C:\PROJ\IG\node_modules\instagram_mqtt\dist\mqttot\mqttot.client.js:72:23) at MQTToTClient.continueFlows (C:\PROJ\IG\node_modules\mqtts\dist\mqtt.client.js:212:104) at MQTToTClient.handlePacket (C:\PROJ\IG\node_modules\mqtts\dist\mqtt.client.js:291:19) at C:\PROJ\IG\node_modules\mqtts\dist\mqtt.client.js:247:43 at Array.forEach (<anonymous>) at MQTToTClient.parseData (C:\PROJ\IG\node_modules\mqtts\dist\mqtt.client.js:247:25) at processTicksAndRejections (internal/process/task_queues.js:93:5)

If I try to log in repeatedly, I will get this error every ~10 seconds:

ClientDisconnectedError: MQTToTClient got disconnected. at SafeSubscriber._next (C:\PROJ\IG\node_modules\instagram_mqtt\dist\realtime\realtime.client.js:154:30) at SafeSubscriber.__tryOrUnsub (C:\PROJ\IG\node_modules\rxjs\internal\Subscriber.js:205:16) at SafeSubscriber.next (C:\PROJ\IG\node_modules\rxjs\internal\Subscriber.js:143:22) at Subscriber._next (C:\PROJ\IG\node_modules\rxjs\internal\Subscriber.js:89:26) at Subscriber.next (C:\PROJ\IG\node_modules\rxjs\internal\Subscriber.js:66:18) at Subject.next (C:\PROJ\IG\node_modules\rxjs\internal\Subject.js:60:25) at MQTToTClient.setDisconnected (C:\PROJ\IG\node_modules\mqtts\dist\mqtt.client.js:330:30) at Object.disconnect (C:\PROJ\IG\node_modules\mqtts\dist\mqtt.client.js:98:26) at TLSSocket.<anonymous> (C:\PROJ\IG\node_modules\mqtts\dist\transport\tls.transport.js:36:52) at TLSSocket.emit (events.js:327:22) at endReadableNT (internal/streams/readable.js:1327:12) at processTicksAndRejections (internal/process/task_queues.js:80:21)

How can I restart a session without my server termination?

Add video URL in message object

Idk if this is a limitation of Instagram API or we don't update it but when I send a video it all returns type raven_mdeia but no URLs to get it.

Message Object

{
  id: '<removed>',
  chatID: '<removed>',
  type: 'raven_media',
  timestamp: 1625868234651957,
  authorID: '<removed>' ,
  storyShareData: undefined,
  mediaData: undefined,
  voiceData: undefined,
  likes: []
}

Lots of disconnects

The bot disconnects from Instagram from time to time, and that is breaking events (such as message received).

But, user-triggered events (such as sending messages) are still working fine.

(Duplicate of an issue that I reported on the Discord server, Androz said that this was probably due to the private API that the library uses)

429 - Please wait a few minutes before you try again.

Application Logs

2021-03-10T00:33:39.746440+00:00 app[worker.1]: (node:4) UnhandledPromiseRejectionWarning: IgResponseError: POST /api/v1/direct_v2/threads/broadcast/text/ - 429 -; Please wait a few minutes before you try again.
2021-03-10T00:33:39.746448+00:00 app[worker.1]: at Request.handleResponseError (/app/node_modules/instagram-private-api/dist/core/request.js:125:16)
2021-03-10T00:33:39.746449+00:00 app[worker.1]: at Request.send (/app/node_modules/instagram-private-api/dist/core/request.js:53:28)
2021-03-10T00:33:39.746450+00:00 app[worker.1]: at async DirectThreadRepository.broadcast (/app/node_modules/instagram-private-api/dist/repositories/direct-thread.repository.js:176:26)
2021-03-10T00:33:39.746450+00:00 app[worker.1]: at async DirectThreadEntity.broadcast (/app/node_modules/instagram-private-api/dist/entities/direct-thread.entity.js:192:26)
2021-03-10T00:33:39.746451+00:00 app[worker.1]: at async DirectThreadEntity.broadcastText (/app/node_modules/instagram-private-api/dist/entities/direct-thread.entity.js:26:16)
2021-03-10T00:33:39.746452+00:00 app[worker.1]: (Use node --trace-warnings ... to show where the warning was created)
2021-03-10T00:33:39.746533+00:00 app[worker.1]: (node:4) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
2021-03-10T00:33:39.746595+00:00 app[worker.1]: (node:4) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

`TypeError: Cannot read property 'user' of undefined at new Message`

how to reproduce bug

you need 3 accounts to test this:

  • (1) the bot account
  • (2) a friend of the bot account
  • (3) an external account set private (and NOT visible by the bot)

post a story with account 3. Log in to account 2 and share that private story with the bot account by DM. Try to run Client.login(). This will throw the error:

(node:22369) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'user' of undefined
    at new Message (/home/dcts/code/insta.js/src/structures/Message.js:80:83)
    at /home/dcts/code/insta.js/src/structures/Chat.js:76:49
    at Array.forEach (<anonymous>)
    at Chat._patch (/home/dcts/code/insta.js/src/structures/Chat.js:75:24)
    at new Chat (/home/dcts/code/insta.js/src/structures/Chat.js:53:14)
    at /home/dcts/code/insta.js/src/structures/Client.js:374:26
    at Array.forEach (<anonymous>)
    at Client.login (/home/dcts/code/insta.js/src/structures/Client.js:373:17)

This error is caused because the case of a hidden story share is not catched. I added a pull request that fixes this issue by catching unavailible stories before initializing the message object.

newFollowers don't works

I want to send a message if the user follow the bot, but nothing happens, no error, no message.

clienti.on('newFollower', (user) => {
    console.log('โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ')
    console.log('| โžœ    Nouveau follower !  |')
    console.log('โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ')
    user.send('๐Ÿ›ฌ Merci d\'utiliser pro_note_ !');
});```

Add more examples

For now, there is only one example on the website.
Adding more of them would be great because it'll help devs to understand faster how to use the API.

How to fix 302 found error?

(node:4) UnhandledPromiseRejectionWarning: IgResponseError: POST /api/v1/accounts/msisdn_header_bootstrap/ - 302 Found;

I got this error and i dunno how to fix it. Can someone help me?

IgResponseError while trying to login the client

When trying to log in the client with the basic example I get a IgResponseError thrown by line 370 in Client.js. This is most likely connected to this issues in the instagram-private-api.

(node:17054) UnhandledPromiseRejectionWarning: IgResponseError: GET /api/v1/direct_v2/inbox/?visual_message_return_type=unseen&thread_message_limit=10&persistentBadging=true&limit=20 - 560 -; 
    at Request.handleResponseError (/home/dcts/code/insta.js/node_modules/instagram-private-api/dist/core/request.js:125:16)
    at Request.send (/home/dcts/code/insta.js/node_modules/instagram-private-api/dist/core/request.js:53:28)
    at async DirectInboxFeed.request (/home/dcts/code/insta.js/node_modules/instagram-private-api/dist/feeds/direct-inbox.feed.js:21:26)
    at async Client.login (/home/dcts/code/insta.js/src/structures/Client.js:385:23)
(node:17054) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:17054) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Yesterday there was another error caused by ig.realtime.connect(), but this one occures even before that. So basically there are 2 errors currently:

As I see it, these errors are caused by the original repos dilame/instagram-private-api and Nerixyz/instagram_mqtt and can only be fixed by debugging the errors inside these repositories.

First message not processed when chat is not approved

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.

Dรฉtecter un utilisateur qui arrรชte de nous suivre

Bonsoir Androz ๐Ÿ‘‹

Je viens de parcourir la documentation mais je n'ai trouvรฉ aucun moyen pour vรฉrifier avec les รฉvents si un utilisateur quelconque viens d'arrรชter de nous suivre.

Est ce possible ? Ou alors est ce prรฉvu ?

Bonne fin de soirรฉe.

Message Collector problem

if (message.content === '!candidature') {
    message.reply('Bonjour, @' + message.author.username + ', bienvenue dans la formulaire de candidature ! Entrez votre nom: ')
    const infos = {
        name: null,
        age: null
    }

    const collector = message.createMessageCollector({
        filter: (m) => m.authorID === message.authorID,
        idle: 10000
    })

    collector.on('message', (m) => {
        if (!infos.name) {
            infos.name = m.content
            m.reply('Nom enregistrรฉ! Entrez maintenant votre รขge: ')
        } else if (infos.name && !infos.age) {
            infos.age = m.content
            m.reply('ร‚ge enregistrรฉ! Nous vous recontactons si nous sommes intรฉressรฉs !')
            collector.end()
        }
    })

    collector.on('end', (reason) => {
        if (reason === 'idle') {
            message.reply('Cela fait 10 secondes que vous รชtes AFK, merci de renvoyer !candidature pour dรฉmarrer le formulaire une nouvelle fois !')
        }
    })
}

The collector works but the end event is emitted even if we end() it before

Groups problem

When you make an user admin in a groups you get an error:

(node:10408) UnhandledPromiseRejectionWarning: SyntaxError: Unexpected token u in JSON at position 0
    at JSON.parse (<anonymous>)
    at C:\Users\minit\Desktop\CODING\JS\InstaBot\node_modules\@androz2091\insta.js\src\structures\Client.js:171:53
    at Array.forEach (<anonymous>)
    at C:\Users\minit\Desktop\CODING\JS\InstaBot\node_modules\@androz2091\insta.js\src\structures\Client.js:128:33
    at Array.forEach (<anonymous>)
    at InstaBot.handleRealtimeReceive (C:\Users\minit\Desktop\CODING\JS\InstaBot\node_modules\@androz2091\insta.js\src\structures\Client.js:127:25)
    at RealtimeClient.<anonymous> (C:\Users\minit\Desktop\CODING\JS\InstaBot\node_modules\@androz2091\insta.js\src\structures\Client.js:269:61)
    at RealtimeClient.emit (events.js:314:20)
    at SafeSubscriber._next (C:\Users\minit\Desktop\CODING\JS\InstaBot\node_modules\instagram_mqtt\dist\realtime\realtime.client.js:120:26)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)

And this error when you add / remove an user to the group

(node:10408) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'messages' of undefined
    at C:\Users\minit\Desktop\CODING\JS\InstaBot\node_modules\@androz2091\insta.js\src\structures\Client.js:184:47
    at Array.forEach (<anonymous>)
    at C:\Users\minit\Desktop\CODING\JS\InstaBot\node_modules\@androz2091\insta.js\src\structures\Client.js:128:33
    at Array.forEach (<anonymous>)
    at InstaBot.handleRealtimeReceive (C:\Users\minit\Desktop\CODING\JS\InstaBot\node_modules\@androz2091\insta.js\src\structures\Client.js:127:25)
    at RealtimeClient.<anonymous> (C:\Users\minit\Desktop\CODING\JS\InstaBot\node_modules\@androz2091\insta.js\src\structures\Client.js:269:61)
    at RealtimeClient.emit (events.js:314:20)
    at SafeSubscriber._next (C:\Users\minit\Desktop\CODING\JS\InstaBot\node_modules\instagram_mqtt\dist\realtime\realtime.client.js:120:26)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)

post media

please add post media or story in this library bot
sorry i bad in english chat

TypeError: Cannot read property 'messages' of undefined

This error is emitted when i send a message to the bot (not a command)

Here is the full error.

(node:9644) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'messages' of undefined
    at C:\Users\minit\Desktop\CODING\JS\InstaBot\node_modules\@androz2091\insta.js\src\structures\Client.js:116:30
    at Array.forEach (<anonymous>)
    at C:\Users\minit\Desktop\CODING\JS\InstaBot\node_modules\@androz2091\insta.js\src\structures\Client.js:97:33
    at Array.forEach (<anonymous>)
    at InstaClient.handleRealtimeReceive (C:\Users\minit\Desktop\CODING\JS\InstaBot\node_modules\@androz2091\insta.js\src\structures\Client.js:96:25)
    at RealtimeClient.<anonymous> (C:\Users\minit\Desktop\CODING\JS\InstaBot\node_modules\@androz2091\insta.js\src\structures\Client.js:211:61)
    at RealtimeClient.emit (events.js:314:20)
    at SafeSubscriber._next (C:\Users\minit\Desktop\CODING\JS\InstaBot\node_modules\instagram_mqtt\dist\realtime\realtime.client.js:120:26)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)```

Suggestion d'ajouts (dans l'ordre d'importance)

โ€ข dรฉtecter les demandes de messages privรฉ, pouvoir les accepter et rรฉcupรฉrer l'objet message pour emit l'event messageCreate
โ€ข une fonction createMessageCollector et une fonction createLikeCollector
โ€ข Envoi des photos
โ€ข Possibilitรฉ de supprimer un message
โ€ข Abonnement / dรฉsabonnement
โ€ข Dรฉtecter les likes sur les messages et en poster
โ€ข Marquer les messages comme lu

Error on starting

author: data.story_share?.message === 'No longer available' ? null : this.client._patchOrCreateUser(data.story_share.media?.user.pk, data.story_share?.media?.user),
SyntaxError: Unexpected token '.'
at wrapSafe (internal/modules/cjs/loader.js:1053:16)
at Module._compile (internal/modules/cjs/loader.js:1101:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
at Module.load (internal/modules/cjs/loader.js:985:32)
at Function.Module._load (internal/modules/cjs/loader.js:878:14)
at Module.require (internal/modules/cjs/loader.js:1025:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.<anonymous> (/home/container/node_modules/@androz2091/insta.js/src/structures/Chat.js:2:17)
at Module._compile (internal/modules/cjs/loader.js:1137:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)```

I get ClientDisconnectedError with basic example

When I recreate the basic example, I receive a ClientDisconnectedError. This happens almost every time I send a message, but also approximately every 20 seconds (even when not sending a message). But the messages still get propagated and I can display them locally, which is great. But I am wondering what causes the error, it seems risky to me just ignoring this error. Heres the full error:

ClientDisconnectedError: MQTToTClient got disconnected.
    at SafeSubscriber._next (/home/instjstest/node_modules/instagram_mqtt/dist/realtime/realtime.client.js:154:30)
    at SafeSubscriber.__tryOrUnsub (/home/instjstest/node_modules/mqtts/node_modules/rxjs/internal/Subscriber.js:205:16)
    at SafeSubscriber.next (/home/instjstest/node_modules/mqtts/node_modules/rxjs/internal/Subscriber.js:143:22)
    at Subscriber._next (/home/instjstest/node_modules/mqtts/node_modules/rxjs/internal/Subscriber.js:89:26)
    at Subscriber.next (/home/instjstest/node_modules/mqtts/node_modules/rxjs/internal/Subscriber.js:66:18)
    at Subject.next (/home/instjstest/node_modules/mqtts/node_modules/rxjs/internal/Subject.js:60:25)
    at MQTToTClient.setDisconnected (/home/instjstest/node_modules/mqtts/dist/mqtt.client.js:330:30)
    at Object.disconnect (/home/instjstest/node_modules/mqtts/dist/mqtt.client.js:98:26)
    at TLSSocket.<anonymous> (/home/instjstest/node_modules/mqtts/dist/transport/tls.transport.js:36:52)
    at TLSSocket.emit (events.js:327:22)
    at endReadableNT (_stream_readable.js:1220:12)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)

What could cause this error?

Missing property and improvement suggestions

Missing property:

  • message.author.followerCount
  • message.author.biography
  • message.author.followingCount
  • message.author.isBusiness
  • message.author.mediaCount
  • message.author.totalIgtvVideos

Improvement:

  • When a user like a message the messageCreate event is emitted, maybe a messageLikeAdd (and messageLikeRemove) or smth else should be good.

Things that summons errors:

  • When an user sends an file the message property is undefined
  • When an user answer a story the message property is undefined
  • When a call is started it shows a message in a chat and this message is undefined
  • When the group name is edited it shows a message in a chat and this message is undefined
  • When a heart (default instagram heart) or a sticker is received the message property is undefined
  • When an user send a voice message the message property is undefined

Feature ideas:

  • userAdded (a user has been added to the group)
  • userRemoved (a user has been removed from the group, maybe we can know if he was kicked or just has left)
  • groupUserOpped (a user has been given the admin permissions)
  • groupChatEnded (a group chat has been ended)
  • groupChatCreated (a group chat has been created, this will maybe emit a userAdded event)
  • groupNameUpdate (the group name has been changed)

Maybe i will edit it if i have new suggestions.

messageCreate event emitted on likeAdd

The likeAdd emits a messageCreate event.

I don't know/understand but it happens sometimes, i mean

(after a reboot) > i like the newest message > get the log
i like an older message >the messageCreate event is emitted

Chat fetch doesn't work

When I try to fetch a channel, it doesn't work. Here is the full stack trace.

(node:4096) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'feed' of null
    at Client.fetchChat (/home/busybox/dev/insta-discord/node_modules/@androz2091/insta.js/src/structures/Client.js:111:59)
    at Client.<anonymous> (/home/busybox/dev/insta-discord/index.js:52:14)
    at Client.emit (events.js:314:20)
    at MessageCreateAction.handle (/home/busybox/dev/insta-discord/node_modules/discord.js/src/client/actions/MessageCreate.js:31:14)
    at Object.module.exports [as MESSAGE_CREATE] (/home/busybox/dev/insta-discord/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32)
    at WebSocketManager.handlePacket (/home/busybox/dev/insta-discord/node_modules/discord.js/src/client/websocket/WebSocketManager.js:384:31)
    at WebSocketShard.onPacket (/home/busybox/dev/insta-discord/node_modules/discord.js/src/client/websocket/WebSocketShard.js:444:22)
    at WebSocketShard.onMessage (/home/busybox/dev/insta-discord/node_modules/discord.js/src/client/websocket/WebSocketShard.js:301:10)
    at WebSocket.onMessage (/home/busybox/dev/insta-discord/node_modules/ws/lib/event-target.js:125:16)
    at WebSocket.emit (events.js:314:20)
    at Receiver.receiverOnMessage (/home/busybox/dev/insta-discord/node_modules/ws/lib/websocket.js:797:20)
    at Receiver.emit (events.js:314:20)
    at Receiver.dataMessage (/home/busybox/dev/insta-discord/node_modules/ws/lib/receiver.js:437:14)
    at Receiver.getData (/home/busybox/dev/insta-discord/node_modules/ws/lib/receiver.js:367:17)
    at Receiver.startLoop (/home/busybox/dev/insta-discord/node_modules/ws/lib/receiver.js:143:22)
    at Receiver._write (/home/busybox/dev/insta-discord/node_modules/ws/lib/receiver.js:78:10)
    at writeOrBuffer (_stream_writable.js:352:12)
    at Receiver.Writable.write (_stream_writable.js:303:10)
    at TLSSocket.socketOnData (/home/busybox/dev/insta-discord/node_modules/ws/lib/websocket.js:872:35)
    at TLSSocket.emit (events.js:314:20)
    at addChunk (_stream_readable.js:303:12)
    at readableAddChunk (_stream_readable.js:279:9)
    at emitUnhandledRejectionWarning (internal/process/promises.js:168:15)
    at processPromiseRejections (internal/process/promises.js:247:11)
    at processTicksAndRejections (internal/process/task_queues.js:94:32)
(node:4096) TypeError: Cannot read property 'feed' of null
    at Client.fetchChat (/home/busybox/dev/insta-discord/node_modules/@androz2091/insta.js/src/structures/Client.js:111:59)
    at Client.<anonymous> (/home/busybox/dev/insta-discord/index.js:52:14)
    at Client.emit (events.js:314:20)
    at MessageCreateAction.handle (/home/busybox/dev/insta-discord/node_modules/discord.js/src/client/actions/MessageCreate.js:31:14)
    at Object.module.exports [as MESSAGE_CREATE] (/home/busybox/dev/insta-discord/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32)
    at WebSocketManager.handlePacket (/home/busybox/dev/insta-discord/node_modules/discord.js/src/client/websocket/WebSocketManager.js:384:31)
    at WebSocketShard.onPacket (/home/busybox/dev/insta-discord/node_modules/discord.js/src/client/websocket/WebSocketShard.js:444:22)
    at WebSocketShard.onMessage (/home/busybox/dev/insta-discord/node_modules/discord.js/src/client/websocket/WebSocketShard.js:301:10)
    at WebSocket.onMessage (/home/busybox/dev/insta-discord/node_modules/ws/lib/event-target.js:125:16)
    at WebSocket.emit (events.js:314:20)
    at Receiver.receiverOnMessage (/home/busybox/dev/insta-discord/node_modules/ws/lib/websocket.js:797:20)
    at Receiver.emit (events.js:314:20)
    at Receiver.dataMessage (/home/busybox/dev/insta-discord/node_modules/ws/lib/receiver.js:437:14)
    at Receiver.getData (/home/busybox/dev/insta-discord/node_modules/ws/lib/receiver.js:367:17)
    at Receiver.startLoop (/home/busybox/dev/insta-discord/node_modules/ws/lib/receiver.js:143:22)
    at Receiver._write (/home/busybox/dev/insta-discord/node_modules/ws/lib/receiver.js:78:10)
    at writeOrBuffer (_stream_writable.js:352:12)
    at Receiver.Writable.write (_stream_writable.js:303:10)
    at TLSSocket.socketOnData (/home/busybox/dev/insta-discord/node_modules/ws/lib/websocket.js:872:35)
    at TLSSocket.emit (events.js:314:20)
    at addChunk (_stream_readable.js:303:12)
    at readableAddChunk (_stream_readable.js:279:9)

Message Collector keeps sending messages on end

const collector = message.createMessageCollector({
    filter: (m) => m.content === "10",
    idle: 10000
})

collector.on(`end`, (reason) => {
    console.log(reason)
    if (reason === `idle`) {
        return message.chat.sendMessage(`Sorry, the game is over and no one found the right number: 10`)
    }
})

This code spams "Sorry, the game is over and no one found the right number: 10"

DM pending requests event not emitted

Lately I noticed that the event pendingRequest no longer is emitted when an instagram user sends a message to the bot for the first time (and the bot does not follow that user). This is the event I would like to capture:
Bildschirmfoto vom 2021-02-01 15-58-33

Could it be that instagram changed the event name or did an update? Is there any way to test this?

Here's my code snippet: this does not work (nothing is printed to the console at all, so I assume the event is not being emitted somehow):

client.on('pendingRequest', (chat) => {
  console.log("๐Ÿ‘ค Incoming new DM request");
  try {
    chat.approve();
    console.log("โœ… accepted");
  } catch(err) {
    console.log("โŒ error: " + err.message);
  }
});

I have a log from 2020-12-08 where this feature was still working. Just leaving this info here, maybe its usefull to find the problem.

If you have hints where to look in the code and how to find out why it is not triggeren I'm happy to hear. Should I look into Nerixyz's repository or is the error in this repository? ๐Ÿค”

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.