I dont know the error

So I have a code with an error I dont understand and I dont know how to solve it. the setup.js https://sourceb.in/o5RbAKpNEC and the error: https://sourceb.in/KKIutqsbGI
22 Replies
d.js toolkit
d.js toolkit4mo 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
BMmarci1234
BMmarci1234OP4mo ago
Anyone could help?
TÆMBØ
TÆMBØ4mo ago
You cannot defer the showing a of a modal
BMmarci1234
BMmarci1234OP4mo ago
So what should I do?
TÆMBØ
TÆMBØ4mo ago
Not defer beforehand. Showing a modal is an instance of an interaction acknowledgement, and you can only acknowledge an interaction once (within 3 seconds of receiving it)
BMmarci1234
BMmarci1234OP4mo ago
And how to solve that?
TÆMBØ
TÆMBØ4mo ago
Not defer beforehand.
Just remove the line where you defer
BMmarci1234
BMmarci1234OP4mo ago
Alright. Let me try rror showing modal: Error [InteractionAlreadyReplied]: The reply to this interaction has already been sent or deferred. at StringSelectMenuInteraction.showModal (D:\duckhubbot\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:255:46) at Client.<anonymous> (D:\duckhubbot\setup.js:79:31) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) { code: 'InteractionAlreadyReplied' } node:events:498 throw er; // Unhandled 'error' event ^ Error [InteractionAlreadyReplied]: The reply to this interaction has already been sent or deferred. at StringSelectMenuInteraction.reply (D:\duckhubbot\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:104:46) at Client.<anonymous> (D:\duckhubbot\setup.js:83:35) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) Emitted 'error' event on Client instance at: at emitUnhandledRejectionOrErr (node:events:403:10) at process.processTicksAndRejections (node:internal/process/task_queues:84:21) { code: 'InteractionAlreadyReplied' } Node.js v22.5.1 Thats the error I got again
TÆMBØ
TÆMBØ4mo ago
Please share your updated code
BMmarci1234
BMmarci1234OP4mo ago
https://sourceb.in/yiUR6WdCsN Thats my code above
TÆMBØ
TÆMBØ4mo ago
It's still there... You didn't remove it
BMmarci1234
BMmarci1234OP4mo ago
Which line?
TÆMBØ
TÆMBØ4mo ago
Line 64 You only removed an early return condition which checks for if the interaction was deferred/replied to beforehand
BMmarci1234
BMmarci1234OP4mo ago
I still got an error Error creating ticket: DiscordAPIError[50035]: Invalid Form Body parent_id[CHANNEL_PARENT_INVALID_TYPE]: Not a category at handleErrors (D:\duckhubbot\node_modules@discordjs\rest\dist\index.js:730:13) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async SequentialHandler.runRequest (D:\duckhubbot\node_modules@discordjs\rest\dist\index.js:1133:23) at async SequentialHandler.queueRequest (D:\duckhubbot\node_modules@discordjs\rest\dist\index.js:963:14) at async _REST.request (D:\duckhubbot\node_modules@discordjs\rest\dist\index.js:1278:22) at async GuildChannelManager.create (D:\duckhubbot\node_modules\discord.js\src\managers\GuildChannelManager.js:183:18) at async Client.<anonymous> (D:\duckhubbot\setup.js:107:35) { requestBody: { files: undefined, json: { name: 'ticket-1725215116192', topic: undefined, type: 0, nsfw: undefined, bitrate: undefined, user_limit: undefined, parent_id: '1279842672328183808', position: undefined, permission_overwrites: [Array], rate_limit_per_user: undefined, rtc_region: undefined, video_quality_mode: undefined, default_thread_rate_limit_per_user: undefined, available_tags: undefined, default_reaction_emoji: undefined, default_auto_archive_duration: undefined, default_sort_order: undefined, default_forum_layout: undefined } }, rawError: { message: 'Invalid Form Body', code: 50035, errors: { parent_id: [Object] } }, code: 50035, status: 400, method: 'POST', url: 'https://discord.com/api/v10/guilds/1279759006302212176/channels' } With that code https://sourceb.in/tuLVKNhY4C
TÆMBØ
TÆMBØ4mo ago
The error suggests that the ID you're using for the channel's parent is not actually a category channel
BMmarci1234
BMmarci1234OP4mo ago
So how can I solve that?
TÆMBØ
TÆMBØ4mo ago
By making sure the ID you're passing is actually the ID of a category channel
BMmarci1234
BMmarci1234OP4mo ago
Alr. Let me try.
TÆMBØ
TÆMBØ4mo ago
You can log category.type to see what type of channel it is to verify
BMmarci1234
BMmarci1234OP4mo ago
It worked! Thanks so much. And another question. Can I do like if its ownershipteam then the name of the new ticket is own{ticketid}? or how to?
TÆMBØ
TÆMBØ4mo ago
Sure, just check if the value of team is ownership and if so, specify a different template literal string to the name option when creating the channel, likely with a ternary
BMmarci1234
BMmarci1234OP4mo ago
Alright. Thank you so much. You are a lifesaver
Want results from more Discord servers?
Add your server