Can't change channel of webhook

I'm trying to change the channel of a webhook, to a channel. The channel does exist and the bot has all permissions (the bot owns the guild). The id of the channel also is correctly shown in the requestBody given in the error message.
await webhook.edit({
name: targetMessage.author.displayName,
avatar: targetMessage.author.avatarURL({
size: 4096,
dynamic: true,
}),
channel: message.channelId,
})
await webhook.edit({
name: targetMessage.author.displayName,
avatar: targetMessage.author.avatarURL({
size: 4096,
dynamic: true,
}),
channel: message.channelId,
})
Error: DiscordAPIError[10003]: Unknown Channel at handleErrors (/home/max/Documents/DiscordMessageLinkBot/node_modules/@discordjs/rest/dist/index.js:727:13) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async SequentialHandler.runRequest (/home/max/Documents/DiscordMessageLinkBot/node_modules/@discordjs/rest/dist/index.js:1128:23) at async SequentialHandler.queueRequest (/home/max/Documents/DiscordMessageLinkBot/node_modules/@discordjs/rest/dist/index.js:959:14) at async _REST.request (/home/max/Documents/DiscordMessageLinkBot/node_modules/@discordjs/rest/dist/index.js:1272:22) at async Webhook.edit (/home/max/Documents/DiscordMessageLinkBot/node_modules/discord.js/src/structures/Webhook.js:284:18) at async Client.<anonymous> (/home/max/Documents/DiscordMessageLinkBot/index.js:35:7) { requestBody: { files: undefined, json: { name: 'SWORD FIGHT', avatar: null, channel_id: '1068865955054223401' } }, rawError: { message: 'Unknown Channel', code: 10003 }, code: 10003, status: 404, method: 'PATCH', url: 'https://discord.com/api/v10/webhooks/1321112938597060669' }
12 Replies
d.js toolkit
d.js toolkitā€¢5w 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
Maxi130
Maxi130OPā€¢5w ago
[email protected] /home/max/Documents/DiscordMessageLinkBot ā””ā”€ā”€ [email protected] v22.4.0
d.js docs
d.js docsā€¢5w ago
:property: Message#channelId [email protected] The id of the channel the message was sent in
Maxi130
Maxi130OPā€¢5w ago
There is. As you can see in the error payload, there is the right channel id.
Maxi130
Maxi130OPā€¢5w ago
PermissionsBitField { bitfield: 1829587348619263n } It should have permissions as the bot owns the guild.
No description
Maxi130
Maxi130OPā€¢5w ago
Normal guild text channel.
Maxi130
Maxi130OPā€¢5w ago
To big for discord, https://pastebin.com/1taYbQSE
Pastebin
TextChannel { type: 0, guild: Guild { id: '10409699 - Pasteb...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Maxi130
Maxi130OPā€¢5w ago
Yes, the error happens for all channels in that guild. Only thing that changes is the channel_id in the payload mentioned in the error.
Maxi130
Maxi130OPā€¢5w ago
https://pastebin.com/yd7Q1DWb that's the previous channel from the error.
Pastebin
TextChannel { type: 0, guild: Guild { id: '10409699 - Pasteb...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Maxi130
Maxi130OPā€¢5w ago
Oh, I printed that and realized that I was still using a hard coded webhook instead of the one that I had stored for that guild. Sorry for wasting your time. It works now.

Did you find this page helpful?