【问题标题】:changing the embed's footer更改嵌入的页脚
【发布时间】:2021-10-17 00:27:08
【问题描述】:

我有这段代码可以更改嵌入的页脚并将其重新发送到日志通道,但现在由于某种原因它不再工作了

这是代码:

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

这是我得到的错误:

File "main.py", line 297, in on_message
    em.set_footer('''new footer''')
TypeError: set_footer() takes 1 positional argument but 2 were given

【问题讨论】:

  • 你在最新的 discord.py 版本上吗,因为从最新版本开始,它执行 2 个 kwargs 任务,在这里你只是给了今天的参数 docs 你也可以给一个 icon_url 也许试试这个跨度>

标签: python discord discord.py


【解决方案1】:

set_footer 的参数仅是关键字:

embed.set_footer(text='''new footer''')  # note the `text=...`

【讨论】:

    猜你喜欢
    • 2021-12-05
    • 2014-11-26
    • 2012-12-17
    • 1970-01-01
    • 2011-01-26
    • 2020-04-10
    • 2018-01-03
    • 2011-09-03
    相关资源
    最近更新 更多