Bot crashes: invalid webhook token
Hi my bot crashes after running a command that takes about 15 minutes to finish? The command updates the message according to the 'game state'.
this is the error code
and it crashes in this part of the code
the clahsEventManager is a function that runs the callback when there's a message received via socket.io
I'll also upload my full code later.
20 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 OPclashEventManager is at 218 and the crash happends at 570
an interaction webhook stays valid for 15 minutes
after that it will error with that
How do i get a new webhook or fix this?
Do i have to fetch the message each time and edit it?
you would need a new interaction
if you have replied before, which i cant see, use a pastebin, you can edit the interaction messages yes, as long as it is not ephemeral
https://gist.github.com/jsw08/8a239f8ddbd71f3ba1bbc29f4cee4e2a
i reply once to the interaction, and try to edit that message every time the websocket gives an update
the game takes around 15 minutes, and can take up to 5-10 minutes before the game starts so max 25 minutes, usually ~16
Other files are at https://github.com/jsw08/DCBot/tree/52-coc-socketio-integration haven't pushed this one yet.
you're better off using a regular message then
So just replying to my own message?
both should just work, but you wont be able to edit it through the interaction webhook, you will need to edit the message like you would for a regular message
which doesnt work if the message is ephemeral
which it is as far as i can see
so you would need to make it non ephemeral
Thanks! I had another (relatively small) issue, can i ask it here or do i need to open another thread?
if the issue is related to djs, sure, you can ask here
Okay so i was trying to create a thread to the message, but i kept getting this error while trying to fetch it (sec i deleted the code so rewriting)
same code as the gist except i changed this part (line 556-570) (added fetchReply and startThread
do i need to fetch the channel before fetching the reply?
do you have the Guilds intent? and did this happen in a guild?
it happened in a guild (i beleive you can't make threads in dms right?) and i do have the guild intent
can you log message? and perhaps message.channel too
also, did you invite your app with the bot scope
Oh that might be it
it's running as a user app
https://gist.github.com/jsw08/a006fbcd88f92b36a1203ca9d708880b
yeah, a user app cannot create threads
oh that sucks. Thanks!