【问题标题】:Can I detect if specific someone joins a random voice channel (which channel did they join?)我可以检测特定的人是否加入了随机语音频道(他们加入了哪个频道?)
【发布时间】:2020-11-10 01:07:21
【问题描述】:

我能否检测到特定的人(我有 id)是否加入了随机语音频道并将我的机器人发送到该频道?我查了很多论坛和文档,但对如何做到这一点一无所知。

我有一个活动来检查特定的人是否加入了语音频道 - 没关系。 但我无法将我的机器人发送到那里,因为我不知道他们加入了哪个频道。

【问题讨论】:

    标签: python discord bots


    【解决方案1】:

    on_voice_state_update(member, before, after)

    @client.event
    async def on_voice_state_update(member, before, after):
        if after is not None and member.id == the_id:
            # check if bot is not already in the voice channel (im not sure how to) and then join it if not
            
    

    【讨论】:

    • 好吧,首先我很笨。哪个veriable现在正在携带频道信息?所以我可以用它把机器人发送到那里
    • after 携带用户当前所在的频道。afterdiscordpy.readthedocs.io/en/latest/…
    • 嗯。我收到此错误:if after.voice.voice_channel is not None and member.id == "guy's id": AttributeError: 'VoiceState' object has no attribute 'voice'
    • 已编辑,我认为这已经过时了。
    猜你喜欢
    • 2021-07-13
    • 2023-02-25
    • 2020-07-16
    • 1970-01-01
    • 2020-10-04
    • 1970-01-01
    • 2020-08-30
    • 1970-01-01
    • 2021-10-22
    相关资源
    最近更新 更多