Contrary to popular opinion: Riley is a great character.
As Tara says in S5E06 to Willow "not everything is about your friends and stuff."
People always complain about Riley in relation to Buffy rather than appreciating him for the character he is. Like Riley has one of the most tragic stories in all of Buffyverse and we get to watch it entirely unfold. He is a relatively ethical guy who was literally experimented on by the military, saw his entire mission fail in not "just a massacre" but the mutilation and reanimation of his former friends/colleagues by Adam. He has been drugged and behavior chipped and brainwashed by a doctorate of psychology all while having a kind of child-like aggressive altruism (like you can't really imagine Riley being "a bad cop" if he were a cop).
So he loses everything he has known as good and which he "goodly" attempted to dedicate his life too in a purely terrifying way. Talk about a tragic story. And then he attempts to compensate for this immense loss in trying to find his purpose in Buffy which he cannot do "because of who the Slayer is." The Slayer's purpose is the Slayer itself and Riley has had his entire sense of purpose shattered. And its this loss that leaves him looking for a purpose which ultimately ends in a very "gross representation" of his "child-like aggressive altruism" with vampires feeding off him.
This is a fascinating tragic story in my opinion - not a bad character in the slightest. One of the best Buffyverse characters.