what's the boolean in Client<boolean>?

i'm using typescript and i see that Client is a generic type that takes a boolean (sub)class what can i do with that?
6 Replies
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
</> Idris
</> Idris2y ago
whether the client is ready or not
monbrey
monbrey2y ago
You don't need to specify it manually. Using client.isReady() typeguards it, or discord.js will predefine it as ready in most events
Nutchapol
NutchapolOP2y ago
i've just thought to read the type definition file so it's like a discriminated union kind of thing? where TS knows that some properties exists depending on the value of Ready that's neat i've noticed that Client.user is tied to ready so you can't use discord.js to write applications w/o bot user?
Pulse
Pulse2y ago
there's probably not any documentation on that, pretty much everything expects you to be logged in as a bot user. and this isn't limited just to discord.js, there's likely very few discord APIs that allow requests without being logged in
monbrey
monbrey2y ago
You sort of can, but theres no reason to be using full discord.js if you dont intend to login

Did you find this page helpful?