diff options
Diffstat (limited to 'bot/exts/evergreen/wikipedia.py')
| -rw-r--r-- | bot/exts/evergreen/wikipedia.py | 14 | 
1 files changed, 7 insertions, 7 deletions
| diff --git a/bot/exts/evergreen/wikipedia.py b/bot/exts/evergreen/wikipedia.py index 068c4f43..83937438 100644 --- a/bot/exts/evergreen/wikipedia.py +++ b/bot/exts/evergreen/wikipedia.py @@ -20,7 +20,7 @@ WIKI_THUMBNAIL = (      "https://upload.wikimedia.org/wikipedia/en/thumb/8/80/Wikipedia-logo-v2.svg"      "/330px-Wikipedia-logo-v2.svg.png"  ) -WIKI_SNIPPET_REGEX = r'(<!--.*?-->|<[^>]*>)' +WIKI_SNIPPET_REGEX = r"(<!--.*?-->|<[^>]*>)"  WIKI_SEARCH_RESULT = (      "**[{name}]({url})**\n"      "{description}\n" @@ -39,18 +39,18 @@ class WikipediaSearch(commands.Cog):          async with self.bot.http_session.get(url=url) as resp:              if resp.status == 200:                  raw_data = await resp.json() -                number_of_results = raw_data['query']['searchinfo']['totalhits'] +                number_of_results = raw_data["query"]["searchinfo"]["totalhits"]                  if number_of_results: -                    results = raw_data['query']['search'] +                    results = raw_data["query"]["search"]                      lines = []                      for article in results:                          line = WIKI_SEARCH_RESULT.format( -                            name=article['title'], +                            name=article["title"],                              description=unescape(                                  re.sub( -                                    WIKI_SNIPPET_REGEX, '', article['snippet'] +                                    WIKI_SNIPPET_REGEX, "", article["snippet"]                                  )                              ),                              url=f"https://en.wikipedia.org/?curid={article['pageid']}" @@ -72,7 +72,7 @@ class WikipediaSearch(commands.Cog):                  return      @commands.cooldown(1, 10, commands.BucketType.user) -    @commands.command(name="wikipedia", aliases=["wiki"]) +    @commands.command(name="wikipedia", aliases=("wiki",))      async def wikipedia_search_command(self, ctx: commands.Context, *, search: str) -> None:          """Sends paginated top 10 results of Wikipedia search.."""          contents = await self.wiki_request(ctx.channel, search) @@ -90,5 +90,5 @@ class WikipediaSearch(commands.Cog):  def setup(bot: Bot) -> None: -    """Wikipedia Cog load.""" +    """Load the WikipediaSearch cog."""      bot.add_cog(WikipediaSearch(bot)) | 
