Don't sprintf with no arguments in Command.Reply

This commit is contained in:
Tulir Asokan 2023-04-04 21:43:23 +03:00
parent 099006c9c3
commit 7e738485ee

View File

@ -50,7 +50,10 @@ type Command struct {
type CommandAutocomplete Command type CommandAutocomplete Command
func (cmd *Command) Reply(message string, args ...interface{}) { func (cmd *Command) Reply(message string, args ...interface{}) {
cmd.Room.AddServiceMessage(fmt.Sprintf(message, args...)) if len(args) > 0 {
message = fmt.Sprintf(message, args...)
}
cmd.Room.AddServiceMessage(message)
cmd.UI.Render() cmd.UI.Render()
} }