[ForumUtils] Fix Bugs
parent
3a0ad4f251
commit
a2c4dc20f5
|
@ -26,7 +26,8 @@ def forum_search_user(st, ignore_0posts=False, post_filter=-1):
|
||||||
idx = 0
|
idx = 0
|
||||||
while idx < len(l):
|
while idx < len(l):
|
||||||
try:
|
try:
|
||||||
if not(ignore_0posts and l[idx+2].firstChild.data == "0") or not(post_filter != -1 and int(strip_number([idx+2].firstChild.data)) == post_filter):
|
e = not( (ignore_0posts and l[idx+2].firstChild.data == "0") or (post_filter != -1 and int(strip_number(l[idx+2].firstChild.data)) != post_filter) )
|
||||||
|
if e:
|
||||||
users.append([l[idx].firstChild.firstChild.data,l[idx+1].firstChild.data,l[idx+2].firstChild.data,l[idx+3].firstChild.data,l[idx].firstChild.getAttribute("href").split("=")[1]])
|
users.append([l[idx].firstChild.firstChild.data,l[idx+1].firstChild.data,l[idx+2].firstChild.data,l[idx+3].firstChild.data,l[idx].firstChild.getAttribute("href").split("=")[1]])
|
||||||
idx += 4
|
idx += 4
|
||||||
except:
|
except:
|
||||||
|
@ -65,19 +66,20 @@ def search_forumuser(phenny, input):
|
||||||
post_filter = -1
|
post_filter = -1
|
||||||
if " " in arg:
|
if " " in arg:
|
||||||
a = arg.split(" ")
|
a = arg.split(" ")
|
||||||
|
_args_after_flag = 0
|
||||||
for i in range(0,len(a)):
|
for i in range(0,len(a)):
|
||||||
ar = a[i]
|
ar = a[i]
|
||||||
if ar == "-ignore0p":
|
if ar == "-ignore0p":
|
||||||
ignore_0posts = True
|
ignore_0posts = True
|
||||||
continue
|
|
||||||
elif ar.startswith("-p") and ar != "-p": # -p4
|
elif ar.startswith("-p") and ar != "-p": # -p4
|
||||||
try:
|
try:
|
||||||
post_filter = int(ar[2:])
|
post_filter = int(ar[2:])
|
||||||
except:
|
except:
|
||||||
return phenny.reply("Invalid Number")
|
return phenny.reply("Invalid Number")
|
||||||
if ar == "-p": # -p 4
|
elif ar == "-p": # -p 4
|
||||||
try:
|
try:
|
||||||
post_filter = int(a[i+1])
|
post_filter = int(a[i+1])
|
||||||
|
_args_after_flag = 1
|
||||||
except IndexError:
|
except IndexError:
|
||||||
return phenny.reply("Too few arguments")
|
return phenny.reply("Too few arguments")
|
||||||
except ValueError:
|
except ValueError:
|
||||||
|
@ -85,9 +87,12 @@ def search_forumuser(phenny, input):
|
||||||
except:
|
except:
|
||||||
return phenny.reply("Unknown Error")
|
return phenny.reply("Unknown Error")
|
||||||
else:
|
else:
|
||||||
arg = " ".join(a[i:]) # No more Flags found
|
if _args_after_flag > 0:
|
||||||
break
|
_args_after_flag -= 1
|
||||||
usrs = forum_search_user(arg,ignore_0posts=ignore_0posts)
|
else:
|
||||||
|
arg = " ".join(a[i+_args_after_flag:]) # No more Flags found
|
||||||
|
break
|
||||||
|
usrs = forum_search_user(arg,ignore_0posts=ignore_0posts,post_filter=post_filter)
|
||||||
if not type(usrs) == type([]):
|
if not type(usrs) == type([]):
|
||||||
return phenny.reply(usrs)
|
return phenny.reply(usrs)
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue