eris
eris copied to clipboard
TypeError on a MODAL_SUBMIT interaction
I'm using client.requestHandler to post the new modals in response to interactions, and when the user submits a modal, i receive this from Eris:
TypeError: Cannot read properties of undefined (reading 'emit')
at Function.from (/root/BruhBot Canary/node_modules/eris/lib/structures/Interaction.js:43:22)
at Shard.wsEvent (/root/BruhBot Canary/node_modules/eris/lib/gateway/Shard.js:2324:60)
at Shard.onPacket (/root/BruhBot Canary/node_modules/eris/lib/gateway/Shard.js:401:26)
at Shard._onWSMessage (/root/BruhBot Canary/node_modules/eris/lib/gateway/Shard.js:2445:29)
at WebSocket.emit (node:events:390:28)
at Receiver.receiverOnMessage (/root/BruhBot Canary/node_modules/ws/lib/websocket.js:983:20)
at Receiver.emit (node:events:390:28)
at Receiver.dataMessage (/root/BruhBot Canary/node_modules/ws/lib/receiver.js:517:14)
at Receiver.getData (/root/BruhBot Canary/node_modules/ws/lib/receiver.js:435:17)
at Receiver.startLoop (/root/BruhBot Canary/node_modules/ws/lib/receiver.js:143:22)
at Receiver._write (/root/BruhBot Canary/node_modules/ws/lib/receiver.js:78:10)
at writeOrBuffer (node:internal/streams/writable:389:12)
at _write (node:internal/streams/writable:330:10)
at Receiver.Writable.write (node:internal/streams/writable:334:10)
at TLSSocket.socketOnData (/root/BruhBot Canary/node_modules/ws/lib/websocket.js:1077:35)
at TLSSocket.emit (node:events:390:28)
After some more testing, the issue appears only on this type of interaction. [email protected] (git+ssh://[email protected]/abalabahaha/eris.git#1a6e043331aea04de307a71d2e50e9680d1a5ae3)
The issue is that Eris doesn't have a type for Modals yet, so it can't return an interaction of that type. See lib/structures/Interaction.js
PR will be created in due course. Ignore my last reply if you saw it
The issue is that Eris doesn't have a type for Modals yet, so it can't return an interaction of that type. See lib/structures/Interaction.js
Why can't it just create a default interaction then? It isnt that hard to make

There was supposed to be UnknownInteraction for this since the type of modal interaction differs.
There was supposed to be UnknownInteraction for this since the type of modal interaction differs.
So it didn't work?
UnknownInteraction is still a thing on latest dev.
TypeError: Cannot read properties of undefined (reading 'emit') at Function.from (/root/BruhBot Canary/node_modules/eris/lib/structures/Interaction.js:43:22) ...
In the commit you referenced, 1a6e043331aea04de307a71d2e50e9680d1a5ae3, the line originating your error doesn't do anything like that. Try testing with latest npm release?
https://github.com/abalabahaha/eris/blob/1a6e043331aea04de307a71d2e50e9680d1a5ae3/lib/structures/Interaction.js#L43
I've actually poked around the WS event, the error was that when the Shard receives the WS EVENT for INTERACTION_CREATE, it uses Interaction.from(interaction, client) to create an Interaction object, however the Interaction.from is trying to use this._client which is impossible since it's a static function, and hasn't been initialised so there's no such thing as that..
https://github.com/abalabahaha/eris/blob/dev/lib/gateway/Shard.js#L2334 https://github.com/abalabahaha/eris/blob/dev/lib/structures/Interaction.js#L46
oh, duh, that makes sense. Since client is passed in that method, should be an easy PR to fix it; I'll do it later tonight if nobody beats me to it.
edit: Issue fixed by #1334
what is going on with my ipad this is still of relevance, and will be closed when a new release is made