chat: Use a string instead of a bytes.Buffer

This commit is contained in:
UlisseMini 2019-01-25 12:32:57 -05:00 committed by Andrey Petrov
parent 9c918676ed
commit 4c968fc966

View File

@ -3,7 +3,6 @@ package chat
// FIXME: Would be sweet if we could piggyback on a cli parser or something. // FIXME: Would be sweet if we could piggyback on a cli parser or something.
import ( import (
"bytes"
"errors" "errors"
"fmt" "fmt"
"strings" "strings"
@ -210,16 +209,17 @@ func InitCommands(c *Commands) {
if cfg.Theme != nil { if cfg.Theme != nil {
theme = cfg.Theme.ID() theme = cfg.Theme.ID()
} }
var output bytes.Buffer var output string
fmt.Fprintf(&output, "Current theme: %s%s", theme, message.Newline) output += fmt.Sprintf("Current theme: %s%s", theme, message.Newline)
fmt.Fprintf(&output, " Themes available: ") output += " Themes available: "
for i, t := range message.Themes { for i, t := range message.Themes {
fmt.Fprintf(&output, t.ID()) output += t.ID()
if i < len(message.Themes)-1 { if i < len(message.Themes)-1 {
fmt.Fprintf(&output, ", ") output += ", "
} }
} }
room.Send(message.NewSystemMsg(output.String(), user)) room.Send(message.NewSystemMsg(output, user))
return nil return nil
} }