Ask coding questions

← Back to all posts
The code is runned twice...

Hello, i dont whats happening with, i know it's not my code, cuz i runned it on visual studio code, and it works fine. But, when i Run it here, it runns twice and i have to comment the server part, cuz it gets an error for trying to execute a server on the same port...


@TinchoDS First of all you should immediately remove your bot token out of your visible repl as the whole world can see it!

Well not really the Whole World
But the whole repl community

You should first move your bot token to the separate file named .env. In this file you should write the token like this:

BTW this is not the whole token

Then in your bot file at the end you should run the bot like this:


@KHZ Oh and I don't know the answer of your solution but I needed to point this fact out and what I do think is that the bot shouldn't be able to run twice. And if you are not talking about this repl then pin the right repl.


@KHZ Sorry after running it I did see that the program ran twice as it outputted the login message twice. Hence I don't know your problem. Hopefully someone skillful will help you with it.