Hi,
So as the title says, I am trying to work out how to respond to messages in a specific channel in a discord server and also respond to only specific user id's that are allowed. I have seen that webhooks is an option but that only works for sending and I need to also recive messages at the same time. I have found some exisiting libraries but they have not been update for some time. Any ideas of how to do this so that I can do other stuff based on messages sent in a discord channel
Any reason you have tagged node-red-dashboard ?
I have removed this tag, please only tag based on relevance/discussion.
Also, what Node RED Node are you using to drive your Discord Bot?
Surely, it should be outputting metadata based on the request sent to the Bot?
Then, you can use the switch
Node to decide on your response (if at all)
I don't create bots, but surely the Node's documentation should explain how to do what you want
My bad I thought that was the right tag, I am new here (and to the app too). I was only aware of really one version of NR, I am using 4.0 (or whatever is latest). I was wanting to see if i could to do it all in NR itself, I found node-red-contrib-discord-advanced which seems to do what I want but was curious if anyone had experience with it.
A few here has created bots (I'm not sure if it was with Discord though)
But It should absolutely be possible.
If new to Node RED, I do recommend a few resources.
Youtube Guide
Cook Book
https://cookbook.nodered.org
The Node you installed (node-red-contrib-discord-advanced)
Has examples.
- Hamburger Menu
- Import
- Examples
Each node you drag into the workspace, will should have documentation also
I forgot that the examples were a thing, thanks for the info, I have been playing around with the nodes you mentioned, they are very fast to respond....
Now I just need to work out how the library works fullly and how to respond, shouldnt be too hard considering the docs are actually well written from what I have seen so far
Plenty of help around here - more Node RED specific of course, for 3rd party Nodes, forum members that use them will usually chip in
And of course welcome to the forums.
May as well ask here, I am not getting Error: Expected token to be set for this request, but none was present
on some actions (mostly sending messages), I have not changed the token at all which confused me
That seems like something the Node wants.
Be careful you're not creating a whole new msg
- removing some important properties (like a token ) as you're passing the messages around your flow.
You should be modifying any msg
as its travels along your flow, not empty and send a whole new object
/* Not Good */
let message = {
payload:'Something'
}
return message
/* Good */
/* this retains other msg properties, that may have been added by Nodes up stream */
msg.payload = 'something'
return msg
msg
is the message being passed along your flows - it can pick up properties on the way
The reason is, its very likely this Node is using some properties, that you are removing somehow (example a token
for a chat session)
You may need to raise an issue on the authors repo if that is not the case
use the debug
node (set to show the whole message), and you may see a token in there, that you may be removing
Right ok, that makes sense. This flow I am using is a testing one so its all over the place at the moment and its more or less a inject connected to a discord node. I am also trying to setup the bot to respond certain strings, is there a way to convert the inputted text to all lower case (makes handeling mized case easy) and also do what a switch node does but if that string is anywhere in the payload that was inputted