Skip to content

Commit

Permalink
added "features" field to BotInstallEvent
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Piskun <bigcat88@icloud.com>
  • Loading branch information
bigcat88 committed Feb 21, 2024
1 parent 09bec5e commit de610dc
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 @@ -26,13 +26,15 @@
namespace OCA\Talk\Events;

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

class BotInstallEvent extends Event {
public function __construct(
protected string $name,
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 de610dc

Please sign in to comment.