To see if the player's access level is LEADER:
$this -> bot -> security -> check_access($playername, "LEADER")
More info on BeBot's security system can be found in the wiki:
http://bebot.link/wiki/securityIf the user is executing a bot command, you will get the player's name from the command handler.
If you're writing a module that is watching everything going on in a channel you would have to write your own parser do deal with that. Regular Expressions would be the way to go.