F
F
Felix_fenik2020-08-04 11:58:52
Python
Felix_fenik, 2020-08-04 11:58:52

Discord python. Greeting error. Need help?

@client.event
async def on_member_join(member):
    guild = member.guild
    channel = guild.channel
    retStr = str("""```yaml\nПривет!\nДобро пожаловать на наш сервер!\nНадеюсь тебе тут понравится.\nЕсли заблудешься пиши .help,кстати у нас все команды пишутся с .\nудачи тебе```""")
    embed = discord.Embed(title="Welcome",colour=discord.Colour.blue())
    embed.add_field(name="Привет",value=retStr)
    await bot.send_message(channel, embed=embed)


Ignoring exception in on_member_join Traceback
(most recent call last):
File "C:\Users\x094t\AppData\Local\Programs\Python\Python38-32\lib\site-packages\discord\client.py", line 312, in _run_event
await coro(*args, **kwargs)
File "bot.py", line 27, in on_member_join
channel = guild.channel
AttributeError: 'Guild' object has no attribute 'channel'

what to do?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dimonchik, 2020-08-04
@dimonchik2013

make a channel attribute on the Guild object

S
soremix, 2020-08-04
@SoreMix

Where did you find the send_message method

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question