Yes. To manage this, go to Account > Who can send you private messages.
You can choose between three options: Everyone, Contacts only, or No one.
This allows you to protect your privacy and avoid unwanted messages.
You can change these settings at any time if you want to make your chat experience more open or more private.