Я написал бота, который создает приватки при подключении в определенный канал, но он не запускается и пишет ошибку.
Код@bot.event
async def on_voice_state_update( member, before, after):
if after.chennel.id == 964512108018532382:
for guild in bot.guilds:
maincategory = discord.utils.get( guild.categoris, id = 964512108018532382)
chennel_p = await guild.create_voice_chennel(name = f'Private {member.display_name}', category = maincategory)
await chennel_p.set_permissions(member, connect = True, mute_members = True, move_members = True, manage_channls = True)
await member.move_to(chennel_p)
def check ( x, y, z):
return len( chennel_p.members ) == 0
await Bot.wait_for('voice.state.update', check = check)
await chennel_p.delete()
ОшибкаPS C:\Users\Admin> & C:/Users/Admin/AppData/Local/Programs/Python/Python310/python.exe c:/Users/Admin/Desktop/Bot/Bot.py
> Lando#9910 successfully connected
Ignoring exception in on_voice_state_update
Traceback (most recent call last):
File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "c:\Users\Admin\Desktop\Bot\Bot.py", line 90, in on_voice_state_update
if after.chennel.id == 964512108018532382:
AttributeError: 'VoiceState' object has no attribute 'chennel'