Refectored message generation to keep code DRY

Untested, because chatango apparently banned my server IP and I suck at Python.