Пример #1
0
 async def _listquotes(self, ctx: Context, *, query: str = None):
     """Retrieves a list of 10 random quotes that contain the query.
     """
     async with ctx.typing():
         quotes = await self.filter_quotes(ctx, query)
         rand.shuffle(quotes)
         selected = quotes[:min(len(quotes), 10)]
         await ctx.send(content=">>> " + '\n'.join(selected))
     await ctx.react(success)
Пример #2
0
 async def _randomquote(self, ctx: Context, *, query: str = None):
     """Retrieves a random quote that contains the query.
     """
     async with ctx.typing():
         quotes = await self.filter_quotes(ctx, query)
         if len(quotes) == 1:
             selected = quotes[0]
         else:
             selected = quotes[rand.randint(0, len(quotes) - 1)]
         await ctx.send(content='>>> ' + selected)
     await ctx.react(success)