fix a few errors and broken messages, random cleanup

This commit is contained in:
jacob1 2017-02-05 12:36:28 -05:00
parent 0a6c6200ab
commit 0ec0c5d73d
2 changed files with 28 additions and 33 deletions

View File

@ -115,7 +115,7 @@
"your_current_stasis": "You are currently in stasis for \u0002{0}\u0002 game{1}.", "your_current_stasis": "You are currently in stasis for \u0002{0}\u0002 game{1}.",
"you_not_in_stasis": "You are not currently in stasis.", "you_not_in_stasis": "You are not currently in stasis.",
"not_playing": "\u0002{0}\u0002 is not currently playing.", "not_playing": "\u0002{0}\u0002 is not currently playing.",
"invalid_mode": "\u0002{0}\u0002 is not a valid mode. Valid modes are: {1}", "ambiguous_mode": "\u0002{0}\u0002 is not a valid game mode. Valid modes are: {1}",
"simple_off": "You now no longer receive simple role instructions.", "simple_off": "You now no longer receive simple role instructions.",
"simple_on": "You now receive simple role instructions.", "simple_on": "You now receive simple role instructions.",
"not_logged_in": "You are not logged in to NickServ.", "not_logged_in": "You are not logged in to NickServ.",
@ -590,7 +590,7 @@
"command_scheduled": "The command \u0002{0}\u0002 has been scheduled to run after this game by \u0002{1}\u0002.", "command_scheduled": "The command \u0002{0}\u0002 has been scheduled to run after this game by \u0002{1}\u0002.",
"disable_new_games": "Creating a new game has now been disabled by \u0002{0}\u0002.", "disable_new_games": "Creating a new game has now been disabled by \u0002{0}\u0002.",
"stats_wait_for_game_end": "Wait until the game is over to view stats.", "stats_wait_for_game_end": "Wait until the game is over to view stats.",
"invalid_mode_no_list": "{0} is not a valid game mode.", "invalid_mode": "{0} is not a valid game mode.",
"integer_range": "Please enter an integer between {0} and {1}.", "integer_range": "Please enter an integer between {0} and {1}.",
"no_mode_specified": "No game mode specified. Available game modes: ", "no_mode_specified": "No game mode specified. Available game modes: ",
"admin_forced_game": "A game mode has already been forced by an admin.", "admin_forced_game": "A game mode has already been forced by an admin.",
@ -764,6 +764,7 @@
"matched_info": "You are \u0002in love\u0002 with ", "matched_info": "You are \u0002in love\u0002 with ",
"no_command_in_channel": "You cannot use this command in channel right now", "no_command_in_channel": "You cannot use this command in channel right now",
"no_such_role": "No such role: {0}", "no_such_role": "No such role: {0}",
"ambiguous_role": "Ambiguous role. Possible matches are: {0}.",
"available_modes": "Available game modes: \u0002", "available_modes": "Available game modes: \u0002",
"process_exited": "Process {0} exited with {1} {2}", "process_exited": "Process {0} exited with {1} {2}",
"already_up_to_date": "Already up-to-date.", "already_up_to_date": "Already up-to-date.",
@ -780,6 +781,7 @@
"villagergame_win": "Game over! The villagers come to their senses and realize there are actually no wolves, and live in harmony forevermore. Everybody wins.", "villagergame_win": "Game over! The villagers come to their senses and realize there are actually no wolves, and live in harmony forevermore. Everybody wins.",
"villagergame_nope": "Game over! The villagers decided incorrectly that there are actually no wolves, allowing the wolves to slaughter the remainder of them in their sleep with impunity.", "villagergame_nope": "Game over! The villagers decided incorrectly that there are actually no wolves, allowing the wolves to slaughter the remainder of them in their sleep with impunity.",
"stop_bot_ingame_safeguard": "Warning: A game is currently running. If you want to {what} the bot anyway, use \"{prefix}{cmd} -force\".", "stop_bot_ingame_safeguard": "Warning: A game is currently running. If you want to {what} the bot anyway, use \"{prefix}{cmd} -force\".",
"invalid_restart_mode": "\u0002{0}\u0002 is not a valid mode. Valid modes are: {1}",
"fwarn_usage": "Usage: fwarn list|view|add|del|set|help. See fwarn help <subcommand> for more details.", "fwarn_usage": "Usage: fwarn list|view|add|del|set|help. See fwarn help <subcommand> for more details.",
"warn_usage": "Usage: warn list|view|ack|help. See warn help <subcommand> for more details.", "warn_usage": "Usage: warn list|view|ack|help. See warn help <subcommand> for more details.",
"fwarn_list_syntax": "Usage: fwarn list [-all] [nick[!user@host]|=account] [page]", "fwarn_list_syntax": "Usage: fwarn list [-all] [nick[!user@host]|=account] [page]",

View File

@ -452,7 +452,7 @@ def restart_program(var, wrapper, message):
valid_modes = ("normal", "verbose", "debug") valid_modes = ("normal", "verbose", "debug")
if mode not in valid_modes: if mode not in valid_modes:
wrapper.pm(messages["invalid_mode"].format(mode, ", ".join(valid_modes))) wrapper.pm(messages["invalid_restart_mode"].format(mode, ", ".join(valid_modes)))
return return
msg += " in {0} mode".format(mode) msg += " in {0} mode".format(mode)
@ -6525,23 +6525,18 @@ def listroles(cli, nick, chan, rest):
#read game mode to get roles for #read game mode to get roles for
elif rest[0] and not rest[0].isdigit(): elif rest[0] and not rest[0].isdigit():
gamemode = rest[0] gamemode = rest[0]
if gamemode not in var.GAME_MODES.keys(): validgamemodes = var.GAME_MODES.keys() - {"roles", "villagergame"} - var.DISABLED_GAMEMODES
matches = complete_match(rest[0], var.GAME_MODES.keys() - {"roles", "villagergame"} - var.DISABLED_GAMEMODES) if gamemode not in validgamemodes:
matches = complete_match(rest[0], validgamemodes)
if len(matches) > 1: if len(matches) > 1:
reply(cli, nick, chan, nick + " " + messages["invalid_mode"].format(rest[0], ", ".join(matches))) reply(cli, nick, chan, nick + " " + messages["ambiguous_mode"].format(rest[0], ", ".join(matches)))
rest = []
roleindex = {}
return return
if len(matches) == 0: if len(matches) == 0:
reply(cli, nick, chan, nick + " " + messages["invalid_mode_no_list"].format(rest[0], ", ".join(matches))) reply(cli, nick, chan, messages["invalid_mode"].format(rest[0]))
rest = []
roleindex = {}
return return
else:
gamemode = matches[0] gamemode = matches[0]
validMode = gamemode in var.GAME_MODES.keys() and gamemode != "roles" and gamemode != "villagergame" and gamemode not in var.DISABLED_GAMEMODES if hasattr(var.GAME_MODES[gamemode][0](), "ROLE_GUIDE"):
if validMode and hasattr(var.GAME_MODES[gamemode][0](), "ROLE_GUIDE"):
mode = var.GAME_MODES[gamemode][0]() mode = var.GAME_MODES[gamemode][0]()
if hasattr(mode, "ROLE_INDEX") and hasattr(mode, "ROLE_GUIDE"): if hasattr(mode, "ROLE_INDEX") and hasattr(mode, "ROLE_GUIDE"):
roleindex = mode.ROLE_INDEX roleindex = mode.ROLE_INDEX
@ -6549,11 +6544,9 @@ def listroles(cli, nick, chan, rest):
elif gamemode == "default" and "ROLE_INDEX" in var.ORIGINAL_SETTINGS and "ROLE_GUIDE" in var.ORIGINAL_SETTINGS: elif gamemode == "default" and "ROLE_INDEX" in var.ORIGINAL_SETTINGS and "ROLE_GUIDE" in var.ORIGINAL_SETTINGS:
roleindex = var.ORIGINAL_SETTINGS["ROLE_INDEX"] roleindex = var.ORIGINAL_SETTINGS["ROLE_INDEX"]
roleguide = var.ORIGINAL_SETTINGS["ROLE_GUIDE"] roleguide = var.ORIGINAL_SETTINGS["ROLE_GUIDE"]
rest.pop(0)
else: else:
if validMode and not hasattr(var.GAME_MODES[gamemode][0](), "ROLE_GUIDE"):
msg.append("{0}: {1}roles is disabled for the {2} game mode.".format(nick, botconfig.CMD_CHAR, gamemode)) msg.append("{0}: {1}roles is disabled for the {2} game mode.".format(nick, botconfig.CMD_CHAR, gamemode))
else:
msg.append("{0}: {1} is not a valid game mode.".format(nick, rest[0]))
rest = [] rest = []
roleindex = {} roleindex = {}
@ -6737,10 +6730,10 @@ def game_stats(cli, nick, chan, rest):
if len(matches) == 1: if len(matches) == 1:
gamemode = matches[0] gamemode = matches[0]
if not matches: if not matches:
cli.notice(nick, messages["invalid_mode_no_list"].format(rest[0])) cli.notice(nick, messages["invalid_mode"].format(rest[0]))
return return
if len(matches) > 1: if len(matches) > 1:
cli.notice(nick, messages["invalid_mode"].format(rest[0], ", ".join(matches))) cli.notice(nick, messages["ambiguous_mode"].format(rest[0], ", ".join(matches)))
return return
rest.pop(0) rest.pop(0)
# Check for invalid input # Check for invalid input
@ -6813,9 +6806,9 @@ def player_stats(cli, nick, chan, rest):
reply(cli, nick, chan, messages["no_such_role"].format(role)) reply(cli, nick, chan, messages["no_such_role"].format(role))
return return
if len(matches) > 1: if len(matches) > 1:
reply(cli, nick, chan,nick, messages["invalid_mode"].format(role, ", ".join(matches))) reply(cli, nick, chan, messages["ambiguous_role"].format(", ".join(matches)))
return return
role = matches role = matches[0]
# Attempt to find the player's stats # Attempt to find the player's stats
reply(cli, nick, chan, db.get_player_stats(acc, hostmask, role)) reply(cli, nick, chan, db.get_player_stats(acc, hostmask, role))
@ -6835,10 +6828,10 @@ def vote_gamemode(var, wrapper, gamemode, doreply):
if gamemode not in var.GAME_MODES.keys(): if gamemode not in var.GAME_MODES.keys():
matches = complete_match(gamemode, var.GAME_MODES.keys() - {"roles", "villagergame"} - var.DISABLED_GAMEMODES) matches = complete_match(gamemode, var.GAME_MODES.keys() - {"roles", "villagergame"} - var.DISABLED_GAMEMODES)
if not matches: if not matches:
wrapper.pm(messages["invalid_mode_no_list"].format(gamemode)) wrapper.pm(messages["invalid_mode"].format(gamemode))
return return
if len(matches) > 1: if len(matches) > 1:
wrapper.pm(messages["invalid_mode"].format(gamemode, ", ".join(matches))) wrapper.pm(messages["ambiguous_mode"].format(gamemode, ", ".join(matches)))
return return
if len(matches) == 1: if len(matches) == 1:
gamemode = matches[0] gamemode = matches[0]
@ -7192,7 +7185,7 @@ if botconfig.DEBUG_MODE or botconfig.ALLOWED_NORMAL_MODE_COMMANDS:
gamemode = gamemode.split()[0] gamemode = gamemode.split()[0]
gamemode = complete_one_match(gamemode, var.GAME_MODES.keys() - var.DISABLED_GAMEMODES) gamemode = complete_one_match(gamemode, var.GAME_MODES.keys() - var.DISABLED_GAMEMODES)
if not gamemode: if not gamemode:
cli.notice(nick, messages["invalid_mode_no_list"].format(rest.split()[0])) cli.notice(nick, messages["invalid_mode"].format(rest.split()[0]))
return return
parts[0] = gamemode parts[0] = gamemode