clients.py 文件源码

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

项目:Harmonbot 作者: Harmon758 项目源码 文件源码
def embed_reply(self, content, *args, title = discord.Embed.Empty, title_url = discord.Embed.Empty, image_url = None, thumbnail_url = None, footer_text = discord.Embed.Empty, footer_icon_url = discord.Embed.Empty, timestamp = discord.Embed.Empty, fields = [], **kwargs):
        author = commands.bot._get_variable('_internal_author')
        destination = commands.bot._get_variable('_internal_channel')
        embed = discord.Embed(description = str(content) if content else None, title = title, url = title_url, timestamp = timestamp, color = bot_color)
        embed.set_author(name = author.display_name, icon_url = author.avatar_url or author.default_avatar_url)
        if image_url: embed.set_image(url = image_url)
        if thumbnail_url: embed.set_thumbnail(url = thumbnail_url)
        embed.set_footer(text = footer_text, icon_url = footer_icon_url)
        for field_name, field_value in fields:
            embed.add_field(name = field_name, value = field_value)
        extensions = ('delete_after',)
        params = {k: kwargs.pop(k, None) for k in extensions}
        coro = self.send_message(destination, embed = embed, *args, **kwargs)
        if destination.is_private or getattr(destination.permissions_for(destination.server.me), "embed_links", None):
            return self._augmented_msg(coro, embed = embed, **params)
        elif not (title or title_url or image_url or thumbnail_url or footer_text or timestamp):
            fmt = '{0.display_name}: {1}'.format(author, str(content))
            coro = self.send_message(destination, fmt, *args, **kwargs)
            return self._augmented_msg(coro, **params)
        else:
            permissions = ["embed_links"]
            raise errors.MissingCapability(permissions)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号