Browse Source

Fix small problems

master
sfan5 8 years ago
parent
commit
e0bd43f1d2
  1. 2
      forumutils.py
  2. 7
      server.py
  3. 2
      shortutils.py

2
forumutils.py

@ -15,7 +15,7 @@ def strip_number(nstr):
def forum_search_user(st, ignore_0posts=False, post_filter=-1):
st = st.replace(" ", "%20")
try:
bytes = web.get("https://forum.minetest.net/userlist.php?username=" + st)
bytes, sc = web.get("https://forum.minetest.net/userlist.php?username=" + st)
shim = '<tbody>'
shim2 = '</tbody>'
if shim in bytes and shim2 in bytes:

7
server.py

@ -4,7 +4,7 @@ server.py - Phenny Minetest Server Module
Copyright 2013, sfan5
"""
import web, json, random
import web, random
def by_random(tbl, arg):
return [random.randrange(0, len(tbl))]
@ -116,8 +116,9 @@ def server(phenny, input):
carg = a
cmds.append((choicefunc, carg))
text = web.get("http://servers.minetest.net/list")
server_list = json.loads(text)["list"]
text, sc = web.get("http://servers.minetest.net/list")
text = str(text, 'utf-8')
server_list = web.json(text)["list"]
prep_table = server_list
for i in range(0, len(cmds)):
choicefunc, carg = cmds[i]

2
shortutils.py

@ -40,7 +40,7 @@ next.commands = ['next']
def doge(phenny, input):
"""much wow, very function, such programming"""
if random.randint(0, 1) == 0:
data = web.get('http://pubapi.cryptsy.com/api.php?method=singlemarketdata&marketid=132')
data, sc = web.get('http://pubapi.cryptsy.com/api.php?method=singlemarketdata&marketid=132')
data = web.json(data)
phenny.say("DOGE is at " + data['return']['markets']['DOGE']['lasttradeprice'] + " BTC")
else:

Loading…
Cancel
Save