respondToSlack("Nie rozpoznaję tej komendy: `/{$request->command} {$request->text}`"); [$command] = explode(' ', $this->request->text ?? ""); $alternativeHandlers = $this->findAlternativeHandlers($command); if ($alternativeHandlers->count()) { $response->withAttachment($this->getCommandListAttachment($alternativeHandlers)); } if ($this->containsHelpHandler($alternativeHandlers)) { $response->withAttachment(Attachment::create() ->setText("Aby wyświetlić wszystkie komendy, napisz: `/toby pomoc`") ); } return $response; } protected function getCommandListAttachment(Collection $handlers): Attachment { $attachmentFields = $handlers ->map(function (SignatureHandler $handler) { return AttachmentField::create($handler->getFullCommand(), $handler->getDescription()); }) ->all(); return Attachment::create() ->setColor('warning') ->setTitle('Czy miałeś na myśli:') ->setFields($attachmentFields); } }