Fixed formatting.

This commit is contained in:
Fletcher Boyd 2013-09-04 18:30:04 +08:00
parent 146ae3c279
commit 4069dd21a3
89 changed files with 615 additions and 496 deletions

View file

@ -1,5 +1,4 @@
from util import hook, http, web, text, timesince
from datetime import datetime
from util import hook, http, web, text
from bs4 import BeautifulSoup
import re
@ -54,7 +53,8 @@ def steamcalc(inp, nick='', db=None):
if inp.split(" ")[2] == "dontsave":
dontsave = True
url = http.prepare_url("http://steamdb.info/calculator/", {"player": inp, "currency": currency if currency else "us"})
url = http.prepare_url("http://steamdb.info/calculator/",
{"player": inp, "currency": currency if currency else "us"})
soup = http.get_soup(url)
out = u""
@ -64,7 +64,8 @@ def steamcalc(inp, nick='', db=None):
except Exception as e:
print e
return u"\x02Unable to retrieve info for %s!\x02 Is it a valid SteamCommunity profile username (%s)? " \
"Check if your profile is private, or go here to search: %s" % (inp, web.try_isgd("http://steamcommunity.com/id/%s" % inp), web.try_isgd(url))
"Check if your profile is private, or go here to search: %s" % (
inp, web.try_isgd("http://steamcommunity.com/id/%s" % inp), web.try_isgd(url))
nextone = False
status = "Unknown"
@ -73,7 +74,7 @@ def steamcalc(inp, nick='', db=None):
status = i.text
break
elif i.text == "Status":
nextone=True
nextone = True
if status == "Online":
status = "\x033\x02Online\x02\x0f"
elif status == "Offline":
@ -96,7 +97,8 @@ def steamcalc(inp, nick='', db=None):
nppercent = data[3].text.split(" ")[-1]
time = data[4].text.split(" ")[-1].replace("h", "hours")
out += " This account is worth \x02%s\x02, and they've spent \x02%s\x02 playing games! " % (money, time)
out += " They have \x02%s games\x02, but \x02%s of them haven't been touched\x02! That's \x02%s\x02! " % (totalgames, notplayed, nppercent)
out += " They have \x02%s games\x02, but \x02%s of them haven't been touched\x02! That's \x02%s\x02! " % (
totalgames, notplayed, nppercent)
if not dontsave:
db.execute("insert or replace into steam(nick, acc) values (?,?)", (nick.lower(), inp))