Issue by opening a ticket

I can't undestand why when i open a ticket i get this error: Errore durante la gestione dell'interazione: DiscordAPIError[50035]: Invalid Form Body role_id[NUMBER_TYPE_COERCE]: Value "tech_support" is not snowflake. at handleErrors (/home/container/node_modules/discord.js/node_modules/@discordjs/rest/dist/index.js:730:13) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async SequentialHandler.runRequest (/home/container/node_modules/discord.js/node_modules/@discordjs/rest/dist/index.js:1133:23) at async SequentialHandler.queueRequest (/home/container/node_modules/discord.js/node_modules/@discordjs/rest/dist/index.js:963:14) at async _REST.request (/home/container/node_modules/discord.js/node_modules/@discordjs/rest/dist/index.js:1278:22) at async GuildMemberRoleManager.add (/home/container/node_modules/discord.js/src/managers/GuildMemberRoleManager.js:131:7) at async Client.<anonymous> (/home/container/index.js:161:9) { requestBody: { files: undefined, json: undefined }, rawError: { message: 'Invalid Form Body', code: 50035, errors: { role_id: [Object] } }, code: 50035, status: 400, method: 'PUT', url: 'https://discord.com/api/v10/guilds/991321696420245544/members/492320170514186240/roles/tech_support' }
11 Replies
d.js toolkit
d.js toolkit3mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by OP
TÆMBØ
TÆMBØ3mo ago
The error explains what's wrong
Value "tech_support" is not snowflake
thaferra
thaferraOP3mo ago
the funny thing is that I get the same error with all options, so I don't understand what I should fix
TÆMBØ
TÆMBØ3mo ago
By passing an ID, not any generic string Discord doesn't know what you mean by tech_support They do however know what you mean when you pass the ID of a role you want to add to a member
thaferra
thaferraOP3mo ago
but you know what? in reality I wasn't trying to add a role when someone opens a ticket, but to add the possibility for people with the "staffRoleID" role to be able to see the newly created channel, as well as tickets
TÆMBØ
TÆMBØ3mo ago
Your error indicates you are trying to add a role to someone Likely at line 161 of index.js
thaferra
thaferraOP3mo ago
but I think it refers to another selectmenu that I have
TÆMBØ
TÆMBØ3mo ago
Whatever it is you're doing is causing your code to try to add a role to someone with a string tech_support which is not a valid role ID
thaferra
thaferraOP3mo ago
tomorrow i'll check and i let you know there's nothing about it if someone wanna check, here's the code: https://sourceb.in/yg3Ch0EQ9L
treble/luna
treble/luna3mo ago
you have 2 if statements listening for string select menu interactions, one trying to add a role this is why you should consider making a proper handler, not endless if elses or at the least add customId checks
thaferra
thaferraOP3mo ago
solved using a customid, ty so much, have a great day
Want results from more Discord servers?
Add your server