PEP8, lots of tweaks/fixes
This commit is contained in:
parent
641b770dc3
commit
508fec8ae8
29 changed files with 165 additions and 111 deletions
|
@ -12,13 +12,15 @@ def mcping_connect(host, port):
|
|||
sock.send('\xfe')
|
||||
response = sock.recv(1)
|
||||
if response != '\xff':
|
||||
return "Server gave invalid response: "+repr(response)
|
||||
return "Server gave invalid response: " + repr(response)
|
||||
length = struct.unpack('!h', sock.recv(2))[0]
|
||||
values = sock.recv(length*2).decode('utf-16be').split(u'\xa7')
|
||||
values = sock.recv(length * 2).decode('utf-16be').split(u'\xa7')
|
||||
sock.close()
|
||||
return "%s - %d/%d players" % (values[0], int(values[1]), int(values[2]))
|
||||
return "%s - %d/%d players"\
|
||||
% (values[0], int(values[1]), int(values[2]))
|
||||
except:
|
||||
return "Error pinging "+host+":"+str(port)+", is it up? Double-check your address!"
|
||||
return "Error pinging " + host + ":" + str(port) +\
|
||||
", is it up? Double-check your address!"
|
||||
|
||||
|
||||
@hook.command(autohelp=False)
|
||||
|
@ -29,33 +31,42 @@ def mcstatus(inp, bot=None):
|
|||
if password is None:
|
||||
return "error: no login set"
|
||||
|
||||
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():
|
||||
return "Minecraft login servers appear to be online!"
|
||||
else:
|
||||
return "Minecraft login servers appear to be offline!"
|
||||
|
||||
|
||||
@hook.command
|
||||
def mclogin(inp, say=None):
|
||||
".mclogin <username> <password> -- Attempts to log in to Minecrat with <username> and <password> (This is NOT logged)."
|
||||
".mclogin <username> <password> -- Attempts to log in to Minecraft with "\
|
||||
" <username> and <password> (This is NOT logged)."
|
||||
inp = inp.split(" ")
|
||||
username = inp[0]
|
||||
password = inp[1]
|
||||
say("Attempting to log in using " + 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():
|
||||
return "I logged in with " + username
|
||||
else:
|
||||
return "I couldn't log in using " + username + ", either the password is wrong or minecraft login servers are down!"
|
||||
return "I couldn't log in using " + username + ", either"\
|
||||
" the password is wrong or Minecraft login servers are down!"
|
||||
|
||||
|
||||
@hook.command
|
||||
def mcpaid(inp):
|
||||
".mcpaid <username> -- Checks if <username> has a premium Minecraft account."
|
||||
".mcpaid <username> -- Checks if <username> has a "\
|
||||
"premium Minecraft account."
|
||||
login = http.get("http://www.minecraft.net/haspaid.jsp?user=" + inp)
|
||||
if "true" in login:
|
||||
return "The account \'" + inp + "\' is a premium Minecraft account!"
|
||||
return "The account \'" + inp + "\' is a "\
|
||||
"premium Minecraft account!"
|
||||
else:
|
||||
return "The account \'" + inp + "\' is not a premium Minecraft account!"
|
||||
return "The account \'" + inp + "\' is not a "\
|
||||
"premium Minecraft account!"
|
||||
|
||||
from util import hook
|
||||
|
||||
|
|
Reference in a new issue