/**
  * @param Request $request
  */
 protected function onMessage(Request $request)
 {
     $request->setServerManager($this);
     $isCommand = false;
     foreach ($this->commandRepository->all() as $command) {
         if ($command->handle($request)) {
             $isCommand = true;
             break;
         }
     }
     if ($this->container->getParameter('log_messages') || $isCommand) {
         $this->logger->debug(sprintf('%s <comment>[%s]</comment> <question>[%s/#%s]</question> <comment><@%s></comment> %s', $isCommand ? '<error>[Command]</error>' : '<info>[Message]</info>', (new \DateTime())->format('d/m/y H:i:s A'), $request->isPrivateMessage() ? 'Private Message' : $request->getServer()->name, $request->getChannel()->name, $request->getAuthor()->username, str_replace("\n", '\\n', $request->getContent())));
     }
 }