Markoudstaal / node-red-contrib-discord-advanced

Recieve, send, edit and delete Discord messages in node-red.
MIT License
46 stars 16 forks source link

Discord Nodes are Changing msg Objects Unexpectedly #17

Closed Ryonez closed 2 years ago

Ryonez commented 2 years ago

I've been playing with some of the nodes, and discovered that at least two (discordPermissions and discordMessageManager) are deleting all msg data not related to what they are returning including _msgid.

For example, msg.channel and msg.author are two fields that are removed, making it extremely difficult to chain nodes together. Say you want to get a message back on a user's roles. You run a test command, discordMessage picks it up, you do internal checks to see if the user is allowed to ask, make a request to discordPermissions for the roles, and... now your screwed cause the msg object was basically formatted. I can't filter the results and pass them onto discordMessageManager as the channel that the command came from no longer is attached to the msg object.

I have no idea how to work around this issue, and as far as I know this isn't how the msg object is meant to be handled. As such, I'd like to request the discord nodes only change the data they are meant to, without destroying other data attached to the msg object.

Ryonez commented 2 years ago

Alright, looking into this a little more, it seems like the original object data was completely shifted into msg.request. I still think this is is a bit to much. _msgid for example is meant to help track a msg through a flow. Changing this value disrupts this.

Markoudstaal commented 2 years ago

This is a known issue that originates from the original repository I forked from. When I have time to do so, I will fix this.

ozdeadmeat commented 2 years ago

+1 Would love a fix to this.