Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bot stop working after 2-3 hours of work #8592

Closed
AsylumOfDeads opened this issue Sep 4, 2022 · 3 comments · Fixed by #8927
Closed

Bot stop working after 2-3 hours of work #8592

AsylumOfDeads opened this issue Sep 4, 2022 · 3 comments · Fixed by #8927

Comments

@AsylumOfDeads
Copy link

Which package is this bug report for?

discord.js

Issue description

After 2-3 hours of working bot turns off, debug logs says that the bot token is invalid, but i can still reactivate the bot with the same token, please i really need help with it i can't even imagine what can i do with this.
I've done everything as in discord js guide.

importing token from json
const { token } = require('./json/config.json');

client init
const client = new Client({ intents: [GatewayIntentBits.MessageContent, GatewayIntentBits.GuildMembers, GatewayIntentBits.GuildMessages, GatewayIntentBits.Guilds] });

running the bot
client.login(token);

initing rest
const rest = new REST({ version: '10' }).setToken(token);

Code sample

9[WS => Shard 0] Heartbeat acknowledged, latency of 17ms.
6[WS => Shard 0] [HeartbeatTimer] Sending a heartbeat.
9[WS => Shard 0] Heartbeat acknowledged, latency of 24ms.
6[WS => Shard 0] [HeartbeatTimer] Sending a heartbeat.
9[WS => Shard 0] Heartbeat acknowledged, latency of 16ms.
6[WS => Shard 0] [HeartbeatTimer] Sending a heartbeat.
9[WS => Shard 0] Heartbeat acknowledged, latency of 23ms.
6[WS => Shard 0] [HeartbeatTimer] Sending a heartbeat.
9[WS => Shard 0] Heartbeat acknowledged, latency of 35ms.
6[WS => Shard 0] [HeartbeatTimer] Sending a heartbeat.
9[WS => Shard 0] Heartbeat acknowledged, latency of 16ms.
:[WS => Shard 0] [RECONNECT] Discord asked us to reconnect
[WS => Shard 0] [DESTROY]
    Close Code    : 4000
    Reset         : false
    Emit DESTROYED: true
1[WS => Shard 0] Clearing the heartbeat interval.
Y[WS => Shard 0] [WebSocket] Destroy: Attempting to close the WebSocket. | WS State: OPEN
F[WS => Shard 0] [WebSocket] Close: Tried closing. | WS State: CLOSING
_[WS => Shard 0] [WebSocket] Adding a WebSocket close timeout to ensure a correct WS reconnect.
        Timeout: 5000ms
8[WS => Shard 0] [WebSocket] Clearing the close timeout.
[WS => Shard 0] [CLOSE]
    Event Code: 4000
    Clean     : true
    Reason    : 
L[WS => Shard 0] Session id is present, attempting an immediate reconnect...
[WS => Shard 0] [CONNECT]
+    Gateway    : wss://gateway.discord.gg/
    Version    : 10
    Encoding   : json
    Compression: none
1[WS => Shard 0] Setting a HELLO timeout for 20s.
&[WS => Shard 0] [CONNECTED] Took 47ms
,[WS => Shard 0] Clearing the HELLO timeout.
:[WS => Shard 0] Setting a heartbeat interval for 41250ms.
Q[WS => Shard 0] [RESUME] Session aa8e0524ef6731805234d556f902ba76, sequence 4283
4[WS => Shard 0] [INVALID SESSION] Resumable: false.
@[WS => Shard 0] Failed to connect to the gateway, requeueing...
@[WS => Manager] Shard Queue Size: 1; continuing in 5 seconds...
P[WS => Shard 0] An open connection was found, attempting an immediate identify.
9[WS => Shard 0] [IDENTIFY] Shard 0/1 with intents: 33283
1[WS => Shard 0] Clearing the heartbeat interval.
[WS => Shard 0] [CLOSE]
    Event Code: 4004
    Clean     : true
'    Reason    : Authentication failed.
%[WS => Shard 0] AuthenticationFailed
[WS => Manager] Couldn't reconnect or fetch information about the gateway. Error [TokenInvalid]: An invalid token was provided.
C[WS => Manager] Possible network error occurred. Retrying in 5s...

Package version

14

Node.js version

discord.js@14.3.0

Operating system

node v16.16.0

Priority this issue should have

High (immediate attention needed)

Which partials do you have configured?

No Partials

Which gateway intents are you subscribing to?

Guilds, GuildMembers, GuildMessages, MessageContent

I have tested this issue on a development release

No response

@Jiralite
Copy link
Member

Jiralite commented Sep 4, 2022

Duplicate of #8486.

@Jiralite Jiralite closed this as not planned Won't fix, can't repro, duplicate, stale Sep 4, 2022
@NeonWizard
Copy link

@Jiralite

Duplicate of #8486.

This is not a duplicate: #8486 exits with no error. This issue exits with an error.

@NeonWizard
Copy link

NeonWizard commented Oct 2, 2022

@Jiralite Just reminding you this issue is still incorrectly closed. This is a separate issue than #8486 and should be re-opened to prevent confusion for an already complicated bug. This issue in particular is a token expiration issue.

@Jiralite Jiralite reopened this Oct 4, 2022
@kodiakhq kodiakhq bot closed this as completed in #8927 Dec 14, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants