check if commands initialized

is there a way to check if commands initialized or not
Solution:
is there a way to check if commands initialized or not
Jump to solution
14 Replies
Favna
Favna2y ago
what exactly do you mean with initialized? Are you talking about application commands being registered or not? Are you talking about commands being loaded by sapphire? Something else?
fenish
fenishOP2y ago
yes this text
fenish
fenishOP2y ago
fenish
fenishOP2y ago
fenish
fenishOP2y ago
im sending message when bot is ready but this comes later i want to send first this then my message
fenish
fenishOP2y ago
Spinel
Spinel2y ago
TL;DR: Do not use ts-node, use tsc-watch instead. We very strongly discourage using ts-node because it was never meant to be used for bots. ts-node is designed for REPL purposes. That's short for Read Eval Print Loop. Which means to read some code, dump it in an eval() statement, print the result, and loop. A discord bot is not that. A Discord bot sets up a permanent websocket connection to the discord server and connects to the rest gateway. There is read yes, but no eval, no print, and no loop. So what should you use instead? The most ideal way is to just use the watch flag of tsc (tsc --watch) and run node dist/index.js to run your bot, then cancel that process and restart it when you have changes that require restarting. You would open 2 terminal tabs, 1 in which you run tsc --watch and another in which you run the bot. This is in particular the most ideal way, because Discord has a limit to the amount of times you can login with your bot, or register commands, per day. Constantly logging in over and over again due to an auto-restarting process will get you close to that limit very quickly and once you exceed it, your development will be halted entirely for the current day. However, this can be quite tedious so a great package to use instead is tsc-watch.
fenish
fenishOP2y ago
aw how did u know that im using ts node
Favna
Favna2y ago
as for moving the message, that's not possible. There is also no point to it at all really. your screenshot says ts-node index.ts
fenish
fenishOP2y ago
no no i just asked if there is a way soemthng like if (client.CommandsLoaded()) smth like this
Favna
Favna2y ago
that's just the ready event.
fenish
fenishOP2y ago
okay then is there something like after ready or smth else i can just delay ik but just curious
Favna
Favna2y ago
other than that there's the ApplicationCommandRegistriesRegistered event which is when all the application commands are ready. All events are documented on our website: https://www.sapphirejs.dev/docs/Documentation/api-framework/#events Also if all these questions are just because you're having trouble with loading commands, refer to the big red blurb at the top of the guide that's there to be read: https://www.sapphirejs.dev/docs/Guide/getting-started/getting-started-with-sapphire
fenish
fenishOP2y ago
yea i can send my message in this event i just want because im using console inputs and it brokes at first cmd
Want results from more Discord servers?
Add your server