announce.py 文件源码

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

项目:csss-minion 作者: henrymzhao 项目源码 文件源码
def announce(self, ctx, title, desc):
        """Make an announcement
        Usage: announce <title> <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))
            embed = discord.Embed(title = title, description = desc, color = color, timestamp = datetime.datetime.utcnow())
            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")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号