announce.py 文件源码

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

项目:csss-minion 作者: henrymzhao 项目源码 文件源码
def em(self, ctx, *desc):
        """Make an embedded message
        Usage: em <body>
        Restricted command
        """
        author = ctx.message.author
        if author.permissions_in(ctx.message.channel).manage_channels or author.server_permissions.manage_channels:

            try:
                color = author.colour
            except Exception:
                color = discord.Colour(r.randrange(0xffffff))
            string = ""
            for w in desc:
                string += w + " "
            string = string.strip()
            embed = discord.Embed(description = string, color = color)
            #embed.set_thumbnail(url=author.avatar_url)
            embed.set_author(name=author.display_name, icon_url = author.avatar_url)
            await self.bot.say(embed = embed)
        try:
            await self.bot.delete_message(ctx.message)
        except Exception:
            #thats ok
            print("Not allowed to delete message")


    #@commands.command(pass_context = True)
    #async def allowedEmbed(self, ctx):
    #    #echoes permissions
    #    await self.bot.say(ctx.message.author.permissions_in(ctx.message.channel).manage_channels)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号