discord.py使语音通道中的所有人静音

时间:2020-09-20 21:03:48

标签: python discord discord.py

这是我的代码rn:

import discord
from discord.ext import commands
client = commands.Bot(command_prefix="-")
@client.event
async def on_ready():
    print('BOT ACTIVATED')
@client.command()
async def hello(ctx):
    await ctx.send("hei this is a test just dont mind me")
@client.command()
async def join(ctx):
    channel = ctx.message.author.voice.channel
    await channel.connect()


client.run('mytoken')

我如何使该语音通道中的所有人静音?

1 个答案:

答案 0 :(得分:2)

遍历语音通道的所有成员,并将mute=True传递给edit函数。

@client.command()
async def vcmute(ctx):
    vc = ctx.author.voice.channel
    for member in vc.members:
        await member.edit(mute=True)