Optimus Prime

Optimus Prime was the leader of that group of robots on TV called the Autobots. he was the thirteenth Prime after his predessecor went missing.

Cybertron
Optimus became a Prime after having the Matrix of Bois bestowed on him by a disembodied voice, like usual. He then became leader of the autobots, who fought the evil Decepticons, lead By Darth Megatron. Megs and Prime had many battles, prime winning most.

Soon, the decepticons left chbertron on their ship. The Autobots gave chase and shot then down, casuing them to crash on Ryloth. While on Ryloth, Shockwave took over command and exiled Darth Megatron and Starscream.

Shadow Minds And The Shadow Wars
Shockwave reformed the decepticons and united with Snoke and Thrawn, creating the Shadow Minds. They launched a hudge attack on the Autobots forcing the Autobots to combine with some Rebels to form The Unity Allies. This began the Shadow Wars.

Optimus fought at the Battle of Byss, the wars first encounter. He was forced to retreat when they were overwhelmed by Shadow Troopers. He later became leader of the Allies instead of Leia Organa Solo.

Optimus commanded the attack to free Nabooboo. They were able to capture the capital of Theed for a few days. Thrawn then bombed the capital, forcing the Allies out as the city fell around them. Optimus saved who he could but retreated with his team. They then went to the coffee machine to drown their sorrows in stuff that would keep them up.