From 612ae402e6aa066c3e439de50f5ac7c85c64a4e2 Mon Sep 17 00:00:00 2001 From: Luke Rogers Date: Tue, 22 Nov 2011 00:24:23 +1300 Subject: [PATCH] username no longer case-sensitive --- plugins/mctools.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/plugins/mctools.py b/plugins/mctools.py index dcbd464..0a63cf1 100644 --- a/plugins/mctools.py +++ b/plugins/mctools.py @@ -1,13 +1,15 @@ -from util import hook -import urllib +from util import hook, http +import string @hook.command(autohelp=False) def mcstatus(inp, bot=None): ".mcstatus - Attempts to log in to minecraft" username = bot.config["api_keys"]["mc_user"] password = bot.config["api_keys"]["mc_pass"] - login = urllib.urlopen("https://login.minecraft.net/?user="+username+"&password="+password+"&&version=13").read() - if username in login: + login = http.get("https://login.minecraft.net/?user="+username+"&password="+password+"&version=13") + print "Username: " + username + print "Response: " + login + if username.lower() in login.lower(): return "Attempting to connect to Minecraft login servers... Login servers appear to be online!" else: return "Attempting to connect to Minecraft login servers... Login servers appear to be offline :(" @@ -19,18 +21,18 @@ def mclogin(inp, say=None): username = inp[0] password = inp[1] say("Attempting to log in using " + username) - login = urllib.urlopen("https://login.minecraft.net/?user=" + username + "&password=" + password + "&&version=13").read() - if username in login: + 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 changed or minecraft auth is down :O" + return "I couldn't log in using " + username + ", either the password has been changed or minecraft auth is down :O" @hook.command def haspaid(inp): ".haspaid - Checks if a user has a premium Minecraft account" - login = urllib.urlopen("http://www.minecraft.net/haspaid.jsp?user=" + inp).read() + login = http.get("http://www.minecraft.net/haspaid.jsp?user=" + inp) if "true" in login: - return "The user " + inp + " has a premium Minecraft account." + return "The account \'" + inp + "\' is a premium Minecraft account! :D" else: - return "The user " + inp + " either has not paid or is an unused nickname." + return "The account \'" + inp + "\' is not a premium Minecraft account :("