Add !mp settings single

This commit is contained in:
Giuseppe Guerra 2018-08-04 18:52:48 +02:00
parent 66acc12099
commit a456508ed3

View File

@ -1045,7 +1045,13 @@ def multiplayer(fro, chan, message):
def mpSettings(): def mpSettings():
_match = glob.matches.matches[getMatchIDFromChannel(chan)] _match = glob.matches.matches[getMatchIDFromChannel(chan)]
msg = "PLAYERS IN THIS MATCH:\n" single = False if len(message) < 2 else message[1].strip().lower() == "single"
msg = "PLAYERS IN THIS MATCH "
if not single:
msg += "(use !mp settings single for a single-line version):"
msg += "\n"
else:
msg += ": "
empty = True empty = True
for slot in _match.slots: for slot in _match.slots:
if slot.user is None: if slot.user is None:
@ -1061,14 +1067,16 @@ def multiplayer(fro, chan, message):
else: else:
readableStatus = readableStatuses[slot.status] readableStatus = readableStatuses[slot.status]
empty = False empty = False
msg += "* [{team}] <{status}> ~ {username}{mods}\n".format( msg += "* [{team}] <{status}> ~ {username}{mods}{nl}".format(
team="red" if slot.team == matchTeams.RED else "blue" if slot.team == matchTeams.BLUE else "!! no team !!", team="red" if slot.team == matchTeams.RED else "blue" if slot.team == matchTeams.BLUE else "!! no team !!",
status=readableStatus, status=readableStatus,
username=glob.tokens.tokens[slot.user].username, username=glob.tokens.tokens[slot.user].username,
mods=" (+ {})".format(generalUtils.readableMods(slot.mods)) if slot.mods > 0 else "" mods=" (+ {})".format(generalUtils.readableMods(slot.mods)) if slot.mods > 0 else "",
nl=" | " if single else "\n"
) )
if empty: if empty:
msg += "Nobody.\n" msg += "Nobody.\n"
msg = msg.rstrip(" | " if single else "\n")
return msg return msg
def mpScoreV(): def mpScoreV():