Skip to content

Commit

Permalink
feat(BotInstallEvent): Add "features" field to
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Piskun <[email protected]>
  • Loading branch information
bigcat88 committed Feb 21, 2024
1 parent 09bec5e commit 307a169
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/Events/BotInstallEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

namespace OCA\Talk\Events;

use OCA\Talk\Model\Bot;
use OCP\EventDispatcher\Event;

class BotInstallEvent extends Event {
Expand All @@ -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();
}
Expand All @@ -52,4 +54,8 @@ public function getUrl(): string {
public function getDescription(): string {
return $this->description;
}

public function getFeatures(): int {
return $this->features;
}
}
1 change: 1 addition & 0 deletions lib/Listener/BotListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down

0 comments on commit 307a169

Please sign in to comment.