Our interactions online don't happen in a vacuum. They are to a decent degree an outcome of the real world we live in.
Sure, there's effects that are exclusive to the medium, like pseudo/anonymity, or related to the place, occasion and purpose of the interaction. But they are also influenced by our emotional state, personalities and life circumstances and everything that influences that in turn.
When you encounter people like that (they could be bots...) ask yourself what could be going on inside their heads. Are they on a mission? Are they in a bad spot and trying to cope? Are they trying to troll for amusement, fishing for attention?
A lot has been said about the internet becoming shittier and unfriendlier over time. Where it used to be (in my mind) an exuberant place to learn and meet new people or create entirely new culture, a third/fourth place outside the real world, we have seen that there's many more agendas at play. More eyeballs, surveillance, commercial interests, political influence, cheap entertainment and addiction. Too many cooks ruining the stew.
How do I deal with it? Use self-moderation if possible (e.g. I filter submissions by site, user and title on HN), find side alleys like special-purpose communities, save good stuff, so you don't forget what's possible (can't rely on search/recommendation engines or the permanence of anything anyway), and don't take it too seriously. I'm lucky to have been around for some time and know some older communities that are still going.
Online communication can be meaningful, intellectually and/or personally, but it doesn't come as easily as it used to. Everything is in flux. It's a shame, but it is what it is...
P.S.: If you get annoyed by HN comments from time to time, try http://n-gate.com. Doesn't seem to be active any longer, but it's still quite amusing.