Unknown Channel
I'm using this code below to edit every new channel or an edited channel to deny
SendMessages
for Mute-Role, and deny ViewChannel
for Prison-Role. However I'm getting this weird error in the attachment I sent, and maybe just maybe because there's a ticket bot that created and deleted some channels so how to remove this error?
6 Replies
- 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 OPafaik channelUpdate and channelCreate shouldnt fire on a deleted channel (channelDelete should fire here). So... this kind of doesnt make any sense to me
you would be editing a channel that doesnt exist. Maybe try checking if the channel exists beforehand anyways, just in case
I tried to put
if (!newChannel) return;
in channelUpdate
Event,
and if (!channel) return;
in channelCreate
Event.
But still the sameyea the error doesnt seem to come from there tbh
are you editing channel overwrites somewhere else perhaps?
no just there
that's why I'm confused
hm...
by the way you kind of have a loop here
you create a channel, that triggers the channel update event
you edit the overwrites there (which i dont get why you dont create the overwrites while creating the channel if you use the bot)
that triggers a channelUpdate event, then you again modify the channel
thats gonna create an inifite loop
also if the channel is deleted in between these events then yea that could create this issue. You see the channel id in the url there? channels/channelId, if you copy that one and try searching for it in your bot channels cache, what happens
if its undefined then you will need to look for whatever or whoever deleted that channel your bot was trying to edit