-1
channel_a = bot.get_channel(780743421442260993)

@bot.command()
async def Movee(ctx):
    i = 0
    while i < len(participant):
        if type(participant[i]) != str:
            await participant[i].move_to(channel_a)
        i += 1

我想把人们转移到另一个语音聊天室,

但是使用此代码,人们只是与语音聊天室断开连接。

我已经检查过频道 ID 是否正确...

如果您知道解决方案,如果您能告诉我,我将不胜感激。

4

1 回答 1

0
channel = []
@bot.event
async def on_ready():
    channel_a = bot.get_channel(780743421442260993)   
    channel.append(channel_a)
@bot.command()
async def setChA(ctx):
    channel[0] = bot.get_channel(ctx.message.author.voice.channel.id)
    await ctx.send("Done")

@bot.command()
async def Move(ctx):
    i = 0
    while i < len(participant):
        if type(participant[i]) != str:
            await participant[i].move_to(channel[0])
        i += 1

如上所述,它工作得很好。

我认为这是由 async 函数的工作方式引起的。

不使用它可能会很好地工作list

我将它发布给与我有同样问题的人。

我也总是欢迎任何知道更好方法的人:D

于 2021-03-24T06:00:38.180 回答