summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoas Schilling <213943+nickvergessen@users.noreply.github.com>2023-08-08 18:15:08 +0200
committerGitHub <noreply@github.com>2023-08-08 18:15:08 +0200
commit4be15ac6d204d4a6ee4ac36d6b6c003a26a037bf (patch)
treee1de7b03a1a517789f04f5c38a5ce1ec66286c52
parentc19a50c53e7209362f19646921a248a9de9b3152 (diff)
parent9e9fd955f5db251ec98c333fcbeb06c32c327da0 (diff)
Merge pull request #10139 from nextcloud/backport/9458/stable27
[stable27] 🐣 Start with implementing bots
-rw-r--r--.drone.jsonnet28
-rw-r--r--.drone.yml236
-rw-r--r--appinfo/info.xml8
-rw-r--r--appinfo/routes.php1
-rw-r--r--appinfo/routes/routesBotController.php58
-rw-r--r--composer.lock8
-rw-r--r--docs/occ.md103
-rw-r--r--lib/AppInfo/Application.php4
-rw-r--r--lib/Chat/ChatManager.php16
-rw-r--r--lib/Chat/Command/Listener.php8
-rw-r--r--lib/Chat/MessageParser.php30
-rw-r--r--lib/Chat/Parser/Command.php1
-rw-r--r--lib/Chat/Parser/SystemMessage.php14
-rw-r--r--lib/Chat/Parser/UserMention.php2
-rw-r--r--lib/Chat/ReactionManager.php30
-rw-r--r--lib/Chat/SystemMessage/Listener.php6
-rw-r--r--lib/Command/Bot/Install.php112
-rw-r--r--lib/Command/Bot/ListBots.php98
-rw-r--r--lib/Command/Bot/Remove.php68
-rw-r--r--lib/Command/Bot/Setup.php103
-rw-r--r--lib/Command/Bot/State.php83
-rw-r--r--lib/Command/Bot/Uninstall.php65
-rw-r--r--lib/Controller/BotController.php338
-rw-r--r--lib/Controller/ReactionController.php6
-rw-r--r--lib/Events/BotInstallEvent.php55
-rw-r--r--lib/Events/ChatEvent.php5
-rw-r--r--lib/Events/ChatParticipantEvent.php8
-rw-r--r--lib/Federation/CloudFederationProviderTalk.php4
-rw-r--r--lib/Listener/BotListener.php101
-rw-r--r--lib/Listener/CircleMembershipListener.php12
-rw-r--r--lib/Migration/Version18000Date20230504205823.php115
-rw-r--r--lib/Model/Attendee.php2
-rw-r--r--lib/Model/Bot.php52
-rw-r--r--lib/Model/BotConversation.php55
-rw-r--r--lib/Model/BotConversationMapper.php74
-rw-r--r--lib/Model/BotServer.php85
-rw-r--r--lib/Model/BotServerMapper.php104
-rw-r--r--lib/Model/Message.php6
-rw-r--r--lib/Service/BotService.php292
-rw-r--r--src/components/ConversationSettings/BotsSettings.vue183
-rw-r--r--src/components/ConversationSettings/ConversationSettingsDialog.vue36
-rw-r--r--src/constants.js8
-rw-r--r--src/services/botsService.js83
-rw-r--r--src/stores/bots.js73
-rw-r--r--tests/integration/features/bootstrap/CommandLineTrait.php11
-rw-r--r--tests/integration/features/bootstrap/FeatureContext.php88
-rw-r--r--tests/integration/features/chat/bots.feature106
-rwxr-xr-xtests/integration/run.sh10
-rw-r--r--tests/integration/spreedcheats/lib/Controller/ApiController.php12
-rw-r--r--tests/psalm-baseline.xml30
50 files changed, 2926 insertions, 110 deletions
diff --git a/.drone.jsonnet b/.drone.jsonnet
index 8e7b6e568..96e75d61d 100644
--- a/.drone.jsonnet
+++ b/.drone.jsonnet
@@ -1,8 +1,16 @@
## 1. Download/install drone binary:
-## curl -L https://github.com/harness/drone-cli/releases/latest/download/drone_linux_amd64.tar.gz | tar zx
+## curl -L https://github.com/harness/drone-cli/releases/latest/download/drone_linux_amd64.tar.gz | tar zx
## 2. Adjust the matrix as wished
-## 3. Run: ./drone jsonnet --stream --format yml
-## 4. Commit the result
+## 3. Transform jsonnet to yml:
+## ./drone jsonnet --stream --format yml
+## 4. Export your drone token and the server:
+## export DRONE_TOKEN=… export DRONE_SERVER=https://drone.nextcloud.com
+## 5. Sign off the changes:
+## ./drone sign nextcloud/spreed --save
+## 6. Copy the new signature from .drone.yml to `hmac` field in this file
+## 7. Transform jsonnet to yml again (to transfer the signature correctly):
+## ./drone jsonnet --stream --format yml
+## 8. Commit the result
local Pipeline(test_set, database, services) = {
kind: "pipeline",
@@ -16,6 +24,7 @@ local Pipeline(test_set, database, services) = {
APP_NAME: "spreed",
CORE_BRANCH: "stable27",
GUESTS_BRANCH: "master",
+ CSB_BRANCH: "main",
NOTIFICATIONS_BRANCH: "stable27",
DATABASEHOST: database
},
@@ -31,12 +40,11 @@ local Pipeline(test_set, database, services) = {
"cd ../..",
"./occ app:enable $APP_NAME",
"git clone --depth 1 -b $NOTIFICATIONS_BRANCH https://github.com/nextcloud/notifications apps/notifications",
- "./occ app:enable notifications"
- ] + (
- if test_set == "conversation" || test_set == "conversation-2" then [
- "git clone --depth 1 -b $GUESTS_BRANCH https://github.com/nextcloud/guests apps/guests"
- ] else []
- ) + [
+ "./occ app:enable --force notifications",
+ "git clone --depth 1 -b $GUESTS_BRANCH https://github.com/nextcloud/guests apps/guests",
+ "./occ app:enable --force guests",
+ "git clone --depth 1 -b $CSB_BRANCH https://github.com/nextcloud/call_summary_bot apps/call_summary_bot",
+ "./occ app:enable --force call_summary_bot",
"cd apps/$APP_NAME/tests/integration/",
"bash run.sh features/"+test_set
]
@@ -155,6 +163,6 @@ local PipelinePostgreSQL(test_set) = Pipeline(
{
kind: "signature",
- hmac: "42a9326446817e073491d2b887a20254394c1cc988640bc9df9b57f2ad445ff0"
+ hmac: "8a6c9dd22806c07b68b5d263748cf226693b847a9d4773e094ba549d98834dd5"
},
]
diff --git a/.drone.yml b/.drone.yml
index c10969232..6767270e4 100644
--- a/.drone.yml
+++ b/.drone.yml
@@ -18,12 +18,18 @@ steps:
- ./occ app:enable $APP_NAME
- git clone --depth 1 -b $NOTIFICATIONS_BRANCH https://github.com/nextcloud/notifications
apps/notifications
- - ./occ app:enable notifications
+ - ./occ app:enable --force notifications
+ - git clone --depth 1 -b $GUESTS_BRANCH https://github.com/nextcloud/guests apps/guests
+ - ./occ app:enable --force guests
+ - git clone --depth 1 -b $CSB_BRANCH https://github.com/nextcloud/call_summary_bot
+ apps/call_summary_bot
+ - ./occ app:enable --force call_summary_bot
- cd apps/$APP_NAME/tests/integration/
- bash run.sh features/callapi
environment:
APP_NAME: spreed
CORE_BRANCH: stable27
+ CSB_BRANCH: main
DATABASEHOST: sqlite
GUESTS_BRANCH: master
NOTIFICATIONS_BRANCH: stable27
@@ -55,12 +61,18 @@ steps:
- ./occ app:enable $APP_NAME
- git clone --depth 1 -b $NOTIFICATIONS_BRANCH https://github.com/nextcloud/notifications
apps/notifications
- - ./occ app:enable notifications
+ - ./occ app:enable --force notifications
+ - git clone --depth 1 -b $GUESTS_BRANCH https://github.com/nextcloud/guests apps/guests
+ - ./occ app:enable --force guests
+ - git clone --depth 1 -b $CSB_BRANCH https://github.com/nextcloud/call_summary_bot
+ apps/call_summary_bot
+ - ./occ app:enable --force call_summary_bot
- cd apps/$APP_NAME/tests/integration/
- bash run.sh features/chat
environment:
APP_NAME: spreed
CORE_BRANCH: stable27
+ CSB_BRANCH: main
DATABASEHOST: sqlite
GUESTS_BRANCH: master
NOTIFICATIONS_BRANCH: stable27
@@ -92,12 +104,18 @@ steps:
- ./occ app:enable $APP_NAME
- git clone --depth 1 -b $NOTIFICATIONS_BRANCH https://github.com/nextcloud/notifications
apps/notifications
- - ./occ app:enable notifications
+ - ./occ app:enable --force notifications
+ - git clone --depth 1 -b $GUESTS_BRANCH https://github.com/nextcloud/guests apps/guests
+ - ./occ app:enable --force guests
+ - git clone --depth 1 -b $CSB_BRANCH https://github.com/nextcloud/call_summary_bot
+ apps/call_summary_bot
+ - ./occ app:enable --force call_summary_bot
- cd apps/$APP_NAME/tests/integration/
- bash run.sh features/chat-2
environment:
APP_NAME: spreed
CORE_BRANCH: stable27
+ CSB_BRANCH: main
DATABASEHOST: sqlite
GUESTS_BRANCH: master
NOTIFICATIONS_BRANCH: stable27
@@ -129,12 +147,18 @@ steps:
- ./occ app:enable $APP_NAME
- git clone --depth 1 -b $NOTIFICATIONS_BRANCH https://github.com/nextcloud/notifications
apps/notifications
- - ./occ app:enable notifications
+ - ./occ app:enable --force notifications
+ - git clone --depth 1 -b $GUESTS_BRANCH https://github.com/nextcloud/guests apps/guests
+ - ./occ app:enable --force guests
+ - git clone --depth 1 -b $CSB_BRANCH https://github.com/nextcloud/call_summary_bot
+ apps/call_summary_bot
+ - ./occ app:enable --force call_summary_bot
- cd apps/$APP_NAME/tests/integration/
- bash run.sh features/command
environment:
APP_NAME: spreed
CORE_BRANCH: stable27
+ CSB_BRANCH: main
DATABASEHOST: sqlite
GUESTS_BRANCH: master
NOTIFICATIONS_BRANCH: stable27
@@ -166,13 +190,18 @@ steps:
- ./occ app:enable $APP_NAME
- git clone --depth 1 -b $NOTIFICATIONS_BRANCH https://github.com/nextcloud/notifications
apps/notifications
- - ./occ app:enable notifications
+ - ./occ app:enable --force notifications
- git clone --depth 1 -b $GUESTS_BRANCH https://github.com/nextcloud/guests apps/guests
+ - ./occ app:enable --force guests
+ - git clone --depth 1 -b $CSB_BRANCH https://github.com/nextcloud/call_summary_bot
+ apps/call_summary_bot
+ - ./occ app:enable --force call_summary_bot
- cd apps/$APP_NAME/tests/integration/
- bash run.sh features/conversation
environment:
APP_NAME: spreed
CORE_BRANCH: stable27
+ CSB_BRANCH: main
DATABASEHOST: sqlite
GUESTS_BRANCH: master
NOTIFICATIONS_BRANCH: stable27
@@ -204,13 +233,18 @@ steps:
- ./occ app:enable $APP_NAME
- git clone --depth 1 -b $NOTIFICATIONS_BRANCH https://github.com/nextcloud/notifications
apps/notifications
- - ./occ app:enable notifications
+ - ./occ app:enable --force notifications
- git clone --depth 1 -b $GUESTS_BRANCH https://github.com/nextcloud/guests apps/guests
+ - ./occ app:enable --force guests
+ - git clone --depth 1 -b $CSB_BRANCH https://github.com/nextcloud/call_summary_bot
+ apps/call_summary_bot
+ - ./occ app:enable --force call_summary_bot
- cd apps/$APP_NAME/tests/integration/
- bash run.sh features/conversation-2
environment:
APP_NAME: spreed
CORE_BRANCH: stable27
+ CSB_BRANCH: main
DATABASEHOST: sqlite
GUESTS_BRANCH: master
NOTIFICATIONS_BRANCH: stable27
@@ -242,12 +276,18 @@ steps:
- ./occ app:enable $APP_NAME
- git clone --depth 1 -b $NOTIFICATIONS_BRANCH https://github.com/nextcloud/notifications
apps/notifications
- - ./occ app:enable notifications
+ - ./occ app:enable --force notifications
+ - git clone --depth 1 -b $GUESTS_BRANCH https://github.com/nextcloud/guests apps/guests
+ - ./occ app:enable --force guests
+ - git clone --depth 1 -b $CSB_BRANCH https://github.com/nextcloud/call_summary_bot
+ apps/call_summary_bot
+ - ./occ app:enable --force call_summary_bot
- cd apps/$APP_NAME/tests/integration/
- bash run.sh features/federation
environment:
APP_NAME: spreed
CORE_BRANCH: stable27
+ CSB_BRANCH: main
DATABASEHOST: sqlite
GUESTS_BRANCH: master
NOTIFICATIONS_BRANCH: stable27
@@ -279,12 +319,18 @@ steps:
- ./occ app:enable $APP_NAME
- git clone --depth 1 -b $NOTIFICATIONS_BRANCH https://github.com/nextcloud/notifications
apps/notifications
- - ./occ app:enable notifications
+ - ./occ app:enable --force notifications
+ - git clone --depth 1 -b $GUESTS_BRANCH https://github.com/nextcloud/guests apps/guests
+ - ./occ app:enable --force guests
+ - git clone --depth 1 -b $CSB_BRANCH https://github.com/nextcloud/call_summary_bot
+ apps/call_summary_bot
+ - ./occ app:enable --force call_summary_bot
- cd apps/$APP_NAME/tests/integration/
- bash run.sh features/integration
environment:
APP_NAME: spreed
CORE_BRANCH: stable27
+ CSB_BRANCH: main
DATABASEHOST: sqlite
GUESTS_BRANCH: master
NOTIFICATIONS_BRANCH: stable27
@@ -316,12 +362,18 @@ steps:
- ./occ app:enable $APP_NAME
- git clone --depth 1 -b $NOTIFICATIONS_BRANCH https://github.com/nextcloud/notifications
apps/notifications
- - ./occ app:enable notifications
+ - ./occ app:enable --force notifications
+ - git clone --depth 1 -b $GUESTS_BRANCH https://github.com/nextcloud/guests apps/guests
+ - ./occ app:enable --force guests
+ - git clone --depth 1 -b $CSB_BRANCH https://github.com/nextcloud/call_summary_bot
+ apps/call_summary_bot
+ - ./occ app:enable --force call_summary_bot
- cd apps/$APP_NAME/tests/integration/
- bash run.sh features/sharing
environment:
APP_NAME: spreed
CORE_BRANCH: stable27
+ CSB_BRANCH: main
DATABASEHOST: sqlite
GUESTS_BRANCH: master
NOTIFICATIONS_BRANCH: stable27
@@ -353,12 +405,18 @@ steps:
- ./occ app:enable $APP_NAME
- git clone --depth 1 -b $NOTIFICATIONS_BRANCH https://github.com/nextcloud/notifications
apps/notifications
- - ./occ app:enable notifications
+ - ./occ app:enable --force notifications
+ - git clone --depth 1 -b $GUESTS_BRANCH https://github.com/nextcloud/guests apps/guests
+ - ./occ app:enable --force guests
+ - git clone --depth 1 -b $CSB_BRANCH https://github.com/nextcloud/call_summary_bot
+ apps/call_summary_bot
+ - ./occ app:enable --force call_summary_bot
- cd apps/$APP_NAME/tests/integration/
- bash run.sh features/sharing-2
environment:
APP_NAME: spreed
CORE_BRANCH: stable27
+ CSB_BRANCH: main
DATABASEHOST: sqlite
GUESTS_BRANCH: master
NOTIFICATIONS_BRANCH: stable27
@@ -404,12 +462,18 @@ steps:
- ./occ app:enable $APP_NAME
- git clone --depth 1 -b $NOTIFICATIONS_BRANCH https://github.com/nextcloud/notifications
apps/notifications
- - ./occ app:enable notifications
+ - ./occ app:enable --force notifications
+ - git clone --depth 1 -b $GUESTS_BRANCH https://github.com/nextcloud/guests apps/guests
+ - ./occ app:enable --force guests
+ - git clone --depth 1 -b $CSB_BRANCH https://github.com/nextcloud/call_summary_bot
+ apps/call_summary_bot
+ - ./occ app:enable --force call_summary_bot
- cd apps/$APP_NAME/tests/integration/
- bash run.sh features/callapi
environment:
APP_NAME: spreed
CORE_BRANCH: stable27
+ CSB_BRANCH: main
DATABASEHOST: mysql
GUESTS_BRANCH: master
NOTIFICATIONS_BRANCH: stable27
@@ -455,12 +519,18 @@ steps:
- ./occ app:enable $APP_NAME
- git clone --depth 1 -b $NOTIFICATIONS_BRANCH https://github.com/nextcloud/notifications
apps/notifications
- - ./occ app:enable notifications
+ - ./occ app:enable --force notifications
+ - git clone --depth 1 -b $GUESTS_BRANCH https://github.com/nextcloud/guests apps/guests
+ - ./occ app:enable --force guests
+ - git clone --depth 1 -b $CSB_BRANCH https://github.com/nextcloud/call_summary_bot
+ apps/call_summa