def wikipedia(self, ctx, *text):
"""Wikipedia search."""
if text == ():
await send_cmd_help(ctx)
return
else:
s = "_";
search = ""
search = s.join(text)
user = ctx.message.author
wikiLang = 'en'# Define the Wikipedia language / Most of these are supported » https://nl.wikipedia.org/wiki/ISO_3166-1
ws = None
wikipedia.set_lang(wikiLang)# Set the Wikipedia language.
try:
ws = wikipedia.page(search)
wikiUrl = (ws.url.encode('ascii', 'xmlcharrefreplace'))
await self.bot.say(wikiUrl.decode("utf8"))
except:
await self.bot.say( 'Sorry {}, no wiki hit, try to rephrase'.format(user))
评论列表
文章目录