Shortened mcstatus output.

This commit is contained in:
Fletcher Boyd 2013-09-04 21:31:07 +08:00
parent d6bdf3ab38
commit 706ddbfbe9

View file

@ -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")