Reputation: 1
I'm making a discord bot that sends a welcome message and gives you two roles upon joining. I figured out how to make it add one, but i can't seem to make it add two roles. Here's my code:
@client.event
async def on_member_join(member):
if member.guild.name == "miller's bedroom":
embed = discord.Embed(description=f"Hey {member.mention}, what's up? Welcome to **{member.guild.name}**! <:m_yo:782996060544827423>", color=0x02acff)
await client.get_channel(782984495061794857).send(embed=embed)
roles = discord.utils.get(member.guild.roles, name="Member", "▬▬▬ Reaction Roles ▬▬▬", "▬▬▬ Member Roles ▬▬▬")
await member.add_roles(roles)
Here is the error I'm getting:
File "main.py", line 21
roles = discord.utils.get(member.guild.roles, name="Member", "▬▬▬ Reaction Roles ▬▬▬", "▬▬▬ Member Roles ▬▬▬")
^
SyntaxError: positional argument follows keyword argument
Upvotes: 0
Views: 292
Reputation: 88
Try using
@client.event
async def on_member_join(member):
if member.guild.name == "miller's bedroom":
embed = discord.Embed(description=f"Hey {member.mention}, what's up? Welcome to **{member.guild.name}**! <:m_yo:782996060544827423>", color=0x02acff)
await client.get_channel(782984495061794857).send(embed=embed)
roles = discord.utils.get(member.guild.roles,"Member", "▬▬▬ Reaction Roles ▬▬▬", "▬▬▬ Member Roles ▬▬▬")
await member.add_roles(roles)
This error occurs when you pass a keyword argument(argument in which you write [variable] = [value] ) before passing all the positional arguments(where you just pass the value depending upon the position of the variables in function definition).
While passing keyword arguments position of it doesn't matter as you are telling which value should be assigned to which variable which is not true in the case of positional arguments as their position is important.
Upvotes: 1