Application command registries

Before I switched to sapphire, I used to have my own system that tracked command registrations through caches and the db, and I'm wondering if I can re implement it. Is there a type of event that emits whenever a command is registered? By this I mean one that gives information like the logger does when it's set to the debug level/contains properties like the name, id, etc. I've attached an example from my previous setup just for a rough idea
No description
Solution:
have you considered adding @sapphire/plugin-logger? it already adds timestamps, colours, and sensible log levels.
Jump to solution
7 Replies
dan
dan3mo ago
Forgot to mention in the initial message but I did read the documentation and didn't see anything there
Favna
Favna3mo ago
Sapphire Framework
Registering Application Commands outside a Command | Sapphire
You are able to register your application commands inside of their command class, but also outside of the class! Whether
Favna
Favna3mo ago
That said, it should go without saying that it's more complex than letting sapphire handle it. Sapphire is optimized to make these things easy after all. I recommend considering strongly if your manual registration is really worth the effort.
dan
dan3mo ago
I see. Yeah I switched to sapphire so the registration and stuff would be easier. I can live without my custom logger, it's just that I got accustomed to it, that's all
Solution
Favna
Favna3mo ago
have you considered adding @sapphire/plugin-logger? it already adds timestamps, colours, and sensible log levels.
Favna
Favna3mo ago
and we could add a core listener that logs the information about the command being registered and move the logs there as opposed to inlining it in the registry I suppose (it's just a big chore because there are a bunch of different log lines which means a bunch of different new listeners and I would really rather like an interested party cough cough int hint to make a PR for this instead) (if it's a listener then a user can overwrite it by creating a listener of the same name) I read over this again and sapphire already logs info about command registration. On both debug and info levels. So if you add the plugin and set the log level accordingly you will get the info.
dan
dan3mo ago
OOp I didn't see these messages Yeah I ended up just using the logger plugin for the timestamps Yeah this is what I wanted to do initially I might make a pr soon but it depends on how quickly I'm able to finish this
Want results from more Discord servers?
Add your server