I think this scenario is more likely:
Psychotic saw who was PMing at night. Figured out that the person was a cop. Knew the other roles because he was mafia. He didn't know Magus was Jester so he couldn't have known all the roles. That's why I thought he was a cop at first, because I figured he had investigated a person, found out the doctor then through PMing found out mafia members.