> This works well in professional settings, but falls apart in certain online communities.
If you’re part of an online community where bad intentions are the norm, I’d recommend moving on to another. Why spend your time with a group that frequently makes you feel bad on purpose?
> How do you deal with people that don't have positive intentions, but actually have the precise opposite intentions
You move on to the third paragraph. Either ignore it (that can be tough, but the sooner you let it go and continue with your day the easier it becomes) or respectfully point out the problem. Try to have them not take it personally lest they become defensive and double down. The goal is deescalation. Speak specifically to the content of their message instead of them as a person. Use a variation of assuming good intentions: assume they are normally a good and reasonable person who is having a bad day and lashed out once. Empathise. Give them an out to apologise for their behaviour and they often will.
When that doesn’t work, reread your reply. Was it respectful and imbued with good intentions? Is it clear the goal was to improve the discourse? If not, learn from it and try again in another situation. But if you feel you did the best you could and the other party is being intransigent, let it go. Feel good about your effort. Even if you were unsuccessful with that particular individual, other people reading the exchange may take something positive out of it.
Be sure to never reply in anger. That only generates more conflict and ruins your day further. There’s no point to that.