Community node - Discord Trigger / Send

Hey,

This is my second node, in fact this is a collection of two nodes. The first is a Discord trigger, to listen to channels and run workflows if it matches certain conditions. The second is kind of the same as the official one, instead it doesn’t rely on a webhook but on a Discord bot integrated with it. This node also have special features like the ability to send interactive dialogs (using buttons, select), waiting an answer to continue the workflow.

Technically it’s a bit tricky, I have a lot of parent-child process communications (between the bot and the node executions), so probably lot of bugs to catch at this early stage. But if you give it a try don’t hesitate to ask for help or report any problem :slight_smile:

6 Likes

@hckdotng this is absolutely amazing - why isn’t this topic full of admirations of your work? lol
I was completely lost with integrating discord into n8n (Either had to use polling, or some other kind of solution), but what you created is brilliant.

What would you say the limitations are of this node? Is there also a way to register more commands? (other than the ones that are included like /test)
@Jon @MutedJam Hope you guys tried this out as well - working really well.

Hey @bees8,

This one is not a node I have tried myself there are a bunch of nodes and keeping up with them can be tricky :slight_smile:

We do however currently have our internal overhaul of the Discord node in progress although I have not looked at that yet either to see what is included.

1 Like

Would be very cool to see a discord node overhaul!
Discord has been one of the integrations I’ve been struggling the most with (apart from the Twitter CRC check CRC Twitter response challenge - Built with n8n - n8n ), the only way to get discord to trigger is through polling. Would be amazing to have a native node like @hckdotng did (maybe you can use his/hers :wink: )

Is anyone else having node issues when someone presses the buttons with the latest versions of n8n?

It used to work not sure what happened

1 Like

I have this happening for some reason - Invalid credentials - Close and reopen this node model after making changes.Although it seems that everything was done correctly.

Is this discord community node up to date with discord’s api?

This node seams to not work at the moment, I cannot send a message, and I get an error in the console.
The GitHub repository for this was archived, so I assume the original dev is not supporting this project anymore.
Will try to fork it this evening, and fix the issue. If it is as easy as I expect it to be, its just updating a dependency, and maybe adding one or two more paremters into the mix.

The error i’m getting is this btw:
send:message to ########
Error: Expected token to be set for this request, but none was present

1 Like

Just found this and am getting auth errors although I followed the setup readme to the T. Curious what you find, this looks so promising!

I tried to fix it for a few hours yesterday, turned out to be a tougher nut then I expected :smiley:
I know by now that the bot token is null, in the moment that it tries to send out a message, but I cannot find where it gets set to null. Login is working fine according to the logs, and the gateway receives a trigger, but when I want to send a message, I suddenly have a null token.
Also, I cannot debug locally in the moment, due to the webhook needing to be https, which I currently dont have set up locally.
Will continue my investigation over the next days. Maybe I can find something.
In worst case, I have to rewrite some of the system, to get the credentials again on sendMessage, or something.
Will see.

2 Likes

Just found this as well and it’s not working currently. I’ll take a look at the code later this weekend. Let the thread know if anyone finds a solution!

1 Like

Okay… I still have no idea whats going on, but I got it back to work, with a bit of a workaround.
I send the token with every IPC now, and if sending the message fails, it tries to log in again, before attempting a new send.
With that I got it to work, to send my message again, but it does re-authentificate multiple times even for one single message.
I’m not yet sure why this is happening. My best guess is, that there are some api calls happening in the code, that result in a 401, which causes the bot token to be reset.

My version is available as an npm package: https://www.npmjs.com/package/n8n-nodes-discord-fork
Note: I only checked “Send Message” so far. There might still be problems with other nodes. And I dont know if the constant re-authentification is so healthy either :smiley:

My code can be found here:

Also added an option with 0.5.10, to name files. Needed that for OpenAi Image generation links, to work correctly.

Version 0.5.15 lost commands for now, but It looks like the credentials / login issue might be resolved now.
there was an client.destroy() call in the credentials setup.
I didnt thought much of it, and just assumed its for resetting the client. However, it seams that this was not the original intent of discord.js, and this line killed the authentification.

Also added a node to get past channel messages.

@Ignatz good job so far, I hope you get the trigger node works as well, thanks

The trigger node works fine for me. What issue do you have with it?

The trigger doesn’t triggere.
I setup the bot as the documentation, added the credentials in n8n. Click listen for events, try to send a message to any channel and I don’t get any events

The “listen for event” button for testing, does not work. I did not look into it yet why.
But the nide should work fine, if you set it up, and activate the workflow.

I see that this is an suboptimal workflow. I can check if i find a way to get the testing state to work again.
In the meantime, you have to use the workaround of activating the flow, and testing it that way.

1 Like

Hey @Ignatz, I tried your forked node, it works fine for the Discord Send and Discord Get but I tried a lot to make the trigger works, and it still doesn’t. I don’t see any logs in the docker to debug it too.
I don’t know if you had time to look at it ? I will try to look at the code on your repository on my side

1 Like

hi!!!, i’ve been using your forked version for the past month, anyway you can get discord commands working again?