B
B
Bot-Developer2021-08-17 16:19:20
Python
Bot-Developer, 2021-08-17 16:19:20

How to make a greeting in a discord bot?

I can't seem to get to welcome new server users. I have the code but it throws an error:

async def discord.on_member_join (member):
                     ^
SyntaxError: invalid syntax

Code I am using:
@client.event
async def discord.on_member_join(member):
  welcome = client.get_channel(guild_welcome[member.guild.id]) 
  embed=discord.Embed(title="Добро пожаловать!", description=f"К нам в {member.guild.name} зашёл {member.mention}! Обязательно прочти правила.", color=0xCC974F)
  await welcome.send(embed=embed)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
F
froppe, 2021-08-17
@Bot-Developer

Most likely an error in the first line. it also says "invalid syntax". It's most likely a matter of sign placement. try doing like this -async def on_member_join(member):

V
Vindicar, 2021-08-17
@Vindicar

He speaks correctly. A function name with a dot like "discord.on_member_join" is not valid in Python. Learn the basics of Python first, then rush to write bots.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question