diff --git a/config/bridge.go b/config/bridge.go index f7b3ba2..d4da810 100644 --- a/config/bridge.go +++ b/config/bridge.go @@ -33,6 +33,8 @@ type BridgeConfig struct { UsernameTemplate string `yaml:"username_template"` DisplaynameTemplate string `yaml:"displayname_template"` + ConnectionTimeout int `yaml:"connection_timeout"` + CommandPrefix string `yaml:"command_prefix"` Permissions PermissionConfig `yaml:"permissions"` diff --git a/user.go b/user.go index 8891eb3..27bbcca 100644 --- a/user.go +++ b/user.go @@ -145,7 +145,11 @@ func (user *User) Connect(evenIfNoSession bool) bool { return false } user.log.Debugln("Connecting to WhatsApp") - conn, err := whatsapp.NewConn(20 * time.Second) + timeout := time.Duration(user.bridge.Config.Bridge.ConnectionTimeout) + if timeout == 0 { + timeout = 20 + } + conn, err := whatsapp.NewConn(timeout * time.Second) if err != nil { user.log.Errorln("Failed to connect to WhatsApp:", err) return false