2011-11-21 12:24:23 +01:00
|
|
|
from util import hook, http
|
|
|
|
import string
|
2011-11-20 10:23:31 +01:00
|
|
|
|
2011-11-21 07:56:14 +01:00
|
|
|
@hook.command(autohelp=False)
|
2011-11-21 12:03:41 +01:00
|
|
|
def mcstatus(inp, bot=None):
|
2012-02-02 14:05:11 +01:00
|
|
|
".mcstatus - Attempts to log in to minecraft"
|
2012-02-24 04:17:59 +01:00
|
|
|
username = bot.config.get("api_keys", {}).get("mc_user", None)
|
|
|
|
password = bot.config.get("api_keys", {}).get("mc_pass", None)
|
2012-02-24 04:23:16 +01:00
|
|
|
if password is None:
|
|
|
|
return "error: no login set"
|
2012-02-24 04:17:59 +01:00
|
|
|
|
2011-11-21 12:24:23 +01:00
|
|
|
login = http.get("https://login.minecraft.net/?user="+username+"&password="+password+"&version=13")
|
|
|
|
if username.lower() in login.lower():
|
2011-11-21 12:27:14 +01:00
|
|
|
return "Minecraft login servers appear to be online!"
|
2011-11-20 10:23:31 +01:00
|
|
|
else:
|
2011-11-21 12:27:14 +01:00
|
|
|
return "Minecraft login servers appear to be offline :("
|
2011-11-20 10:23:31 +01:00
|
|
|
|
|
|
|
@hook.command
|
|
|
|
def mclogin(inp, say=None):
|
2012-02-02 14:05:11 +01:00
|
|
|
".mclogin <username> <password> - Attempts to log in to minecraft using the provided username and password, this is NOT logged."
|
2011-11-20 10:23:31 +01:00
|
|
|
inp = inp.split(" ")
|
|
|
|
username = inp[0]
|
|
|
|
password = inp[1]
|
|
|
|
say("Attempting to log in using " + username)
|
2011-11-21 12:24:23 +01:00
|
|
|
login = http.get("https://login.minecraft.net/?user=" + username + "&password=" + password + "&version=13")
|
|
|
|
if username.lower() in login.lower():
|
2011-11-20 10:23:31 +01:00
|
|
|
return "I logged in with " + username
|
|
|
|
else:
|
2011-11-21 12:27:14 +01:00
|
|
|
return "I couldn't log in using " + username + ", either the password is wrong or minecraft login servers are down D:"
|
2011-11-21 12:03:41 +01:00
|
|
|
|
|
|
|
@hook.command
|
|
|
|
def haspaid(inp):
|
2012-02-02 14:05:11 +01:00
|
|
|
".haspaid <username> - Checks if a user has a premium Minecraft account"
|
2011-11-21 12:24:23 +01:00
|
|
|
login = http.get("http://www.minecraft.net/haspaid.jsp?user=" + inp)
|
2011-11-21 12:03:41 +01:00
|
|
|
if "true" in login:
|
2011-11-21 12:24:23 +01:00
|
|
|
return "The account \'" + inp + "\' is a premium Minecraft account! :D"
|
2011-11-21 12:03:41 +01:00
|
|
|
else:
|
2011-11-21 12:24:23 +01:00
|
|
|
return "The account \'" + inp + "\' is not a premium Minecraft account :("
|
2011-11-21 12:03:41 +01:00
|
|
|
|