From 706ddbfbe976704fcd1d35fdb4f4a7856099185f Mon Sep 17 00:00:00 2001 From: Fletcher Boyd Date: Wed, 4 Sep 2013 21:31:07 +0800 Subject: [PATCH] Shortened mcstatus output. --- plugins/minecraft_status.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/plugins/minecraft_status.py b/plugins/minecraft_status.py index 1a07b9f..0d7c8cf 100755 --- a/plugins/minecraft_status.py +++ b/plugins/minecraft_status.py @@ -3,7 +3,7 @@ import json @hook.command(autohelp=False) -def mcstatus(inp, say=None): +def mcstatus(inp): """mcstatus -- Checks the status of various Mojang (the creators of Minecraft) servers.""" try: @@ -16,13 +16,18 @@ def mcstatus(inp, say=None): out = [] # use a loop so we don't have to update it if they add more servers + yes = [] + no = [] for server, status in data.items(): if status == "green": - out.append("{} is \x033\x02online\x02\x0f".format(server)) + yes.append(server) else: - out.append("{} is \x034\x02offline\x02\x0f".format(server)) - - return "\x0f" + ", ".join(out) + "." + no.append(server) + if yes: + out = "\x033\x02Online\x02\x0f: " + ", ".join(yes) + if no: + out += "\x034\x02Offline\x02\x0f: " + ", ".join(no) + return "\x0f" + out.replace(".mojang.com", ".mj").replace(".minecraft.net", ".mc") @hook.command("haspaid")