jorisvddonk / node-red-contrib-discord

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

Add some user data to incoming messages #11

Closed daschatten closed 5 years ago

daschatten commented 5 years ago

In most cases discord bots need some more information. For me i use username, tag and roles for now.

jorisvddonk commented 5 years ago

Hiya, thanks for the PR! I've been a but busy with things, but will take a look at this as soon as I've taken care of all of all of my current responsibilities and have some leftover time to take a closer look at this!

One thing that I'd have to take a closer look at before merging this PR is Discord.js version compatibility. The discord.js developers made some breaking changes in later 11.x versions, which they didn't mark as major version upgrades despite these changes requiring a major version upgrade according to SemVer. I need to verify that this PR doesn't cause crashes for people on earlier 11.x versions of the Discord.js library, or force them to upgrade to a later version of discord.js, which might unfortunately cause crashes in their flows if they made use of the discord-client injection node.

jorisvddonk commented 5 years ago

Hiya! Thanks again for the PR.

As of 4.0.0, the username and tag are available via msg.author.username / message.author.tag. I think the roles are available as well, but in a bit of a convoluted way. I'll see if I can expose that information via msg.member...

jorisvddonk commented 5 years ago

Okay, as of 4.0.2, the member role names are now available via msg.memberRoleNames and the role IDs via msg.member._roles! :)