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

Calling client.destroy() doesn't make client.isReady() return false #9941

Closed
axl89 opened this issue Nov 12, 2023 · 2 comments · Fixed by #9942
Closed

Calling client.destroy() doesn't make client.isReady() return false #9941

axl89 opened this issue Nov 12, 2023 · 2 comments · Fixed by #9942

Comments

@axl89
Copy link

axl89 commented Nov 12, 2023

Which package is this bug report for?

discord.js

Issue description

  1. Log in with a Client with the login() function.
  2. Then call the destroy() function to this same client.
  3. And check that the isReady() function still returns true even though the client.ws.destroyed property is true.

Code sample

const { Client, GatewayIntentBits } = require('discord.js');

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

const main = async () => {
	await client.login();
	console.log(client.isReady());
	console.log(client.ws.destroyed);
	await client.destroy();
	console.log(client.isReady());
	console.log(client.ws.destroyed);
};

main();

Versions

  • discord.js@14.13.0
  • node v20.9.0
  • Linux cursed 6.2.0-36-generic Permission management #37~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Mon Oct 9 15:34:04 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

Issue priority

Low (slightly annoying)

Which partials do you have configured?

No Partials

Which gateway intents are you subscribing to?

Guilds, GuildMessages, GuildMessageReactions, MessageContent

I have tested this issue on a development release

No response

@Jiralite
Copy link
Member

Hey, thank you for the report. Just a note that your code sample is logically incorrect since awaiting client.login() will only return when the client has connected to the gateway and not when discord.js is ready. Utilising the ready event is the proper reproduction.

@axl89
Copy link
Author

axl89 commented Nov 13, 2023

Thanks @Jiralite, still learning my way through Javascript and this library! 😄

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 12, 2024
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.

2 participants