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•2y ago
Message Not Public
Sign In & Join Server To View
whether the client is ready or not
You don't need to specify it manually. Using client.isReady() typeguards it, or discord.js will predefine it as ready in most events
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?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
You sort of can, but theres no reason to be using full discord.js if you dont intend to login