File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -54,9 +54,9 @@ def moremod(text, chan):
5454 if text :
5555 try :
5656 index = int (text )
57- except :
57+ except ValueError :
5858 return "Please specify an integer value."
59- if abs (int ( index ) ) > len (search_pages [chan ]) or index == 0 :
59+ if abs (index ) > len (search_pages [chan ]) or index == 0 :
6060 return "please specify a valid page number between 1 and {}." .format (len (search_pages [chan ]))
6161 else :
6262 return "{}(page {}/{})" .format (search_pages [chan ][index - 1 ], index , len (search_pages [chan ]))
@@ -80,14 +80,14 @@ def moderates(text, chan):
8080 if r .status_code != 200 :
8181 return statuscheck (r .status_code , user )
8282 soup = BeautifulSoup (r .text )
83- try :
84- modlist = soup .find ('ul' , id = "side-mod-list" ).text
85- except :
83+ mod_list = soup .find ('ul' , id = "side-mod-list" )
84+ if mod_list is None :
8685 return "{} does not moderate any public subreddits." .format (user )
87- modlist = modlist .split ('r/' )
88- del modlist [0 ]
86+
87+ mod_list = mod_list .text .split ('r/' )
88+ del mod_list [0 ]
8989 out = "\x02 {}\x02 moderates these public subreddits: " .format (user )
90- for sub in modlist :
90+ for sub in mod_list :
9191 out += "{} \u2022 " .format (sub )
9292 out = out [:- 2 ]
9393 out = smart_truncate (out )
You can’t perform that action at this time.
0 commit comments