I need help

When the bot is supposed to rename the channel, it does not. The erorr renameOrderChannel: Provided channel does not support setName! Type: undefined, ID: undefined Value received: test The orders/utils.js: https://sourceb.in/wx6EPfMBbV The index.js: https://sourceb.in/bzRq7pIz7d
31 Replies
Mafia
Mafia6mo ago
why not use <GuildChannel>#edit
d.js docs
d.js docs6mo ago
:method: GuildChannel#edit() discord.js@14.19.3 Edits the channel.
// Edit a channel
channel.edit({ name: 'new-channel' })
.then(console.log)
.catch(console.error);
// Edit a channel
channel.edit({ name: 'new-channel' })
.then(console.log)
.catch(console.error);
Mafia
Mafia6mo ago
wait I am looking at the wrong line Could you give the full error
BMmarci1234
BMmarci1234OP6mo ago
renameOrderChannel: Provided channel does not support setName! Type: undefined, ID: undefined Value received: test
Mafia
Mafia6mo ago
with the stack trace
BMmarci1234
BMmarci1234OP6mo ago
That is what the entire terminal says Logged in as Palette Utilities#7730! (node:19284) Warning: Supplying "ephemeral" for interaction response options is deprecated. Utilize flags instead. (Use node --trace-warnings ... to show where the warning was created) renameOrderChannel: Provided channel does not support setName! Type: undefined, ID: undefined Value received: test
Mafia
Mafia6mo ago
this is not a discord.js error this is a console#warn that you added on line 75 of orders/utils.js
if (typeof channel.setName !== 'function' || !validTypes.includes(channel.type)) {
console.warn(
`renameOrderChannel: Provided channel does not support setName! Type: ${channel?.type}, ID: ${channel?.id}`,
"Value received:", channel
);
return;
}
if (typeof channel.setName !== 'function' || !validTypes.includes(channel.type)) {
console.warn(
`renameOrderChannel: Provided channel does not support setName! Type: ${channel?.type}, ID: ${channel?.id}`,
"Value received:", channel
);
return;
}
BMmarci1234
BMmarci1234OP6mo ago
Oh, so do I remove that?
Samtino
Samtino6mo ago
So it looks like it's working as intended But, Mafia is also right, .setName() is not a function on Channel
BMmarci1234
BMmarci1234OP6mo ago
Now it works, but I have a different problem.
Mafia
Mafia6mo ago
ok, what is it?
BMmarci1234
BMmarci1234OP6mo ago
This is my new index.js: https://sourceb.in/RrdaHK9116 I edited it a bit. After the order is claimed, the unclaim button does not work now, all it says is "THe bot is thinking...."
Samtino
Samtino6mo ago
Without looking, that means you defer a reply but never actually reply later Now I'll look at the code
BMmarci1234
BMmarci1234OP6mo ago
Alright. @Samtino is there any guide that shows me how to do that? I cant seem to find how to do it
Mafia
Mafia6mo ago
assuming this is the code is in the if on line 172. this is an issue with your code as one of the awaited function is not returning. I think the one on 189 is the cause
d.js docs
d.js docs6mo ago
:guide: Slash Commands: Command response methods - Deferred responses read more
Mafia
Mafia6mo ago
here is the guide on Deferred responses
BMmarci1234
BMmarci1234OP6mo ago
@Mafia Why is it not working. I do not understand. https://srcb.in/MCb3B4OrKg wait
Samtino
Samtino6mo ago
Do you have an error? Or at least can you tell us where to look? This file does like 20 things
BMmarci1234
BMmarci1234OP6mo ago
I got something different Yes, so um I edited my orders/utils.js that now says the erorr: https://sourceb.in/sFYVjC24A8 THe erorr: node:events:498 throw er; // Unhandled 'error' event ^ DiscordAPIError[50001]: Missing Access at handleErrors (D:\alex dumb bot2\node_modules@discordjs\rest\dist\index.js:748:13) at process.processTicksAndRejections (node:internal/process/task_queues:105:5) at async SequentialHandler.runRequest (D:\alex dumb bot2\node_modules@discordjs\rest\dist\index.js:1149:23) at async SequentialHandler.queueRequest (D:\alex dumb bot2\node_modules@discordjs\rest\dist\index.js:980:14) at async _REST.request (D:\alex dumb bot2\node_modules@discordjs\rest\dist\index.js:1293:22) at async GuildChannelManager.edit (D:\alex dumb bot2\node_modules\discord.js\src\managers\GuildChannelManager.js:315:21) at async renameOrderChannel (D:\alex dumb bot2\orders\utils.js:79:12) at async Client.<anonymous> (D:\alex dumb bot2\index.js:148:9) Emitted 'error' event on Client instance at: at emitUnhandledRejectionOrErr (node:events:403:10) at process.processTicksAndRejections (node:internal/process/task_queues:92:21) { requestBody: { files: undefined, json: { name: 'test-clothing-36-claimed', type: undefined, topic: undefined, nsfw: undefined, bitrate: undefined, user_limit: undefined, rtc_region: undefined, video_quality_mode: undefined, parent_id: undefined, lock_permissions: undefined, rate_limit_per_user: undefined, default_auto_archive_duration: undefined, permission_overwrites: undefined, available_tags: undefined, default_reaction_emoji: undefined, default_thread_rate_limit_per_user: undefined, flags: undefined, default_sort_order: undefined, default_forum_layout: undefined } }, rawError: { message: 'Missing Access', code: 50001 }, code: 50001, status: 403, method: 'PATCH', url: 'https://discord.com/api/v10/channels/1382731900073807984' } Node.js v22.8.0
Mafia
Mafia6mo ago
you app is missing the permission to edit the channel
BMmarci1234
BMmarci1234OP6mo ago
Ahhh I fixed that, still not working no error
d.js docs
d.js docs6mo ago
If you aren't getting any errors, try to place console.log checkpoints throughout your code to find out where execution stops. - Once you do, log relevant values and if-conditions - More sophisticated debugging methods are breakpoints and runtime inspections: learn more
BMmarci1234
BMmarci1234OP6mo ago
Thanks everyone. It is just a 10 minute delay now, but thats fine. But now, after the channel is unclaimed, the new claim button does not work. It says interaction failed. index.js: https://sourceb.in/CjdHpQb7Kj orders/utils.js: https://sourceb.in/KbT6MkIWpc
Mafia
Mafia6mo ago
An interaction fail message in Discord client means that you never reply to the interaction
BMmarci1234
BMmarci1234OP6mo ago
Still not working... https://sourceb.in/6KbPGLkqnB
Mafia
Mafia6mo ago
ok, I am not programing for you, I will help if you have a spific issue
BMmarci1234
BMmarci1234OP6mo ago
That is now what I am asking for you to do
Samtino
Samtino6mo ago
The customID for your button is likely being ignored. Assuming you're not getting any errors in the console
BMmarci1234
BMmarci1234OP6mo ago
ye i dont get any console erorrs I have tried to read docs, ask friends but nothing is working Give me a minute
Samtino
Samtino6mo ago
^ Add some more logging. Places I would start are, beginning of your "interactionCreate" handler, at the beginning of your logic for the specific button, and the end of the logic for the button Because since you're not getting an error, none of your "if" statements are triggering on the customID, so nothing is actually happening on your bot

Did you find this page helpful?