The sixth moment of automorphic $L$-functions