Add Arrtrix runtime, config, onboarding, and webhook support
- Implement runtime package for bridge startup, config loading, and env overrides - Add onboarding package for management room welcome messages - Add matrixcmd package for command processing and help - Add webhook package with Radarr webhook support and validation - Extend connector config for webhooks and validation - Update default config and example config for new options - Add tests for new packages and config validation - Change database type default to sqlite3-fk-wal
This commit is contained in:
parent
eeedb5268a
commit
fe627f3aab
19 changed files with 1855 additions and 35 deletions
56
packages/arrtrix/pkg/onboarding/welcome_test.go
Normal file
56
packages/arrtrix/pkg/onboarding/welcome_test.go
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
package onboarding
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"maunium.net/go/mautrix/bridgev2/bridgeconfig"
|
||||
"maunium.net/go/mautrix/id"
|
||||
)
|
||||
|
||||
func TestComposeWelcomeMessageDefaults(t *testing.T) {
|
||||
out := composeWelcomeMessage(
|
||||
"Arrtrix",
|
||||
"!arr",
|
||||
id.UserID("@arrtrixbot:test"),
|
||||
bridgeconfig.ManagementRoomTexts{},
|
||||
false,
|
||||
true,
|
||||
)
|
||||
|
||||
for _, fragment := range []string{
|
||||
"Hello, I'm the Arrtrix bot.",
|
||||
"This room has been marked as your management room.",
|
||||
"Use `help` to see the commands available right now.",
|
||||
} {
|
||||
if !strings.Contains(out, fragment) {
|
||||
t.Fatalf("expected welcome output to contain %q, got:\n%s", fragment, out)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestComposeWelcomeMessageTemplateValues(t *testing.T) {
|
||||
out := composeWelcomeMessage(
|
||||
"Arrtrix",
|
||||
"!arr",
|
||||
id.UserID("@arrtrixbot:test"),
|
||||
bridgeconfig.ManagementRoomTexts{
|
||||
Welcome: "Welcome to $bridge.",
|
||||
WelcomeConnected: "Talk to $bot with $cmdprefix help.",
|
||||
AdditionalHelp: "Custom footer for $bridge.",
|
||||
},
|
||||
true,
|
||||
false,
|
||||
)
|
||||
|
||||
for _, fragment := range []string{
|
||||
"Welcome to Arrtrix.",
|
||||
"Use `!arr help` to see available commands in this room.",
|
||||
"Talk to @arrtrixbot:test with !arr help.",
|
||||
"Custom footer for Arrtrix.",
|
||||
} {
|
||||
if !strings.Contains(out, fragment) {
|
||||
t.Fatalf("expected templated welcome output to contain %q, got:\n%s", fragment, out)
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue