jorisvddonk / node-red-contrib-discord

Node-red nodes that allow you to interact with Discord.
15 stars 19 forks source link

Sending DM to a bot raises an exception #17

Closed Kakimoty-Field closed 5 years ago

Kakimoty-Field commented 5 years ago

I want to send DM to discord-bot, but I get the following error.

23 Jun 23:17:51-TypeError: Can not read property 'roles' of null Client.message (/home/bob/.node-red/node_modules/node-red-contrib-discord/discord/discordMessage.js: 25: 58)

In order to solve this, we modified the program in the local environment.


LINE: 25 [before] msg.memberRoleNames = message.member.roles.array (). map (function (item) {return item.name});

[after] msg.memberRoleNames = message.member? message.member.roles.array (). map (function (item) {return item.name}): null;


I am able to send DM to Discord-Bot. Can you modify the program code?

jorisvddonk commented 5 years ago

Fixed in version 4.0.3. Thanks for the PR!