Closed zofiel closed 1 year ago
did you set a custom_id in your discordInteraction? Could you post you node configuration or an example flow? Thanks!
yes, i set a custom_id to manage the discordinteraction node.
the configuration is not important, you can try to create a button and try to push ir two times.
I used the discordinteraction node to add the user into a role:
discordinteracion node had the custom_id of the button
+
function: msg.action = "set"; msg.user = msg.member.userId; msg.guild = msg.member.guildId; msg.role = "1082753233711267904"; return msg;
+
discordpermission node
Could you post your flow so i can reproduce this situation on my dev environment? I'd appreciate if you can detail the steps too. Thank you!
[ { "id": "cc39b8a07791bee8", "type": "tab", "label": "Flow 1", "disabled": false, "info": "", "env": [] }, { "id": "55bea025aa7e33e1", "type": "inject", "z": "cc39b8a07791bee8", "name": "Crear Boton", "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "", "payloadType": "date", "x": 170, "y": 160, "wires": [ [ "0de16e02d9e5cf1b" ] ] }, { "id": "0de16e02d9e5cf1b", "type": "function", "z": "cc39b8a07791bee8", "name": "Componentes Boton", "func": "msg.payload = \"Pulsa en ACEPTAR si quieres continuar en esta aventura. Ganarás el rol de interesado que te dará derecho, entre otras cosas, a entrar en las partidas\";\nmsg.components =[\n {\n \"type\": 1,\n \"components\": [\n {\n \"type\": 2,\n \"label\": \"ACEPTAR\",\n \"style\": 3,\n \"custom_id\": \"boton_aceptar\"\n }\n ]\n }\n ]\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 440, "y": 160, "wires": [ [ "10c5b697ea40612f" ] ] }, { "id": "10c5b697ea40612f", "type": "discordMessageManager", "z": "cc39b8a07791bee8", "name": "", "channel": "1085107611558477845", "token": "", "x": 730, "y": 160, "wires": [ [ "1fb72ac0a5077282" ] ] }, { "id": "1fb72ac0a5077282", "type": "debug", "z": "cc39b8a07791bee8", "name": "Creacion botón", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 980, "y": 160, "wires": [] }, { "id": "54e708022e39f755", "type": "discordInteraction", "z": "cc39b8a07791bee8", "name": "", "token": "", "interactionType": "button", "custom_id": "boton_aceptar", "commandResponse": "", "interactionObject": true, "ephemeral": false, "x": 170, "y": 260, "wires": [ [ "ca080f1cfefb4684" ] ], "info": "msg.payload = \"Prueba\";\nreturn msg;" }, { "id": "ca080f1cfefb4684", "type": "function", "z": "cc39b8a07791bee8", "name": "definicion permisos", "func": "msg.action = \"set\";\nmsg.user = msg.member.userId;\nmsg.guild = msg.member.guildId;\nmsg.role = \"1082753233711267904\";\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 430, "y": 260, "wires": [ [ "567e3eba9e546a5a" ] ] }, { "id": "567e3eba9e546a5a", "type": "discordPermissions", "z": "cc39b8a07791bee8", "name": "", "token": "", "x": 710, "y": 260, "wires": [ [ "cdabf4975acaacea" ] ] }, { "id": "cdabf4975acaacea", "type": "debug", "z": "cc39b8a07791bee8", "name": "debug 2", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 920, "y": 260, "wires": [] } ]
I tested it, I think the problem is that your nodered is not responding within the 3 seconds that discord waits for a reply.
The discordInteraction node replies automatically so you need to figure out why the reply is not reaching discord servers in time.
Look the code:
but the first time that i create the button it respond fine, the error appear the next time that someone push the button
I If delete it and create it, it works again one more time until a second push
Also, the discord interaction node display the following error that not display when the button is pushed at the first time:
DiscordAPIError[10062]: Unknown interaction
I tried to pusj a lot of time the button and sometimes it works. Seems you are right.
Thanks for your help :)
When i press the button an "interaction failed" error was displayed but after a time the button appear to work becase the flow starts to work, but no info was injected.
Example: i press the button and the button says "interacion failed" and node-red display "unknowd interaction" but if the flow contain a discordmessage like "hello world" the message is displayed
I'm having the same issue described in this link:
https://stackoverflow.com/questions/75612087/discord-js-v14-interaction-failed-when-clicking-on-button-but-button-still-works#:~:text=So%20Discord%20thinks%20you%20didn,collector
I think that the solution is:
"Note that you need to use the update function of your buttonInteraction, since you are just updating the message the button is atteched to."