ApplicationCommandRegistry save new Command registered to DB
I want to save the idHints automatically in a Database, where can i intercept all new registered Commands with their respective idHint. I did try intercepting all events inside my Client with:
But i didnt find the Command Id in the file.
Solution:Jump to solution
I asked a similar question a little while ago (archived in <#1040783283157471292>). The solution I ended up with was to pull all the IDs from the commands store and then upload them to my DB about two minutes after the client is constructed. I also pulled them in from the DB before creating the client so that I could be sure they would be cached in a container property I setup before the commands themselves would be created.
7 Replies
https://github.com/sapphiredev/framework/blob/main/src/lib/utils/application-commands/ApplicationCommandRegistry.ts#L115
I am curious too if this is interceptable
Solution
I asked a similar question a little while ago (archived in <#1040783283157471292>). The solution I ended up with was to pull all the IDs from the commands store and then upload them to my DB about two minutes after the client is constructed. I also pulled them in from the DB before creating the client so that I could be sure they would be cached in a container property I setup before the commands themselves would be created.
Heres the code I used for updating the db: https://github.com/BenSegal855/Steve-V3/blob/dev/src/lib/extensions/SteveBoi.ts#L43-L65
For getting the IDs before startup: https://github.com/BenSegal855/Steve-V3/blob/dev/src/index.ts#L11
And actually using them in a command: https://github.com/BenSegal855/Steve-V3/blob/dev/src/commands/fun/roll.ts#L51
Cool, this needs to be a plug-in
Would be kinda difficult without also making a database plugin
Basically plugin can just provide the IDs in a json format to the user which they will decide how to store and upon startup they will have to feed the IDs, now this depends on them if it's a database or a json file
Thanks, i think this will work.
this is a good idea
but iam new to Sapphire, so i am not sure how to do it :D