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

@ -25,22 +25,23 @@ def getSoundInfo(url, inp, jsondata=False):
quote = inp
data = http.get_json(url + "list.php?" + urlencode({"quote": quote, "who": who}))
if len(data) > 3:
numresults = data[2]
newdata = data[3:]
text = newdata[0]["text"]
if "music" in url:
textsplit = text.split('"')
text = ""
for i in xrange(len(textsplit)):
if i%2 != 0 and i < 6:
if i % 2 != 0 and i < 6:
if text:
text += " / " + textsplit[i]
else:
text = textsplit[i]
if not jsondata:
return "%s - %s %s" % (newdata[0]["who"],
text if len(text) < 325 else text[:325]+"...",
web.try_isgd(url + newdata[0]["id"] if not dostream else url+"sound.php?id="+newdata[0]["id"]+"&stream"))
text if len(text) < 325 else text[:325] + "...",
web.try_isgd(
url + newdata[0]["id"] if not dostream else url + "sound.php?id=" + newdata[0][
"id"] + "&stream"))
else:
if not jsondata:
return "No results."
@ -49,50 +50,72 @@ def getSoundInfo(url, inp, jsondata=False):
@hook.command
def portal2(inp):
"""portal2 [who - ]<quote> - Look up Portal 2 quote. Example: .portal2 cave johnson - demand to see life's manager , .portal2 i own the place | If - is not included, no 'who' data will be sent."""
"""portal2 [who - ]<quote> - Look up Portal 2 quote.
Example: .portal2 cave johnson - demand to see life's manager,
.portal2 i own the place | If - is not included, no 'who' data will be sent."""
return getSoundInfo(portal2url, inp)
@hook.command
def portal2dlc(inp):
"""portal2dlc [who - ]<quote> - Look up Portal 2 DLC quote. Example: .portal2dlc1 glados - I lie when i'm nervous , .portal2 these exhibits are interactive | If - is not included, no 'who' data will be sent."""
"""portal2dlc [who - ]<quote> - Look up Portal 2 DLC quote.
Example: .portal2dlc1 glados - I lie when i'm nervous
.portal2 these exhibits are interactive
If - is not included, no 'who' data will be sent."""
return getSoundInfo(portal2dlc1url, inp)
@hook.command("portal2pti")
@hook.command
def portal2dlc2(inp):
"""portal2dlc2 [who - ]<quote> - Look up Portal 2 Perpetual Testing Inititive quote. Example: .portal2 glados - I lie when i'm nervous , .portal2dlc2 these exhibits are interactive | If - is not included, no 'who' data will be sent."""
"""portal2dlc2 [who - ]<quote> - Look up Portal 2 Perpetual Testing Inititive quote.
Example: .portal2 glados - I lie when i'm nervous
.portal2dlc2 these exhibits are interactive
If - is not included, no 'who' data will be sent."""
return getSoundInfo(portal2dlc2url, inp)
@hook.command
def portal2music(inp):
"""portal2music <title> - Look up Portal 2 music. Example: .portal2 turret opera , .portal2music want you gone | If - is not included, no 'title' data will be sent."""
"""portal2music <title> - Look up Portal 2 music.
Example: .portal2 turret opera
.portal2music want you gone
If - is not included, no 'title' data will be sent."""
return getSoundInfo(portal2musicurl, inp + " - ")
@hook.command('portal1')
@hook.command
def portal(inp):
"""portal [who - ]<quote> - Look up Portal quote. Example: .portal glados - the last thing you want to do is hurt me , .portal this is your fault | If - is not included, no 'who' data will be sent."""
"""portal [who - ]<quote> - Look up Portal quote.
Example: .portal glados - the last thing you want to do is hurt me
.portal this is your fault
If - is not included, no 'who' data will be sent."""
return getSoundInfo(portal1url, inp)
@hook.command('portal1music')
@hook.command
def portalmusic(inp):
"""portalmusic <title> - Look up Portal music. Example: .portalmusic still alive | If - is not included, no 'title' data will be sent."""
"""portalmusic <title> - Look up Portal music.
Example: .portalmusic still alive
If - is not included, no 'title' data will be sent."""
return getSoundInfo(portal1musicurl, inp + " - ")
@hook.command('tf2sound')
@hook.command
def tf2(inp):
"""tf2 [who - ]<quote> - Look up TF2 quote. Example: .tf2 spy - may i borrow your earpiece , .tf2 nom nom nom | If - is not included, no 'who' data will be sent."""
"""tf2 [who - ]<quote> - Look up TF2 quote.
Example: .tf2 spy - may i borrow your earpiece
.tf2 nom nom nom
If - is not included, no 'who' data will be sent."""
return getSoundInfo(tf2url, inp)
@hook.command
def tf2music(inp):
"""tf2music title - Look up TF2 music lyrics. Example: .tf2music rocket jump waltz | If - is not included, no 'title' data will be sent."""
"""tf2music title - Look up TF2 music lyrics.
Example: .tf2music rocket jump waltz
If - is not included, no 'title' data will be sent."""
return getSoundInfo(tf2musicurl, inp + " - ")