#401 Error when running command
1 messages · Page 1 of 1 (latest)
Making this a thread to save space
Can you please show a screenshot of where the error occurs
ya
ok
can you please show the full error
1 min
and relevant code
Use v14.8.0 or newer of discord.js: npm i discord.js@latest (more: #769862166131245066)
It's possible that the 401 error you're experiencing is not to do with discord.js but whatever other API you seem to be interfacing with
TypeError: channel.isTextBased is not a function
at InteractionCreateAction.handle (/home/container/node_modules/discord.js/src/client/actions/InteractionCreate.js:50:33)
at Object.module.exports [as INTERACTION_CREATE] (/home/container/node_modules/discord.js/src/client/websocket/handlers/INTERACTION_CREATE.js:4:36)
at WebSocketManager.handlePacket (/home/container/node_modules/discord.js/src/client/websocket/WebSocketManager.js:352:31)
at WebSocketShard.onPacket (/home/container/node_modules/discord.js/src/client/websocket/WebSocketShard.js:489:22)
at WebSocketShard.onMessage (/home/container/node_modules/discord.js/src/client/websocket/WebSocketShard.js:328:10)
at callListener (/home/container/node_modules/ws/lib/event-target.js:290:14)
at WebSocket.onMessage (/home/container/node_modules/ws/lib/event-target.js:209:9)
at WebSocket.emit (node:events:513:28)
at Receiver.receiverOnMessage (/home/container/node_modules/ws/lib/websocket.js:1180:20)```
Use v14.8.0 or newer of discord.js: npm i discord.js@latest (more: #769862166131245066)
Oh, yeah, that's a known issue
401 is different than that error
Well the fix for the channel.isTextBased issue is right there
ig this error is followed by that one
can you please show the part of the 401 error
oh
i see
reset the token and replace the old one ig
no thats not the issue
we dont know that without a proper error stack
can you please show a full error stack
me too dont know it is not giving much information
@crude tapir What does that command do? Please provide some code.
its an uptimer bot
which command u wanna know about
the main question here is what are you doing for the error to occur
Whichever one you run to cause the issue
show the full error pls
yeah and the solution too
It looks like you're catching an error somewhere and just writing the message to the console
so it's more important to know what you do that causes the error first
Error.prototype.stack
The non-standard stack property of an Error instance offers a trace of which functions were called, in what order, from which line and file, and with what arguments. The stack string proceeds from the most recent calls to earlier ones, leading back to the original global scope call.
again, if you could explain what you're doing for the error to happen would really be helpful
btw i have hosted two bots with same handler
w8
free bot and premium bot
That's not relevant
...
the free bot was having this error a week ago
Or shouldn't be
and the premium bot is having this error from today
that is not relevant
So there's a common bug in both of them
that's expected
what command
causes the issue
it would've been nice if you said that from the beginning
What does the bot do when starting up? Does it make any calls to other APIs?
can express be the source for this err
we dont know without an error stack
We can't get an error stack without knowing where the error originates
so calm it down, Joe
im perfectly fine
errors should be showing a full error stack, not just one line
so that has to do with the error handling
there's only so much we can do with the information that is given to us
@crude tapir Check express, and any other elements in your bot's start routines for catch statements. Replace console.log with console.trace
k
At least that'll give us some info about what's being called where
?
w8 - wait
will this be the cause
i have removed express
still there is err
So see if any of the answers apply, rather than just posting the question here?
make sure the client id and token match
error is happening because your code thinks the token it's wrong
w8 i remember smt
ah at the same time when i add new commands in commands folder its not registering
so am using a separate file to register cmds
this has to do with your token not matching with your client id
i will check it w8
what was it?