diff --git a/edmond/plugins/wikipedia.py b/edmond/plugins/wikipedia.py index c8e8154..5d46427 100644 --- a/edmond/plugins/wikipedia.py +++ b/edmond/plugins/wikipedia.py @@ -42,13 +42,17 @@ class WikipediaPlugin(Plugin): retries = self.NUM_RETRIES while retries > 0: try: - summary = wikipedia.summary(wikipedia.random(), sentences=1) + page = wikipedia.page(title=wikipedia.random(), sentences=1) break except: # The wikipedia package can raise a lot of different stuff. pass retries -= 1 - if summary: - self.bot.say(event.target, summary) + if page: + if plus_plugin := self.bot.get_plugin("plus"): + def handler(plus_event): + self.bot.say(plus_event.target, page.url) + plus_plugin.add_handler(event.target, handler) + self.bot.say(event.target, page.summary) def tell_definition(self, event): page = None