rename options, rename settings types
This commit is contained in:
@@ -13,7 +13,7 @@ func (b *Bot) runStop(ctx context.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
mailbox := cfg.Get(optionMailbox)
|
||||
mailbox := cfg.Get(roomOptionMailbox)
|
||||
if mailbox == "" {
|
||||
b.SendNotice(ctx, evt.RoomID, "that room is not configured yet")
|
||||
return
|
||||
@@ -21,7 +21,7 @@ func (b *Bot) runStop(ctx context.Context) {
|
||||
|
||||
b.rooms.Delete(mailbox)
|
||||
|
||||
err = b.setRoomSettings(evt.RoomID, roomsettings{})
|
||||
err = b.setRoomSettings(evt.RoomID, roomSettings{})
|
||||
if err != nil {
|
||||
b.Error(ctx, evt.RoomID, "cannot update settings: %v", err)
|
||||
return
|
||||
@@ -52,7 +52,7 @@ func (b *Bot) getOption(ctx context.Context, name string) {
|
||||
return
|
||||
}
|
||||
|
||||
if name == optionMailbox {
|
||||
if name == roomOptionMailbox {
|
||||
value = value + "@" + b.domain
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ func (b *Bot) setOption(ctx context.Context, name, value string) {
|
||||
}
|
||||
|
||||
evt := eventFromContext(ctx)
|
||||
if name == optionMailbox {
|
||||
if name == roomOptionMailbox {
|
||||
existingID, ok := b.GetMapping(value)
|
||||
if ok && existingID != "" && existingID != evt.RoomID {
|
||||
b.SendNotice(ctx, evt.RoomID, fmt.Sprintf("Mailbox `%s@%s` already taken, kupo", value, b.domain))
|
||||
@@ -83,8 +83,8 @@ func (b *Bot) setOption(ctx context.Context, name, value string) {
|
||||
old := cfg.Get(name)
|
||||
cfg.Set(name, value)
|
||||
|
||||
if name == optionMailbox {
|
||||
cfg.Set(optionOwner, evt.Sender.String())
|
||||
if name == roomOptionMailbox {
|
||||
cfg.Set(roomOptionOwner, evt.Sender.String())
|
||||
if old != "" {
|
||||
b.rooms.Delete(old)
|
||||
}
|
||||
@@ -98,7 +98,7 @@ func (b *Bot) setOption(ctx context.Context, name, value string) {
|
||||
return
|
||||
}
|
||||
|
||||
if name == optionMailbox {
|
||||
if name == roomOptionMailbox {
|
||||
value = value + "@" + b.domain
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user