How to Detect Robot Type in automation process

I would like to know how to detect the Robot type in the code for the automation. Apologies if this has been covered elsewhere–I’m having trouble finding it if it has been.

For a simple example, is there some function I can call which will return something to let me know if the automation is running as Attended or Unattended? Ideally, I’d like to use this to write a generic process that can function differently depending on how it is being run.

If Attended … MessageBox…
Else Log Message…