Shortened mcstatus output.
This commit is contained in:
parent
d6bdf3ab38
commit
706ddbfbe9
1 changed files with 10 additions and 5 deletions
|
@ -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")
|
||||
|
|
Reference in a new issue