mirror of
https://github.com/nextcloud/spreed.git
synced 2025-12-18 05:20:50 +01:00
Merge pull request #11630 from nextcloud/bot-install-event-features
feat(BotInstallEvent): Add "features" field
This commit is contained in:
commit
89e20d99c8
3 changed files with 8 additions and 0 deletions
|
|
@ -193,6 +193,7 @@ Dispatch this event in your app to install a bot on this server
|
|||
|
||||
* Event: `OCA\Talk\Events\BotInstallEvent`
|
||||
* Since: 17.0.0
|
||||
* Since: 19.0.0 - Features flag was added
|
||||
|
||||
### Bot uninstall
|
||||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Talk\Events;
|
||||
|
||||
use OCA\Talk\Model\Bot;
|
||||
use OCP\EventDispatcher\Event;
|
||||
|
||||
class BotInstallEvent extends Event {
|
||||
|
|
@ -33,6 +34,7 @@ class BotInstallEvent extends Event {
|
|||
protected string $secret,
|
||||
protected string $url,
|
||||
protected string $description = '',
|
||||
protected int $features = Bot::FEATURE_WEBHOOK | Bot::FEATURE_RESPONSE,
|
||||
) {
|
||||
parent::__construct();
|
||||
}
|
||||
|
|
@ -52,4 +54,8 @@ class BotInstallEvent extends Event {
|
|||
public function getDescription(): string {
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
public function getFeatures(): int {
|
||||
return $this->features;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -108,6 +108,7 @@ class BotListener implements IEventListener {
|
|||
$bot->setUrl($event->getUrl());
|
||||
$bot->setUrlHash(sha1($event->getUrl()));
|
||||
$bot->setState(Bot::STATE_ENABLED);
|
||||
$bot->setFeatures($event->getFeatures());
|
||||
$this->botServerMapper->insert($bot);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue