код:
@bot.event
async def on_member_join(member):
channel = bot.get_channel(channelID)
randomMember = random.choice(joinMember)
embed = discord.Embed(
description = f'Пользователь ``{member}`` наткнулся на наш сервер',
colour = discord.Color.red()
)
embed.set_image(url = randomMember)
await channel.send(embed=embed)
@bot.event
async def on_member_remove(member):
channel = bot.get_channel(channelID)
memberRemove = random.choice(removeMember)
embed = discord.Embed(
description = f'Пользователь ``{member}`` покинул наш сервер',
colour = discord.Color.red()
)
embed.set_image(url= memberRemove)
await channel.send(embed=embed)
embed = discord.Embed(
description = f' ``{member}`` Жаль что вы покинули наш сервер :(',
colour = discord.Color.red()
)
embed.set_image(url= memberRemove)
await member.send(embed=embed)
ошибка:
[2023-11-13 17:49:55] [ERROR ] discord.client: Ignoring exception in on_member_remove
Traceback (most recent call last):
File "C:\Users\daniel\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 441, in _run_event
await coro(*args, **kwargs)
File "C:\Users\daniel\Documents\Project\Grozny_bot\main.py", line 155, in on_member_remove
await channel.send(embed=embed)
AttributeError: 'NoneType' object has no attribute 'send'
[2023-11-13 17:49:59] [ERROR ] discord.client: Ignoring exception in on_member_join
Traceback (most recent call last):
File "C:\Users\daniel\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 441, in _run_event
await coro(*args, **kwargs)
File "C:\Users\daniel\Documents\Project\Grozny_bot\main.py", line 142, in on_member_join
await channel.send(embed=embed)
AttributeError: 'NoneType' object has no attribute 'send'
я понимаю что ошибка в
await channel.send(embed=embed)
, но не могу исправить.