Discord.py-rewrite - 如何在语音通道中使BOT自我静音或自我聋?

问题描述 投票:0回答:1

我正在使用discord.py-rewrite制作Discord BOT,并专注于我的BOT音乐部分。我多次检查了API,但我不知道如何在语音通道上进行自我静音或自我聋(不是服务器静音或服务器耳聋)。任何人都知道我怎么能自我缄默或自我聋我的不和谐BOT?

discord discord.py discord.py-rewrite
1个回答
1
投票

看起来API没有公开这个功能,但websocket代码中有a method for doing this

@bot.command()
async def mute(ctx):
    voice_client = ctx.guild.voice_client
    if not voice_client:
        return
    channel = voice_client.channel
    await voice_client.main_ws.voice_state(ctx.guild.id, channel.id, self_mute=True)

我现在无法测试这个,所以它可能无法正常工作。请记住,即使在次要版本之间也不能保证这样的内部方法不会改变。

© www.soinside.com 2019 - 2024. All rights reserved.