【问题标题】:Discord.js 12 How to make bot leave when there are no people in the Voice Channel?Discord.js 12 语音频道无人时如何让bot离开?
【发布时间】:2021-02-17 18:47:53
【问题描述】:

我想检查机器人所在的语音通道中是否没有成员,因此它可以自动断开连接,并且在我断开连接或其他人断开连接之前不会停留在那里。

我一直在寻找任何示例,但没有找到与我的问题相关的答案。

谁能帮忙?

【问题讨论】:

    标签: discord.js


    【解决方案1】:

    我建议使用voiceStateUpdate 事件。在事件中,检查语音通道中是否有成员。如果没有,则让机器人离开。

    VoiceStateUpdate - Docs

    Check if user is in an specific voice Channel - Stackoverflow

    【讨论】:

    • 谢谢!非常感谢。
    • @nikoszz 欢迎您!如果这回答了您的问题,请接受它,这样我们都可以获得更多的声誉,其他用户可以看到这个答案解决了您的问题。见此链接:stackoverflow.com/help/someone-answers:D
    猜你喜欢
    • 2020-07-17
    • 2020-10-24
    • 1970-01-01
    • 2021-07-06
    • 2020-04-28
    • 2022-01-26
    • 1970-01-01
    • 2019-07-08
    • 2018-06-16
    相关资源
    最近更新 更多