From 10f44e621dbd2c02752793245597bce323467207 Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Fri, 26 Aug 2022 07:46:50 +0300 Subject: [PATCH 1/3] Format option value as code --- bot/command.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot/command.go b/bot/command.go index a77f765..721d989 100644 --- a/bot/command.go +++ b/bot/command.go @@ -197,7 +197,7 @@ func (b *Bot) getOption(ctx context.Context, name string) { } func (b *Bot) setOption(ctx context.Context, name, value string) { - msg := "`%s` of this room set to %s" + msg := "`%s` of this room set to `%s`" sanitizer, ok := sanitizers[name] if ok { From 5c443ec7aa58d280dc9a0c0997e8bdfe3ff9b4b9 Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Fri, 26 Aug 2022 09:58:25 +0300 Subject: [PATCH 2/3] Format options as code in getOption as well This is like 10f44e621dbd2 (which handled `setOption()`), but for `getOption()`. --- bot/command.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot/command.go b/bot/command.go index 721d989..b0336a6 100644 --- a/bot/command.go +++ b/bot/command.go @@ -174,7 +174,7 @@ func (b *Bot) handleOption(ctx context.Context, command []string) { } func (b *Bot) getOption(ctx context.Context, name string) { - msg := "`%s` of this room is %s" + msg := "`%s` of this room is `%s`" evt := eventFromContext(ctx) cfg, err := b.getSettings(evt.RoomID) From a8e8b23174e112bbe5c8388b6ff99822bd1518b3 Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Fri, 26 Aug 2022 09:58:57 +0300 Subject: [PATCH 3/3] Make sure mailbox value is formatted correctly in getOption/setOption --- bot/command.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bot/command.go b/bot/command.go index b0336a6..1c399bb 100644 --- a/bot/command.go +++ b/bot/command.go @@ -190,7 +190,7 @@ func (b *Bot) getOption(ctx context.Context, name string) { } if name == optionMailbox { - msg = msg + "@" + b.domain + value = fmt.Sprintf("%s@%s", value, b.domain) } b.Notice(ctx, evt.RoomID, fmt.Sprintf(msg, name, value)) @@ -226,7 +226,7 @@ func (b *Bot) setOption(ctx context.Context, name, value string) { cfg.Set(name, value) if name == optionMailbox { - msg = msg + "@" + b.domain + value = fmt.Sprintf("%s@%s", value, b.domain) cfg.Set(optionOwner, evt.Sender.String()) b.rooms.Store(value, evt.RoomID) }