Hi guys,
I am having some problems and would like to better understand how deployment works.
I have built a bot for Discord on Replit.
The resources I had were not enough with PRO so I decided to get a Deploy that scales automatically.
However now I am having a problem.
When I make “local” changes to the bot and test them I always get two responses. One from the bot that is going on Replit and the other from the bot that is in Deploy.
So I also get two different responses. One with the updated code and one not.
It would be useless to keep only the Deploy because the process is very long and as you know sometimes you only have one comma that is wrong.
On the other destroy the deploy to fix the code would make The Deploy useless as it would not be on 24/7.
What am I doing wrong?
I would recommend setting up a different Discord server or channel as a test environment. The best way to achieve this is through Secrets, which are environment variables that are passed to the code. For example, you could pass the channel or server ID or even a completely different Discord API token to your Repl and your Deployment as an environment variable, and modify your code to read the environment variable instead of hardcoding the value.
Are you using Autoscale or Reserved VM deployments for your bot? For bots, generally the reserved VM works better since it restarts less and doesn’t go to sleep between requests, but it depends on your use case.
2 Likes
Hi I figured out how I can fix it, thank you very much for the solution. I am currently using the ladder car. Could you tell me just one thing.
What do you mean by “falls asleep between requests”?
That the bot stops working if it is not used?
Because obviously the costs are slightly different.
I am currently using 4CPU and 4GB RAM and with the Hacker I have 6 million computation and I can raise the RAM to 8GB without excessive cost.
With the VM obviously I get to pay 105 a month just to have 4GB of ram and a 2 CPU.
So cost benefit is not comparable.
Thanks
Filippo
What computation are you doing in your Discord bot that requires so much CPU and RAM? Most Discord bots should be able to run on the default Reserved VM tier which is cheaper.
What do you mean by “falls asleep between requests”?
That the bot stops working if it is not used?
A request refers to an HTTP request which is sent to the replit.app host or custom domain serving your deployment. I’m not familiar with the Discord bot JS framework but I don’t think that sending the bot a message counts as an HTTP request, although it might and you can test this if you like.