Get rid of various duplicated optionMailbox formatting
`formatOptionValue` takes care of these now. Besides fixing the duplication, this also fixes the lint error affecting `sendHelp` - high complexity.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package bot
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
@@ -118,3 +119,15 @@ func (b *Bot) getSettings(roomID id.RoomID) (settings, error) {
|
||||
func (b *Bot) setSettings(roomID id.RoomID, cfg settings) error {
|
||||
return b.lp.GetClient().SetRoomAccountData(roomID, settingskey, cfg)
|
||||
}
|
||||
|
||||
func (b *Bot) formatOptionValue(name string, value string) string {
|
||||
if value == "" {
|
||||
return value
|
||||
}
|
||||
|
||||
if name == optionMailbox {
|
||||
value = fmt.Sprintf("%s@%s", value, b.domain)
|
||||
}
|
||||
|
||||
return value
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user