Merge branch 'main' into 'user-whitelisting'

# Conflicts:
#   bot/bot.go
This commit is contained in:
Slavi Pantaleev
2022-08-28 14:50:57 +00:00
8 changed files with 131 additions and 28 deletions

View File

@@ -256,11 +256,16 @@ func (b *Bot) setOption(ctx context.Context, name, value string) {
return
}
old := cfg.Get(name)
cfg.Set(name, value)
if name == optionMailbox {
value = fmt.Sprintf("%s@%s", value, b.domain)
cfg.Set(optionOwner, evt.Sender.String())
if old != "" {
b.rooms.Delete(old)
}
b.rooms.Store(value, evt.RoomID)
value = fmt.Sprintf("%s@%s", value, b.domain)
}
err = b.setSettings(evt.RoomID, cfg)