diff options
Diffstat (limited to 'bot/exts/evergreen/realpython.py')
| -rw-r--r-- | bot/exts/evergreen/realpython.py | 9 | 
1 files changed, 7 insertions, 2 deletions
| diff --git a/bot/exts/evergreen/realpython.py b/bot/exts/evergreen/realpython.py index e722dd4b..5d9e5c5c 100644 --- a/bot/exts/evergreen/realpython.py +++ b/bot/exts/evergreen/realpython.py @@ -33,7 +33,7 @@ class RealPython(commands.Cog):      @commands.cooldown(1, 10, commands.cooldowns.BucketType.user)      async def realpython(self, ctx: commands.Context, *, user_search: str) -> None:          """Send 5 articles that match the user's search terms.""" -        params = {"q": user_search, "limit": 5} +        params = {"q": user_search, "limit": 5, "kind": "article"}          async with self.bot.http_session.get(url=API_ROOT, params=params) as response:              if response.status != 200:                  logger.error( @@ -53,10 +53,15 @@ class RealPython(commands.Cog):              await ctx.send(embed=no_articles)              return +        if len(articles) == 1: +            article_description = "Here is the result:" +        else: +            article_description = f"Here are the top {len(articles)} results:" +          article_embed = Embed(              title="Search results - Real Python",              url=SEARCH_URL.format(user_search=quote_plus(user_search)), -            description="Here are the top 5 results:", +            description=article_description,              color=Colours.orange,          ) | 
