|
|
@ -40,7 +40,7 @@ class WikipediaPlugin(Plugin):
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
summary = wikipedia.summary(wikipedia.random(), sentences=1)
|
|
|
|
summary = wikipedia.summary(wikipedia.random(), sentences=1)
|
|
|
|
break
|
|
|
|
break
|
|
|
|
except wikipedia.exceptions.WikipediaException:
|
|
|
|
except: # The wikipedia package can raise a lot of different stuff.
|
|
|
|
pass
|
|
|
|
pass
|
|
|
|
retries -= 1
|
|
|
|
retries -= 1
|
|
|
|
if summary:
|
|
|
|
if summary:
|
|
|
@ -59,7 +59,7 @@ class WikipediaPlugin(Plugin):
|
|
|
|
except wikipedia.exceptions.PageError:
|
|
|
|
except wikipedia.exceptions.PageError:
|
|
|
|
summary = self.config["empty_response"]
|
|
|
|
summary = self.config["empty_response"]
|
|
|
|
break
|
|
|
|
break
|
|
|
|
except wikipedia.exceptions.WikipediaException:
|
|
|
|
except:
|
|
|
|
summary = self.bot.config["error_message"]
|
|
|
|
summary = self.bot.config["error_message"]
|
|
|
|
# Keep trying after a slight delay.
|
|
|
|
# Keep trying after a slight delay.
|
|
|
|
time.sleep(1)
|
|
|
|
time.sleep(1)
|
|
|
|