【问题标题】:Why does this Embed.set_footer call fail in my Discord bot?为什么这个 Embed.set_footer 调用在我的 Discord 机器人中失败?
【发布时间】:2020-12-31 15:09:47
【问题描述】:

我使用以下方法通过嵌入发送几乎所有机器人输出:

async def show_message_embed(self, ctx: commands.Context, message, title=None):
    if title is None:
        title = f"Command Output"
    em = discord.Embed(title=title, description="```\n" + message + "\n```", colour=0xBD362F)
    #em.set_footer("ChatNote (c) 2020 Erisia")
    em.timestamp = datetime.utcnow()
    await ctx.send(embed=em)

#em.set_footer 行已被注释掉,因为如果我取消注释,我会收到以下错误消息:

TypeError: set_footer() takes 1 positional argument but 2 were given

对我来说,很明显,我只传递了 1 个位置参数——唯一的参数,那么这里有什么问题?

【问题讨论】:

    标签: python discord bots discord.py chatbot


    【解决方案1】:

    set_footertext 作为参数和可选的icon_url

    em.set_footer(text="ChatNote (c) 2020 Erisia")
    

    【讨论】:

      猜你喜欢
      • 2021-12-12
      • 2021-11-22
      • 2023-03-06
      • 2020-09-13
      • 2012-03-14
      • 2020-09-27
      • 2014-11-13
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多