diff options
author | 2020-09-21 13:21:44 +0530 | |
---|---|---|
committer | 2020-09-21 13:21:44 +0530 | |
commit | 74c737984b7a206941e87733f189f40e628b6eb0 (patch) | |
tree | 73bad44d386e97b0cfa4f8980f55fce436626409 | |
parent | changing and corrected linting (diff) |
changed page ->pages
Co-authored-by: Thomas Petersson <[email protected]>
-rw-r--r-- | bot/exts/evergreen/wikipedia.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/bot/exts/evergreen/wikipedia.py b/bot/exts/evergreen/wikipedia.py index 95311784..2ca5ac52 100644 --- a/bot/exts/evergreen/wikipedia.py +++ b/bot/exts/evergreen/wikipedia.py @@ -26,11 +26,12 @@ class WikipediaCog(commands.Cog): """Making formatted wikipedia link..""" return f'`{index}` [{titles}]({WIKIPEDIA_URL.format(title=titles.replace(" ", "_"))})' - async def search_wikipedia(self, search_term: str) -> Optional[List[str]]: - """Search wikipedia and return the first page found.""" + async def search_wikipedia(self, search_term: str) -> List[str]: + """Search wikipedia and return the first 10 pages found.""" async with self.http_session.get(SEARCH_API.format(search_term=search_term)) as response: data = await response.json() - page = [] + + pages = [] search_results = data["query"]["search"] @@ -38,9 +39,10 @@ class WikipediaCog(commands.Cog): for search_result in search_results: log.info("trying to append titles") if "may refer to" not in search_result["snippet"]: - page.append(search_result["title"]) + pages.append(search_result["title"]) + log.info("Finished appending titles") - return page + return pages @commands.cooldown(1, 10, commands.BucketType.user) @commands.command(name="wikipedia", aliases=["wiki"]) |