madmax3365 / madmax3365/node-red-node-discord
Send Messages not working with DM channels
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 7
- Forks
- 8
- PR merge metrics
- No merged PRs in 30d
Description
### The Problem:
When the `discord send messages` node is used to send a message to a direct message (DM) channel, an error occurs:
```
Couldn't send to channel '': channel not found.
```
### Reproducing the Error:
For this error to occur, I have a simple flow consisting of a `discord get messages` node, leading into a `function` node that reads:
```
message = {
payload: "Anything",
channel: msg.channel.id
}
return message;
```
Which then outputs into a `discord send messages` node.
When a message is sent to the bot in a server channel, the response is as expected, with the bot replying "`Anything`". However, when a message is sent to the bot through a DM channel, the error occurs.
### The Flow:
```
[
{
"id": "65a5b58f.3f8704",
"type": "tab",
"label": "Discord Reply Flow",
"disabled": false,
"info": ""
},
{
"id": "5416c1c8.c5d9d",
"type": "discord-get-messages",
"z": "65a5b58f.3f8704",
"name": "",
"token": "",
"channels": "",
"x": 108.125,
"y": 422.5,
"wires": [
[
"d89ad182.49c57"
]
]
},
{
"id": "113fd53a.8094f3",
"type": "discord-send-messages",
"z": "65a5b58f.3f8704",
"name": "",
"channel": "",
"token": "",
"x": 513.625,
"y": 422.5,
"wires": []
},
{
"id": "d89ad182.49c57",
"type": "function",
"z": "65a5b58f.3f8704",
"name": "",
"func": "message = {\n payload: \"Anything\",\n channel: msg.channel.id\n}\nreturn message;",
"outputs": 1,
"noerr": 0,
"x": 314.375,
"y": 422.5,
"wires": [
[
"113fd53a.8094f3"
]
]
}
]
```
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the discord send messages node and trace how it resolves the channel id supplied by msg.channel.id. Compare the lookup behavior for server channels and DM channels using the flow in the issue. Done means the same flow sends “Anything” successfully both in a server channel and through a DM.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- nodejs, typescript
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100