Использую вот такой код для создания войс комнат:
@Bot.event
async def on_voice_state_update(member, before, after):
if after:
if after.channel:
if after.channel.id == %%%%%%%%%%%%%%%%:
print(f'{member} зашёл в канал')
guild = bot.get_guild(%%%%%%%%%%%%%%%)
maincategory = discord.utils.get(guild.categories, id=%%%%%%%%%%%%%%%%%)
overwrites = {
member: discord.PermissionOverwrite(connect=True, mute_members=True, move_members=True,
manage_channels=True)
}
channel2 = await guild.create_voice_channel(name=f'{member.display_name}',
category=maincategory, overwrites=overwrites)
await member.move_to(channel2)
def check(x, y, z):
return len(channel2.members) == 0
await bot.wait_for('voice_state_update', check=check)
await channel2.delete()
После чего в консоли возникает ошибка:
Ignoring exception in on_voice_state_update
Traceback (most recent call last):
File "C:\Users\Макс\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "C:\Users\Макс\DRACULA\bot.py", line 112, in on_voice_state_update
guild = bot.get_guild(%%%%%%%%%%%%%%%%)
AttributeError: module 'discord.ext.commands.bot' has no attribute 'get_guild'
Помогите решить данную ошибку!