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)
|
@hook.command(autohelp=False)
|
||||||
def mcstatus(inp, say=None):
|
def mcstatus(inp):
|
||||||
"""mcstatus -- Checks the status of various Mojang (the creators of Minecraft) servers."""
|
"""mcstatus -- Checks the status of various Mojang (the creators of Minecraft) servers."""
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -16,13 +16,18 @@ def mcstatus(inp, say=None):
|
||||||
|
|
||||||
out = []
|
out = []
|
||||||
# use a loop so we don't have to update it if they add more servers
|
# use a loop so we don't have to update it if they add more servers
|
||||||
|
yes = []
|
||||||
|
no = []
|
||||||
for server, status in data.items():
|
for server, status in data.items():
|
||||||
if status == "green":
|
if status == "green":
|
||||||
out.append("{} is \x033\x02online\x02\x0f".format(server))
|
yes.append(server)
|
||||||
else:
|
else:
|
||||||
out.append("{} is \x034\x02offline\x02\x0f".format(server))
|
no.append(server)
|
||||||
|
if yes:
|
||||||
return "\x0f" + ", ".join(out) + "."
|
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")
|
@hook.command("haspaid")
|
||||||
|
|
Reference in a new issue