#VPS turns off after discord bot didnt get permissions to send messages in a server.

8 messages · Page 1 of 1 (latest)

willow remnant
#

im getting this error :

  code: 50013,
  status: 403,
  method: 'POST',
  url: 'https://discord.com/api/v10/channels/1189190604203233390/messages'

this is my error handling code :

                await handleBotResponse(message, contentWithoutMention); // Moved bot response handling here
            } catch (error) {
                console.error('Error:', error);

                if (error.response && error.response.status === 403) {
                    // Handle Missing Permissions error (code 50013) by logging without stopping the bot
                    console.error('Bot is missing permissions in this channel');
                    message.channel.send('Sorry, I don\'t have the necessary permissions to respond in this channel.');
                } else {
                    // Log other errors and inform the user
                    console.error('Unhandled error occurred:', error);
                    message.channel.send('Sorry, I encountered an error while processing your request.');
                }
            }
        }
    } catch (outerError) {
        console.error('Unhandled exception in messageCreate event handler:', outerError);
    }```

is my bot going offline after permissions error my VPS fault or discord.js's fault??
i am so confused
i just want it to log it in console or the channel that it is missing permissions and continue working and not going offline instantly.
olive fjordBOT
#
  • What's your exact discord.js npm list discord.js and node node -v version?
  • Not a discord.js issue? Check out #1081585952654360687.
  • 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!
boreal slate
#

You catch the error of being unable to send in that channel. And then send a message in that channel to inform them you can’t send in that channel. Do you see the issue?

river juniper
#

You can also check the permissions Member (including the bot) has for a channel to try and avoid this happening, and alert yourself in other ways; such as if you start sending messages to servers.

willow remnant
willow remnant
river juniper
willow remnant