【问题标题】:why send_message doesn't exists? [duplicate]为什么 send_message 不存在? [复制]
【发布时间】:2023-03-12 13:31:01
【问题描述】:

discord.ext.commands.errors.CommandInvokeError:命令引发了 异常:AttributeError:“Bot”对象没有属性 'send_message'

我遇到了一个我真的不明白的问题。这是我的代码:

async def sad(ctx):
    await client.send_message(ctx.message.author, 'sad')```

AttributeError: 'Bot' object has no attribute 'send_message'

【问题讨论】:

标签: python python-3.x discord discord.py


【解决方案1】:

Discord.py 最近迁移到重写:https://discordpy.readthedocs.io/en/latest/

# before
await client.send_message(channel, 'Hello')

# after
await channel.send('Hello')

More here

【讨论】:

    猜你喜欢
    • 2019-09-27
    • 1970-01-01
    • 1970-01-01
    • 2012-02-27
    • 1970-01-01
    • 2020-12-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多