about.py 文件源码

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

项目:kitsuchan-2 作者: n303p4 项目源码 文件源码
def channelinfo(self, ctx, *, channel: discord.TextChannel=None):
        """Display information about a text channel.
        Defaults to the current channel.

        * channel - Optional argument. A specific channel to get information about."""

        # If channel is None, then it is set to ctx.channel.
        channel = channel or ctx.channel

        embed = discord.Embed(title=f"{channel.name}")

        try:
            embed.description = channel.topic
        except AttributeError:
            pass

        embed.add_field(name="Channel ID", value=channel.id)

        try:
            embed.add_field(name="Guild", value=channel.guild.name)
        except AttributeError:
            pass

        embed.add_field(name="Members", value=len(channel.members))
        embed.add_field(name="Created at", value=channel.created_at.ctime())

        if channel.is_nsfw():
            embed.set_footer(text="NSFW content is allowed for this channel.")

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


问题


面经


文章

微信
公众号

扫码关注公众号