我的Discord僵尸程序启动后,在切换到至少一个其他语音信道之前,我的Discord僵尸程序无法识别该语音信道中的成员(加入该信道后,用户必须手动切换到其他信道,然后返回,以便漫游器识别该成员并将其移动到所需的频道)。这有点违反直觉,并且违背了我的机器人的目的。
from discord.ext import commands
class Mute(commands.Cog):
# Commands
@commands.command()
async def mute(self, ctx):
vc = ctx.author.voice.channel
for member in vc.members:
await member.edit(mute=True)
await ctx.channel.purge()
@commands.command()
async def unmute(self, ctx):
vc = ctx.author.voice.channel
for member in vc.members:
await member.edit(mute=False)
await ctx.channel.purge()
@commands.command()
async def start(self, ctx):
vc = ctx.author.voice.channel
await ctx.channel.send("A new game has started!")
await ctx.channel.send("Users will now be moved. Game has started!")
await ctx.channel.purge()
channel = discord.utils.get(ctx.guild.channels, name="AU voice")
for member in vc.members:
await member.move_to(channel)
def setup(client):
client.add_cog(Mute(client))