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('Did you mean:')->setFields($attachmentFields); }
/** * Show a list of all available handlers. * * @param Collection|SignatureHandler[] $handlers * @return Response */ protected function displayListOfAllCommands(Collection $handlers) : Response { $attachmentFields = $handlers->sort(function (SignatureHandler $handlerA, SignatureHandler $handlerB) { return strcmp($handlerA->getFullCommand(), $handlerB->getFullCommand()); })->map(function (SignatureHandler $handler) { return AttachmentField::create($handler->getFullCommand(), $handler->getDescription()); })->all(); return $this->respondToSlack('Available commands:')->withAttachment(Attachment::create()->setColor('good')->setFields($attachmentFields)); }
public function getResponse(Request $request) : Response { return Response::create($request)->withAttachment(Attachment::create()->setColor('danger')->setText($this->getMessage())->setFallback($this->getMessage())); }
public function getResponse(Request $request) : Response { return parent::getResponse($request)->withAttachment(Attachment::create()->setText($this->handler->getHelpDescription())); }