Fixed some things with wiki command
This commit is contained in:
@ -126,15 +126,21 @@ def findWikiPage(search : str):
|
|||||||
wikia.set_lang("da")
|
wikia.set_lang("da")
|
||||||
searchResults = wikia.search("senkulpa",search)
|
searchResults = wikia.search("senkulpa",search)
|
||||||
if len(searchResults) > 0:
|
if len(searchResults) > 0:
|
||||||
logThis("Found it")
|
try:
|
||||||
page = wikia.page("senkulpa",searchResults[0])
|
searchResult = searchResults[0].replace(",","%2C")
|
||||||
content = page.content.replace(u'\xa0', u' ').split("\n")[0]
|
logThis("Found it")
|
||||||
|
page = wikia.page("senkulpa",searchResult)
|
||||||
|
content = page.content.replace(u'\xa0', u' ').split("\n")[0]
|
||||||
|
|
||||||
images = page.images
|
images = page.images
|
||||||
if len(images) > 0:
|
if len(images) > 0:
|
||||||
return page.title, content, images[0]+"/revision/latest?path-prefix=da"
|
image = images[len(images)-1]+"/revision/latest?path-prefix=da"
|
||||||
else:
|
return page.title, content, image
|
||||||
return page.title, content, ""
|
else:
|
||||||
|
return page.title, content, ""
|
||||||
|
except:
|
||||||
|
logThis("Fucked up")
|
||||||
|
return "", "Sorry. Fucked that one up", ""
|
||||||
else:
|
else:
|
||||||
logThis("Couldn't find the page")
|
logThis("Couldn't find the page")
|
||||||
return "", "Couldn't find page", ""
|
return "", "Couldn't find page", ""
|
Reference in New Issue
Block a user