Change it back to this then, so as not to break anything else.
Code:
// Set default access
$userrole = ROLE_NOBODY ;
Having never used bot's I haven't really looked at how they work. I would guess they are being assigned the role of NOBODY and so getting blocked. I'll try and look before I go on Holiday, otherwise it will be towards the end of August before I return.