
* #132 - added translations * wip * #132 - added translations * #132 - cs fix * #132 - cs fix Co-authored-by: Adrian Hopek <adrian.hopek@blumilk.pl>
36 lines
952 B
PHP
36 lines
952 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Toby\Infrastructure\Slack\Handlers;
|
|
|
|
use Spatie\SlashCommand\Handlers\BaseHandler;
|
|
use Spatie\SlashCommand\Request;
|
|
use Spatie\SlashCommand\Response;
|
|
use Toby\Infrastructure\Slack\Elements\Attachment;
|
|
use Toby\Infrastructure\Slack\Traits\ListsHandlers;
|
|
|
|
class CatchAll extends BaseHandler
|
|
{
|
|
use ListsHandlers;
|
|
|
|
public function canHandle(Request $request): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public function handle(Request $request): Response
|
|
{
|
|
$handlers = $this->findAvailableHandlers();
|
|
$attachmentFields = $this->mapHandlersToAttachments($handlers);
|
|
|
|
return $this->respondToSlack(__(":x: I don't recognize the command. List of all commands:"))
|
|
->withAttachment(
|
|
Attachment::create()
|
|
->setColor("danger")
|
|
->useMarkdown()
|
|
->setFields($attachmentFields),
|
|
);
|
|
}
|
|
}
|