node-red-contrib-discordjs 1.0.4

Node-RED node using DiscordJs

npm install node-red-contrib-discordjs

node-red-contrib-discord

Node-red nodes that allow you to interact with Discord, via Discord.js. Currently, you can write simple request-reply bots with this. Though node-red-contrib-discordjs is production ready for small bots, it's a new project that might be difficult to use for those unfamiliar with Discord.js. It also hasn't been used yet for large Discord bot deployments.

Warning : nodejs >= 14.0.0 is required to run discordjs v12.

Installation

We recommend to install it with the node-red palette manager.

Run the following command in ~/.node-red:

npm install node-red-contrib-discordjs

Nodes

node-red-contrib-discord gives you access to three nodes:

  • Connect is a node with no inputs and one output allowing you to receive notifications of incoming messages.
  • SendMessage is a node with one input and no outputs allowing you to send messages to a Discord channel.
  • Sendembed is a node with one input and no outputs allowing you to send embed messages to a Discord channel.

Discord.js client sharing

All nodes share Discord.js clients based on the discord-token that they were configured with. That means that, when you add many discordMessage nodes configured with the exact same token, only a single connection with Discord will be made.

Example bot

[{"id":"7cd3ec8e.612e24","type":"tab","label":"Discord","disabled":false,"info":""},{"id":"aa80ad21.68c96","type":"discord-token","name":"NODE-RED"},{"id":"192a1ae0.f96c55","type":"switch","z":"7cd3ec8e.612e24","name":"Delimiter !","property":"payload[0]","propertyType":"msg","rules":[{"t":"cont","v":"!","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":420,"y":340,"wires":[["267ccf64.0ce78"]]},{"id":"64ff274e.1d9f68","type":"change","z":"7cd3ec8e.612e24","name":"Say Morning","rules":[{"t":"set","p":"payload","pt":"msg","to":"morning !","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":890,"y":340,"wires":[["8a81a3a0.6c6f7"]]},{"id":"a5096981.aecb98","type":"Connect","z":"7cd3ec8e.612e24","name":"","token":"aa80ad21.68c96","x":180,"y":340,"wires":[["192a1ae0.f96c55"]]},{"id":"8a81a3a0.6c6f7","type":"sendMessage","z":"7cd3ec8e.612e24","name":"","channel":"","token":"aa80ad21.68c96","x":1180,"y":460,"wires":[]},{"id":"267ccf64.0ce78","type":"switch","z":"7cd3ec8e.612e24","name":"Switch","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"hello","vt":"str"},{"t":"cont","v":"salut","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":3,"x":630,"y":340,"wires":[["64ff274e.1d9f68"],["80eea92c.c81608"],["6c7e663e.3cc9a8"]]},{"id":"80eea92c.c81608","type":"change","z":"7cd3ec8e.612e24","name":"Say Bonjour","rules":[{"t":"set","p":"payload","pt":"msg","to":"Bonjour !","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":890,"y":400,"wires":[["8a81a3a0.6c6f7"]]},{"id":"6c7e663e.3cc9a8","type":"change","z":"7cd3ec8e.612e24","name":"Unknown Command","rules":[{"t":"set","p":"payload","pt":"msg","to":"Unknown Command !","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":520,"y":440,"wires":[["7db8adeb.f9e6f4"]]},{"id":"7db8adeb.f9e6f4","type":"sendEmbed","z":"7cd3ec8e.612e24","name":"Unknown Command","channel":"","title":"t","color":"","description":"test","token":"aa80ad21.68c96","x":520,"y":520,"wires":[]}]

Node Info

Version: 1.0.4
Updated 3 years, 8 months ago
License: MIT
Rating: 4.0 4

Categories

Actions

Rate:

Downloads

1 in the last week

Nodes

  • discord-token
  • Connect
  • sendMessage
  • sendEmbed

Keywords

  • node-red
  • discord

Maintainers