madmax3365 / node-red-node-discord

Discord nodes for node-red
6 stars 9 forks source link

Node Red crashing on startup #24

Open Eeems opened 3 years ago

Eeems commented 3 years ago

It looks like a discord API change has broken this project. To the point where it's crashing the node-red instance on startup.

TypeError: Cannot read property 'id' of undefined
    at ClientDataManager.newChannel (/data/node_modules/discord.js/src/client/ClientDataManager.js:81:36)
    at Guild.setup (/data/node_modules/discord.js/src/structures/Guild.js:307:68)
    at GuildCreateHandler.handle (/data/node_modules/discord.js/src/client/websocket/packets/handlers/GuildCreate.js:12:15)
    at WebSocketPacketManager.handle (/data/node_modules/discord.js/src/client/websocket/packets/WebSocketPacketManager.js:108:65)
    at WebSocketConnection.onPacket (/data/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:336:35)
    at WebSocketConnection.onMessage (/data/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:299:17)
    at WebSocket.onMessage (/data/node_modules/discord.js/node_modules/ws/lib/event-target.js:120:16)
    at WebSocket.emit (events.js:198:13)
    at Receiver.receiverOnMessage (/data/node_modules/discord.js/node_modules/ws/lib/websocket.js:789:20)
    at Receiver.emit (events.js:198:13)
    at Receiver.dataMessage (/data/node_modules/discord.js/node_modules/ws/lib/receiver.js:413:14)
    at Receiver.getData (/data/node_modules/discord.js/node_modules/ws/lib/receiver.js:352:17)
    at Receiver.startLoop (/data/node_modules/discord.js/node_modules/ws/lib/receiver.js:138:22)
    at Receiver._write (/data/node_modules/discord.js/node_modules/ws/lib/receiver.js:74:10)
    at doWrite (_stream_writable.js:415:12)
    at writeOrBuffer (_stream_writable.js:399:5)
    at Receiver.Writable.write (_stream_writable.js:299:11)
    at TLSSocket.socketOnData (/data/node_modules/discord.js/node_modules/ws/lib/websocket.js:864:35)
    at TLSSocket.emit (events.js:198:13)
    at addChunk (_stream_readable.js:288:12)
    at readableAddChunk (_stream_readable.js:269:11)
    at TLSSocket.Readable.push (_stream_readable.js:224:10)
    at TLSWrap.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)

This likely will be resolved by resolving #4

RamikOaken commented 3 years ago

Dealing with the same issue here.

madmax3365 commented 3 years ago

Sorry for the late response guys, been too busy for days.

There's 90% working code on the V3 branch for sending and receiving messages. I'll push production-ready code tomorrow for those two features. So you can use the V3 branch until I'll finish the rest part of the code.

madmax3365 commented 3 years ago

@Eeems , @RamikOaken Ok, so I've managed to push stable code to the V3 branch and add some documentation in wiki
You can install and use it with the following commands

git clone  git@github.com:madmax3365/node-red-node-discord.git
cd node-red-node-discord
git checkout v3
yarn && yarn build && yarn link

Currently, there are only send messages and get messages nodes.

Eeems commented 3 years ago

Looks like you've removed monitor members from v3? image

EDIT: It also looks like you've changed the data structure being passed around? It's currently missing author.tag and channel.name which I was using previously.

madmax3365 commented 3 years ago

The monitor members node must be refactored. Will add it in the near future. Yeap I've changed the data structure. In the future, If you'll need some fields that missing from there we can add them easily. P.S. I've added user.tag and channel.name props with the latest commit.

eiiot commented 3 years ago

I'm also trying to fix this, but can't install this git clone git@github.com:madmax3365/node-red-node-discord.git as I don't have permissions.

What's the best way to install V3

Eeems commented 3 years ago

Use https://github.com/madmax3365/node-red-node-discord.git instead.

eiiot commented 3 years ago

Thanks!

eiiot commented 3 years ago

Installed using the instructions above, now I can't install other nodes, getting the error "/home/pi/docker/node-red/node_modules/node-red-node-discord: Appears to be a git repo or submodule."

Cronus89 commented 3 years ago

I'm having this issue and i use NodeRed in docker (via HomeAssistant) Is there a way to install the updated version in it?

Eeems commented 3 years ago

Installed using the instructions above, now I can't install other nodes, getting the error "/home/pi/docker/node-red/node_modules/node-red-node-discord: Appears to be a git repo or submodule."

I'd recommend cloning the repo to a different folder and symlinking it into node_modules. When you need to install a new module, remove the symlink, run the install, and then symlink it again.

I'm having this issue and i use NodeRed in docker (via HomeAssistant) Is there a way to install the updated version in it?

I can't speak for home assistant, but you should still have access to the node_modules folder in the node-red docker. You may have to check what volumes are being used, and then make the changes to where the volume is stored on disk.