示例#1
0
    async def random_(self, ctx):
        """Показать случайную цитату"""
        quote = Quote.select().order_by(fn.Random()).get()
        if not quote:
            return await ctx.send(f"В базе цитат пусто")

        message = f'Автор: **{self.bot.get_user(quote.author_id).name}**\n' \
                  f' - *"{quote.text}"*'
        await ctx.send(message)
示例#2
0
    async def list_(self, ctx):
        """Показать список всех цитат"""
        quotes = tuple(Quote.select())
        if not quotes:
            return await ctx.send(f"В базе цитат пусто")

        message = '\n\n'.join(
            f'Автор: **{self.bot.get_user(quote.author_id).name}**\n'
            f' - *"{quote.text}"*' for quote in quotes)
        await ctx.send(message)