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:
emit(event, ...args) {
// save all events to a file
fs.appendFile('events.log', event + ' ' + JSON.stringify(args) + ' ' + new Date().toString() + ' ', (err) => { if (err) throw err; });

super.emit(event, ...args);
}
emit(event, ...args) {
// save all events to a file
fs.appendFile('events.log', event + ' ' + JSON.stringify(args) + ' ' + new Date().toString() + ' ', (err) => { if (err) throw err; });

super.emit(event, ...args);
}
But i didnt find the Command Id in the file.
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.
Jump to solution
7 Replies
Solution
Ben
Ben2y ago
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.
Krish
Krish2y ago
Cool, this needs to be a plug-in
Ben
Ben2y ago
Would be kinda difficult without also making a database plugin
Krish
Krish2y ago
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
DarkByteZero
DarkByteZero2y ago
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