How does bot receives user command but hide message from public?

You can’t, basically

Users would have to whisper the bot
The bot may be able to reply to the whisper.

(Bots generally have problems with whispers as the whisper product is not designed for bots to use)

Basically chat doesn’t work for the use case you have described.