Because You're Not Pretty Enough'

Amanda Bynes just inexplicably railed on Rihanna on Twitter, saying Chris Brown beat her because she's ugly ... but RiRi got the last word and it was AWESOME.

Bynes tweeted -- and quickly deleted -- "@rihanna Chris Brown beat you because you're not pretty enough."

She followed that up with another insult -- about wanting to name her dog Rihanna. It's unclear what set her off.

RiRi clearly got wind of the deleted tweets, because she just posted the BEST COMEBACK EVER:

Ya see what happens when they cancel Intervention? @rihanna

Don't mess with RiRi.

UPDATE 11:03 AM PT -- Amanda has already responded (and already deleted):