From 488fa5aa1be5858e0162967477faa97ddb941e6c Mon Sep 17 00:00:00 2001 From: zhaoYangguang <1163765691@qq.com> Date: Wed, 28 Oct 2020 19:11:03 +0800 Subject: [PATCH] Generate AS registrations with bot sync workaround Refer to tulir commit [47a1d7f] --- config/registration.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/config/registration.go b/config/registration.go index aa3b054..00922b7 100644 --- a/config/registration.go +++ b/config/registration.go @@ -33,6 +33,12 @@ func (config *Config) NewRegistration() (*appservice.Registration, error) { config.AppService.ASToken = registration.AppToken config.AppService.HSToken = registration.ServerToken + + // Workaround for https://github.com/matrix-org/synapse/pull/5758 + registration.SenderLocalpart = appservice.RandomString(32) + botRegex := regexp.MustCompile(fmt.Sprintf("^@%s:%s$", config.AppService.Bot.Username, config.Homeserver.Domain)) + registration.Namespaces.RegisterUserIDs(botRegex, true) + return registration, nil }