【问题标题】:AttributeError: module 'discord' has no attribute 'on_voice_state_update'AttributeError:模块“不和谐”没有属性“on_voice_state_update”
【发布时间】:2022-01-13 00:03:38
【问题描述】:
intents = discord.Intents.all()
Client = discord.Client(intents=intents)



@Client.event
async def on_ready():
    print("Logged in as", Client.user.name)
    VC = Client.get_channel(917198277148041241)
    members = VC.members
    memids = []
    discord.on_voice_state_update(memids)
    for member in members:
        memids.append(member.id)
        memids.append(member.name)



Client.run(Token)

问题出现在 discord.on_voice_state_update(memids),我收到属性错误

【问题讨论】:

    标签: python discord discord.py


    【解决方案1】:

    如果你想使用on_voice_state_update事件,可以这样使用:

    @Client.event
    async def on_voice_state_update(before, after):
        pass  # whatever here
    

    beforeafter 是成员的voice states

    【讨论】:

      猜你喜欢
      • 2017-11-12
      • 2022-10-20
      • 2023-04-06
      • 2021-06-29
      • 2018-04-14
      • 2019-02-18
      • 1970-01-01
      • 2020-01-01
      • 2021-09-01
      相关资源
      最近更新 更多