TrojanerHD / TrojanerBot

My discord bot
MIT License
4 stars 2 forks source link

When redeploying commands while not having authorized to update command permissions, the bot crashes #56

Open TrojanerHD opened 2 years ago

TrojanerHD commented 2 years ago

Problem

When using /deploy or typing !deploy (with permissions), the error Uncaught Error Error: listen EADDRINUSE: address already in use :::3000 is thrown.

Reason

Because a redeployment creates a new instance of Authentication, a new express app is created that tries to listen to the same port as the previous one

Solution

Make server static and check if it has a value when creating a new Authentication instance. If so, don't listen to the same port again.

Workarounds