diff --git a/lib/Events/BotInstallEvent.php b/lib/Events/BotInstallEvent.php index fa05c44194be..ffdda6d84dd9 100644 --- a/lib/Events/BotInstallEvent.php +++ b/lib/Events/BotInstallEvent.php @@ -26,6 +26,7 @@ namespace OCA\Talk\Events; use OCP\EventDispatcher\Event; +use OCA\Talk\Model\Bot; class BotInstallEvent extends Event { public function __construct( @@ -33,6 +34,7 @@ public function __construct( protected string $secret, protected string $url, protected string $description = '', + protected int $features = Bot::FEATURE_WEBHOOK + Bot::FEATURE_RESPONSE, ) { parent::__construct(); } @@ -52,4 +54,8 @@ public function getUrl(): string { public function getDescription(): string { return $this->description; } + + public function getFeatures(): int { + return $this->features; + } } diff --git a/lib/Listener/BotListener.php b/lib/Listener/BotListener.php index fe38b109f958..38ca7ba7baf0 100644 --- a/lib/Listener/BotListener.php +++ b/lib/Listener/BotListener.php @@ -108,6 +108,7 @@ protected function handleBotInstallEvent(BotInstallEvent $event): void { $bot->setUrl($event->getUrl()); $bot->setUrlHash(sha1($event->getUrl())); $bot->setState(Bot::STATE_ENABLED); + $bot->setFeatures($event->getFeatures()); $this->botServerMapper->insert($bot); } }