aboutsummaryrefslogtreecommitdiffstats
path: root/bot/exts/evergreen/wikipedia.py
diff options
context:
space:
mode:
authorGravatar Anubhav <[email protected]>2020-09-21 11:08:27 +0530
committerGravatar GitHub <[email protected]>2020-09-21 11:08:27 +0530
commite92deaab6c1d1a1e51526e97abe05ef325d10f22 (patch)
treeb3a8de5ca2673cda577282c89f613b42eeb88fb9 /bot/exts/evergreen/wikipedia.py
parentchanged chance_left -> retry_count, and tweak the code according to pure (diff)
Changed List[str]->Optional[List[str]]
Co-authored-by: PureFunctor <[email protected]>
Diffstat (limited to 'bot/exts/evergreen/wikipedia.py')
-rw-r--r--bot/exts/evergreen/wikipedia.py4
1 files changed, 1 insertions, 3 deletions
diff --git a/bot/exts/evergreen/wikipedia.py b/bot/exts/evergreen/wikipedia.py
index 205f5894..ab01e1ee 100644
--- a/bot/exts/evergreen/wikipedia.py
+++ b/bot/exts/evergreen/wikipedia.py
@@ -27,15 +27,13 @@ class WikipediaCog(commands.Cog):
titles = f'`{index}` [{titles}]({WIKIPEDIA_URL.format(title=titles.replace(" ", "_"))})'
return titles
- async def search_wikipedia(self, search_term: str) -> Optional[List[str]]:
+ async def search_wikipedia(self, search_term: str) -> List[str]:
"""Search wikipedia and return the first page found."""
async with self.http_session.get(SEARCH_API.format(search_term=search_term)) as response:
data = await response.json()
page = []
search_results = data["query"]["search"]
- if not search_results:
- return None
# Ignore pages with "may refer to"
for search_result in search_results: