trivia.py 文件源码

python
阅读 29 收藏 0 点赞 0 评论 0

项目:Chiaki-Nanami 作者: Ikusaba-san 项目源码 文件源码
def _show_question(self, n):
        question = self._current_question
        self._choices = question.choices

        leader = self.leader
        leader_text = f'{leader[0]} with {leader[1]} points' if leader else None
        description = self.category.description

        is_tf = question.type == 'boolean'
        tf_header = '**True or False**\n' * is_tf
        question_field = f'{tf_header}{question.question}'
        possible_answers = '\n'.join(itertools.starmap('{0}. {1}'.format, enumerate(self._choices, 1)))

        embed = (discord.Embed(description=description, colour=random.randint(0, 0xFFFFFF))
                 .set_author(name=self.category.name)
                 .add_field(name='Category', value=question.category, inline=False)
                 .add_field(name=f'Question #{n}', value=question_field, inline=False)
                 .set_footer(text=f'Current leader: {leader_text}')
                 )
        if not is_tf:
            embed.add_field(name='Possible answers', value=possible_answers, inline=True)

        await self.ctx.send(embed=embed)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号