First use shortcode

Hello everyone.

Perhaps this is a specific task, but I’ll ask you anyway. Is it possible to track the first use of shortcode and correct the behavior based on this attribute.

I have a shortcode that, in a simplified way, inserts such a construction , but at the first insert it is not logical to insert a closing tag, and at the last insert it is not logical to insert an opening tag.

Is it possible to somehow get in the shortcode itself what kind of shortcode it is?

Perhaps I found the answer to my question

Please let us know if it worked, I might need something similar.