func (avalon *AvalonCommand) DoDisable(bot *models.Bot, msg *irc.Message) { err := avalon.IssuedByLobbyLeaderInGameChannel(msg) if err != nil { bot.Connection.RespondTo(msg, err.Error()) return } option := msg.Subsubcommand() if option == "" { bot.Connection.RespondTo(msg, availableOptionsString) return } err = avalon.game.DisableOption(option) if err != nil { bot.Connection.RespondTo(msg, err.Error()) } resp := fmt.Sprintf(configOptionsEnabledFormatString, avalon.game.ConfigStatus()) bot.Connection.RespondTo(msg, resp) }
func (avalon *AvalonCommand) DoInfo(bot *models.Bot, msg *irc.Message) { if avalon.game == nil { bot.Connection.RespondTo(msg, noActiveGameString) return } subsub := msg.Subsubcommand() switch subsub { case "": bot.Connection.RespondTo(msg, infoHelpString) case "game": resp := fmt.Sprintf(infoGameFormatString, avalon.lobbyLeader, avalon.channel) bot.Connection.RespondTo(msg, resp) case "players": plural := "" if avalon.game.NumPlayers() > 1 { plural = "s" } resp := fmt.Sprintf(infoPlayersFormatString, avalon.game.NumPlayers(), plural, avalon.game.ListPlayers()) bot.Connection.RespondTo(msg, resp) } }