Modernising

This commit is contained in:
Luke Rogers 2012-05-15 10:16:41 +12:00
parent 562fa4551c
commit b22f20d8ac

View file

@ -31,8 +31,9 @@ def mcstatus(inp, bot=None):
if password is None: if password is None:
return "error: no login set" return "error: no login set"
login = http.get("https://login.minecraft.net/?user="\ login = http.get("https://login.minecraft.net/", user=username,
+ username + "&password=" + password + "&version=13") password=password, version=13)
if username.lower() in login.lower(): if username.lower() in login.lower():
return "Minecraft login servers appear to be online!" return "Minecraft login servers appear to be online!"
else: else:
@ -41,34 +42,33 @@ def mcstatus(inp, bot=None):
@hook.command @hook.command
def mclogin(inp, say=None): def mclogin(inp, say=None):
".mclogin <username> <password> -- Attempts to log in to Minecraft with "\ ".mclogin <username> <password> -- Attempts to log in to Minecraft with" \
" <username> and <password> (This is NOT logged)." " <username> and <password> (This is NOT logged)."
inp = inp.split(" ") inp = inp.split(" ")
username = inp[0] username = inp[0]
password = inp[1] password = inp[1]
say("Attempting to log in using " + username) say("Attempting to log in using %s." % username)
login = http.get("https://login.minecraft.net/?user="\
+ username + "&password=" + password + "&version=13") login = http.get("https://login.minecraft.net/", user=username,
password=password, version=13)
if username.lower() in login.lower(): if username.lower() in login.lower():
return "I logged in with " + username return "I logged in with %s" % username
else: else:
return "I couldn't log in using " + username + ", either"\ return "I couldn't log in using %s, either the password is wrong or " \
" the password is wrong or Minecraft login servers are down!" "Minecraft login servers are down!"
@hook.command @hook.command
def mcpaid(inp): def mcpaid(inp):
".mcpaid <username> -- Checks if <username> has a "\ ".mcpaid <username> -- Checks if <username> has a" \
"premium Minecraft account." " premium Minecraft account."
login = http.get("http://www.minecraft.net/haspaid.jsp?user=" + inp) login = http.get("http://www.minecraft.net/haspaid.jsp", user=inp)
if "true" in login:
return "The account \'" + inp + "\' is a "\
"premium Minecraft account!"
else:
return "The account \'" + inp + "\' is not a "\
"premium Minecraft account!"
from util import hook if "true" in login:
return 'The account "%s" is a premium Minecraft account!' % inp
else:
return 'The account "%s" is not a premium Minecraft account!' % inp
@hook.command @hook.command