How to access commands in command palette with registerEvent

I am trying to create a plugin that automatically insert the date (using the insert date command) upon file creation, but I’m not aware of any particular Obsidian API that will allow me to access the command palette directly. My current code looks like

this.registerEvent(when file is created , () => {
// a statement that triggers a particular command in the command palette

How can I achieve this by filling in the middle statement?

Ser answer below:

It seems like I need the ID of the command I want to execute, what would be a way for me to find the ID of a command in the command palette? (the command I want to use does not come from a community plugin, so I won’t be able to access its source code

The list of commands has been in app.commands.commands, not sure if it’s changed recently, but if not the following answer should give you the commands:

I’ve used this in some answers related to pulling out the hotkeys related to commands, but that shouldn’t be needed in your case (and I’m not sure whether the last revamp of the hotkeys section has changed any of the underlying structure rendering those script malfunctioning).

Unfortunately, it does seem like has been deprecated (it doesn’t seem to work). Are there other ways possible?