channel.isTextBased is not a function
Every once in a while, I get the error "channel.isTextBased" is not a function, which crashes my bot, and to fix it, I need to update discord.js. However, this bot going down every time there's an update is problematic. Does anyone know a way I can prevent my bot from crashing every update because of this error?
6 Replies
• What's your exact discord.js
npm list discord.js
and node node -v
version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.I know that .isText no longer works
but according to the docs
.isTextBased
should
I'll try swapping to channel.type === ChannelType.GuildText
but that may cause some issues as I dont only want it to happen in text channels, but all text based channels
[email protected], v18.15.0
-
if (channel && !channel.isTextBased()) return;
Use
v14.11.0
or newer of discord.js: npm i discord.js@latest
(more: https://discord.com/channels/222078108977594368/1091094485754187907/1091094485754187907 )thats what I did
but I dont want my bot to break every update
(I updated and it fixed the error)
I just dont want to have my bot go down every couple months ish and have to go in there and manually update discord.js and restart the bot
💀 fair enough
thanks for your help
ic