【问题标题】:Discord bot runs locally but not on EC2 server?Discord bot 在本地运行但不在 EC2 服务器上运行?
【发布时间】:2018-08-16 02:02:27
【问题描述】:

所以我可以在我的机器上本地运行我的机器人,它运行良好,但是当我尝试将它托管在 AWS 上时,我得到了错误:

AttributeError: 'Message' object has no attribute 'server'

这是导致问题的线路。

role = discord.utils.get(message.server.roles, name=entered_role)

【问题讨论】:

  • 目标机器运行的是什么版本的discord.py?尝试执行python3 -c "import discord; print(discord.__version__)"
  • 版本 1.0.0a.
  • 您的代码是为版本 0.16(“异步”分支)构建的,而您的计算机正在运行版本 1.0(“重写”分支)。您可以更改计算机上的版本或更新您的代码(您可能应该更新您的代码)。 The docs for the rewrite version 可能是一个不错的起点。

标签: python amazon-web-services amazon-ec2 discord discord.py


【解决方案1】:

就像 Patrick 在 cmets 中所说,我的机器人是使用错误的 API 版本编写的。更新到新版本解决了这个问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2023-01-26
    • 2018-01-24
    • 1970-01-01
    • 2020-11-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多