Reputation: 1
I am confused about this auto role assign that I have working yesterday and havent touched it since...
@client.event
async def on_member_join(ctx, member):
if member.guild.name == "lusk_245789": # Server Name
role = discord.utils.get(member.guild.roles, name="Member")
await member.add_roles(role)
embed = discord.Embed(title=f"Member Joined", description=f"{member.mention}, Welcome to {member.guild.name}. We hope that your time with us is a happy one!", color=0x9b26b9, font_size=200, timestamp=ctx.message.created_at)
embed.add_field(name="Please check out the Rules Channel!", value="<#822090510495514644>", inline=False)
embed.add_field(name="Latest announcements are made here!", value="<#781017647922937856>", inline=False)
embed.set_footer(text="Task Completed!")
# Send the embed message and fields
await client.get_channel(873238209897844799).send(embed=embed)
# Get role and assign to new member
#elif member.guild.name == "Server Name":
#embed = discord.Embed(title=f'Welcome {member.name} !\nwelcome to #{member.guild.name}', #color=0x9b26b9) #you can add more if you want
#await client.get_channel(CHANNEL_ID).send(embed=embed)
else:
return
The error:
Ignoring exception in on_member_join
Traceback (most recent call last):
File "C:\Users\Admin\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\client.py", line 343, in _run_event
await coro(*args, **kwargs)
TypeError: on_member_join() missing 1 required positional argument: 'member'
Upvotes: 0
Views: 161
Reputation: 1
loloToster was half correct, but the other issue was I also forgot to remove the
timestamp=ctx.message.created_at
within the embed causing issues within my code, I believe that you will be able to use timestamp=datetime.datetime.utcnow() as a replacement!
Thank you for the help!
Upvotes: 0
Reputation: 1415
That's because on_member_join
event takes only one parameter member
not ctx
and member
. Just replace this:
async def on_member_join(ctx, member):
with this:
async def on_member_join(member):
and it should work.
Upvotes: 1