Generate AS registrations with bot sync workaround

Refer to tulir commit [47a1d7f]
This commit is contained in:
zhaoYangguang 2020-10-28 19:11:03 +08:00
parent c12ba3d64e
commit 488fa5aa1b
1 changed files with 6 additions and 0 deletions

View File

@ -33,6 +33,12 @@ func (config *Config) NewRegistration() (*appservice.Registration, error) {
config.AppService.ASToken = registration.AppToken config.AppService.ASToken = registration.AppToken
config.AppService.HSToken = registration.ServerToken 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 return registration, nil
} }