【问题标题】:discord.py mute everyone in voice channeldiscord.py 将语音频道中的所有人静音
【发布时间】:2021-01-07 00:57:44
【问题描述】:

这是我的代码 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')

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

【问题讨论】:

    标签: python discord discord.py


    【解决方案1】:

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

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

    【讨论】:

      猜你喜欢
      • 2021-05-04
      • 2019-07-31
      • 2018-06-16
      • 2019-04-08
      • 2018-04-04
      • 2022-01-04
      • 2020-08-30
      • 2020-12-21
      • 2021-06-06
      相关资源
      最近更新 更多