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." But TMZ still got the screengrab.
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:
Don't mess with RiRi.