【发布时间】:2020-07-28 14:21:28
【问题描述】:
所以我使用discord.py 制造不和谐Client。我正在使用on_voice_state_update 来查看成员的VoiceState 是否发生变化。
如果成员在特定的VoiceChannel 内,我希望客户端创建一个新的语音通道,使用成员的用户名作为通道名称,并将成员移动到该新语音通道中。这是我的代码:
import discord, asyncio
app = discord.Client()
@app.event
async def on_voice_state_update(user_name, user_id, after):
name2 = str(user_name)
ch = app.get_channel(660213767820410918)
guild = app.get_guild(660213767820410893)
member = str(user_id)
if after.channel == ch:
await guild.create_voice_channel(name=(name2+'`s Room'), category=guild.get_channel(660213767820410908) ,user_limit=99 ,overwrites=(user_name ,{'manage_channels': True}))
await guild.member.move_to(channel, reason=None)
这不起作用。谁能帮帮我?
【问题讨论】:
标签: python python-3.x discord.py