You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

discord.py调用set_footer修改embed页脚报参数数量错误如何解决

问题原因

discord.py 库中 Embed.set_footer() 方法不支持传入位置参数,所有配置项必须通过关键字参数传递:

  • 页脚文本需要通过 text 关键字参数传入,你直接将字符串作为位置参数传入方法,方法仅接收self作为唯一位置参数,因此触发「传入2个位置参数但仅接收1个」的类型错误。
修复方案

把调用行修改为关键字参数传值即可,修改后代码如下:

if message.channel == bot_commands_channel:
    for em in message.embeds:
      em.set_footer(text='''new footer''')
      await log_channel.send(embed=em)
      return

内容的提问来源于stack exchange,提问作者user16634524

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.07 19:30:04