Hello, @gvolshebnik
You are welcome. So, there is no default way of deleting messages / posts using command line.
However, I came across an old post that explains the steps to delete old messages in this post.
I recommend you to attempt this on a staging / development instance first before applying them on the production to avoid unwanted data loss.