quickembed.py 文件源码

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

项目:Sitryk-Cogs 作者: Sitryk 项目源码 文件源码
def qembed(self, ctx, text, color=None):
        """Used to make a quick embed

        {server} is ctx.message.server
        {author} is ctx.message.author
        {channel} is ctx.message.channel
        {message} is ctx.message
        {ctx} is ctx
        """

        if color is None:
            embed_color = self.colours[self.data["default_colour"]]()
        elif color.lower() not in self.colours:
            if color.startswith('#'):
                color = color[1:]
            try:
                if validhex(int(color, 16)):
                    embed_color = discord.Color(int(color, 16))
            except ValueError:
                await send_cmd_help(ctx)
                return
            if not validhex(int(color, 16)):
                await send_cmd_help(ctx)
                return
        else:
            embed_color = self.colours[color]()

        embed = discord.Embed(description=text.format(server=ctx.message.server, author=ctx.message.author, channel=ctx.message.channel, message=ctx.message, ctx=ctx), color=embed_color)
        await self.bot.say(embed=embed)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号