【问题标题】:on_server_join doesn't respond. discord.pyon_server_join 没有响应。不和谐.py
【发布时间】:2020-10-18 20:27:52
【问题描述】:

当机器人被邀请到服务器时,我试图获得输出,但由于某种原因,当我尝试测试我的代码时,它没有输出任何内容。它也没有给出任何错误。首先,我尝试从 Cog 文件中执行此操作:

    @commands.Cog.listener()
    async def on_server_join(self,server):
        print("hello")
        print(server.id)

然后在主文件中:

@client.event
async def on_server_join(server):
    print("hello world")
    print(server.id)

两者都不会导致任何错误,并且当我将机器人从服务器中踢出然后将其添加回来时,它们也不会输出任何内容。 其他事件,例如 on_readyon_member_join 工作正常。

创建新服务器并在那里添加机器人也不会触发事件。

【问题讨论】:

    标签: python discord discord.py


    【解决方案1】:

    当 discord.py 迁移到 v1.0 时,on_server_joinchangedon_guild_join

    【讨论】:

      猜你喜欢
      • 2021-07-07
      • 1970-01-01
      • 2019-04-13
      • 1970-01-01
      • 2021-09-30
      • 2021-04-08
      • 2021-11-20
      • 1970-01-01
      • 2021-03-03
      相关资源
      最近更新 更多