jorisvddonk / node-red-contrib-discord

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

Need help with mentioning a user in a message reply #15

Open ozdeadmeat opened 5 years ago

ozdeadmeat commented 5 years ago

Any idea what the syntax is to send a message back and mention a user? I have not been able to find anything that explains how to do this, any help would be appreciated.

nate8199 commented 5 years ago

Read my issue @ https://github.com/jorisvddonk/node-red-contrib-discord/issues/14 It explains how to mention a user

ozdeadmeat commented 5 years ago

OK, quickest way is to mention the author.id

Here is a quick flow showing how mention works.

[{"id":"f60da9da.192078","type":"discordMessage","z":"719af26d.d47dcc","name":"BoT","token":"","x":300,"y":360,"wires":[["bef98450.bc2418","ec1d70d6.bd309"]]},{"id":"bef98450.bc2418","type":"debug","z":"719af26d.d47dcc","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":490,"y":360,"wires":[]},{"id":"853cb506.a7ea98","type":"discordSendMessage","z":"719af26d.d47dcc","name":"SendMessage","channel":"","token":"","x":800,"y":400,"wires":[]},{"id":"ec1d70d6.bd309","type":"function","z":"719af26d.d47dcc","name":"Simple Reply Message","func":"var MessengerID = msg.author.id;\nvar MessengerName = msg.author.username;\nvar mentionUser = <@+MessengerID+>;\nvar Msg2Send = Hello+MessengerName;\n\nnode.status({fill:\"green\",shape:\"ring\",text: \"Messages Sent: \"+Msg2Send});\n\nvar PL = mentionUser+Msg2Send\n\nmsg = {\n \"payload\": PL\n }\nreturn msg","outputs":1,"noerr":0,"x":540,"y":400,"wires":[["853cb506.a7ea98"]]}]