I have a close friend who I'm on very good terms with, and have no desire to lose them as a friend. ...But he is quick to become irritated or angry at little things. ...it can foul his mood literally for hours.
If you really want to be a true friend with this person, then you may need to accept his foul moods for hours on end for a while. You can't change him, especially if he doesn't see the problem and want to change it.
If you want to be a fair-weather friend with this person, then just sign off when his mood is affecting yours.
True friends can talk to one another about almost everything. If you're looking for a quip or pep talk which will change him for the better, I can't give you one. But if you really want to be his friend, have a heart to heart talk with him about his anger management issues (I wouldn't exactly use those words.)
Approach it from a perspective of 'is this right for you/how do you feel about this'? You might find out a lot. If he sees no problem whatsoever, and he's happy to hold on to his anger over slights, then decide where you want to go from there, including the possibility of telling him that his anger affects you, too, and you're not sure you want to be in his company for hours of it (if that's true.)
If he doesn't like his own behavior, there's a chance you can help him out of it. Do you know about his past? Is there a reason for his prolonged anger? Do you want him to just get over it, or are you committed to helping him? If you are, then discuss the problem from his perspective first, and ask him if he'd like your help in getting to a better place. Ask him what he thinks might work. Try that first. It may be that he needs validation of his feelings ("Yeah, that was a ------- thing to do."). It may be that it puts him in a bad place from his past. ("You're not in high school/whatever anymore. You don't have to worry about that stuff; you're wiser than that now.") Or whatever.
If it doesn't work, acknowledge that and try some new things, but read about anger and primary/secondary emotions first. Anger doesn't just appear. It is precipitated by something first: hurt. Maybe because he was disrespected, felt unvalued, felt powerless, something that in the moment is too painful to stay there, so it devolves into anger, which is easier to handle, because it's "other-directed". Dealing with this means dealing with the first feelings. I know nothing about gaming, but, for example, (and this is kind of superficial, but... this is actually how it's done)
You: What did you feel when he flamed you?
Him: Angry!
You: But why did you get angry?
Him: Because he shouldn't have done that!
You: Did he break a rule or was it just a ------- thing to do?
Him: It was -------.
You: And that made you feel...?
Him: Disrespected. Unimportant. Small.
You: Yes. People can do that. And you can let that ruin your next few hours, or you can recognize that people can do ------- things, and get on with being your own self. Don't give a stranger that kind of power over you.
It's talky and therapist-like, but friends do this sort of thing.
If he really needs help, quips and stuff won't change it. But he can take an anger management course (short and sweet and very effective) and that would be a great gift to himself. You can even gift him one, if that's the kind of friendship you have or develop.
Your call.
Edited to reflect information in comments: You've tried talking to him, and you know some of the reasons he's in a bad place when he feels disrespected. That's important. If "That's just how I am," is his response, you either accept it, or go out on a limb and tell him you don't feel good when he's angry (almost no one does) and you're trying to deal with it but find it really hard. "It's just the way I am" is only an excuse to avoid the painful work of facing your feelings of hurt, inadequacy, or whatever of the variety of feelings that make us human, and rise above them to a better place. If he says he doesn't want to be in a better place, ou have some decisions to make.