The problem here is that the PM Scanner can now scan chat messages as well so it has a new dependency on the chat plugin. But if you check it out as PM-Scanner then it is loaded before the chat plugin (because P comes before c in ASCII) and the ChatMessage class has not been loaded yet.
Just change the plugin installation code to
git clone https://github.com/worldismine/PM-Scanner discourse-pm-scanner and it will load after the chat plugin and be happy.