Discord bot scripts running "twice" ("2 bots at once")

Hello.
Sometimes, when I use my bot, it replies twice. Usually, I just change the bot token after that, but that’s not a real solution.
In the first place, I wanna know why is this happening. It’s really annoying + I don’t know what is even causing it.
the project with that bot is the only one with its token and somehow, there are two “scripts” running at once.
Is there a way to fix that?

Thank you.

Could you share your code?

Also, is your project public or has your token been leaked? Are you accidentally putting it on GitHub?

There’s too much code.
My token wasn’t leaked and the bot isn’t on github …
(I’ve changed the token multiple times and it still happens sometimes) …
Edit: if the token was leaked, the same commands couln’t be used (like, there are 2 same scripts runnin g apparently)

This happened to me yesterday after a restart too. Randomly disappeared after awhile

How did you fix it? Regenerating another token?

Restarted the bot. Nothing more than that

Thing is that glitch is screwed at this moment. Having to restart about every hour installing all the packages in the hope it won’t stop next hour doesn’t make nyone happy. The uptime is less then 5% atm

1 Like

Ya’ll need to stop hating on Glitch. They’re doing their best to stabilize the platform.

3 Likes

What’s the source of this?

all those errors come down to glitch effing up for the past weeks

Hey what’s up

Just regenerate the token from developer portal of discord
and put the new token of the bot in your project. it solved my issue yesterday

1 Like

Hating and frustrating are different things. I completely understand their trying to resolve the issue. Which I totally respect. Though you gotto understand having a bot supporting the mass globally asks for uptime. That frustrates when the system gets daily new problems.

From slow loading projects to reinstalling dependacies to blocking ping etc etc. Seems like I have to spend daily more time to make sure the uptime is enough to support the users

1 Like

Mathematical genius. Downtime per minute / total time a day multiplied by 100 = downtime.

1 Like

I had a similar problem the other day. At first, the bot made two identical answers. Yesterday I was informed that the bot makes four identical answers. I changed the bot token and the problem was solved

I second this. I’ve been unable to edit my bot on Glitch, at all in the past few days. I moved to Repl.it

Hey man, from the title (“2 bots at once”). I’d assume you have two bots with the same code. Could you send your project link so we can view it?

Sorry, I can’t send the project cause it contains stuff like API keys, etc
But it’s one project, just “2 bots” running at once. This was happening multiple times. I always regenerated the token, and it still happens sometimes …

As long as your bot token is in the env As long as any of your important information is in the .env file, those who can’t edit on the project itself, will not be able to see the .env file.

I’d assume the problem lies with this “2 bots running at once” but I don’t actually understand what you mean by that…

Are you hosting a Discord bot? And a website?

Basically, if I use a command, I would get 2 same responses.

Discord py hosting on glitch

So… you mean “2 messages at once”

Two same messages at once.

Yeah, me and a friend have had the same issue a couple of times the last 2 weeks or so.

So like, if I did &say test. The same bot will reply with test 2 times.

Maybe you are running the same code on your computer or on a different project.

No, it just happens randomly and I fix it by regenerating the token …

It should fix by regenerating the token.

Hmmm… Are you sure? It would make sense if the code was running on two computers, projects, etc. as regenerating the token would make the old code not work. Maybe you have it on some other hosting as well and don’t realise? Do you have it automatically update to a different hosting provider?

Maybe the same code running on a different computer/project and that’s why it is running twice, or something in the code is broke it.

1 Like

No, the same code is not running on a different computer. It is a problem with glitch. It’s probably related to the issues they’ve had lately.

The times I’ve had that issue is after the project has reloaded because of some code change, or a refresh, but I guess it actually started a new one and didn’t stop the old one.

I’m sure. Like, even if I don’t touch the project for a few weeks, it breaks on it’s own.

But this isn’t the first time, though.

Yes, but that isn’t really a long term solution.

It could always be an issue with your code but we can’t see it so oh well

The only part, where the code runs the bot, is client.run at the very end

It’s not the problem with glitch. The problem is that the same script is running on a different computer/project, or something is going faulty in his code, or discord is having a issue.

No, use client.login();

Thats python.
Also, as I said, my code isn’t running anywhere else, nor computer nor another project.
Another thing is, even some loops run twice sometimes which causes them to error.

I guess, maybe discord is having issues.

But maybe something is in your code is breaks and sends it twice.

I’m experiencing the same phenomenon.
If you update the code you’re currently editing, one is being processed as you modified it But The other one is handled with the old code, and the There’s no way to edit, delete or stop the old code.

Submit a ticket about this bug at here.

But maybe something is in your code is breaks and sends it twice.

How is that possible?

It can be a issue in your code. I guess, if not, there is a issue with maybe the bot is running on multiple sources.

have you been seeing anything in your project’s logs about the app taking too long to shut down?

I’m asking because I’ve been experiencing huge disk latencies on Glitch, and if your app gets stuck waiting for a disk access, it (i.e., libuv worker thread, I think) goes into uninterruptible sleep, such that Glitch wouldn’t be able to force-terminate it. I wonder if that leaves the rest of the process running, as Glitch spins up a new process after you change a file or something.

In that case, add watch.json. :slight_smile: