about.py 文件源码

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

项目:dogbot 作者: slice 项目源码 文件源码
def about(self, ctx):
        """Shows information about the bot."""

        git_revision = (await shell('git rev-parse --short HEAD')).strip()

        if self.maker is None:
            self.maker = discord.utils.get(self.bot.get_all_members(), id=ctx.bot.cfg["bot"]["owner_id"])

        birthday = self.bot.user.created_at.strftime(await ctx._('cmd.about.birthday'))
        github = ctx.bot.cfg["bot"]["github"]

        embed = discord.Embed(
            title=await ctx._('cmd.about.title'),
            description=await ctx._('cmd.about.description', maker=self.maker)
        )

        rev_link = f'[{git_revision}](https://github.com/{github}/commit/{git_revision})'

        # git revision
        embed.add_field(name=await ctx._('cmd.about.fields.git_rev'), value=rev_link)

        # github repo link
        embed.add_field(
            name=await ctx._('cmd.about.fields.github_repo'),
            value='[{0}](https://www.github.com/{0})'.format(github)
        )

        # birthday
        embed.add_field(name=await ctx._('cmd.about.fields.birthday'), value=birthday)

        # who made me?
        embed.set_author(name=f'{self.maker.name}#{self.maker.discriminator}', icon_url=self.maker.avatar_url)

        # information about python and discord.py
        pyversion = platform.python_version()
        version = discord.__version__
        embed.set_footer(
            text='Python {} \N{EM DASH} Discord.py {}'.format(pyversion, version),
            icon_url='http://i.imgur.com/v1dAbXi.png'
        )

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


问题


面经


文章

微信
公众号

扫码关注公众号