I am a bit new to Discord PY and am looking for a way to add roles if a person DM's a Key to the bot.
I researched and typed this code but am getting errors please Help
The Code IS
Mod = 789737793042776074
@Client.event
async def on_member_join(person):
async for guild in Client.fetch_guilds(limit=150):
channel = person
await channel.send(f"Thanks for Joining {guild.name}")
reply = await Client.wait_for('message', timeout=60)
if reply.content == 'STron':
# role = get(guild.roles, id = Mod)
await channel.send('Sshh I Gave you Moderator')
await person.add_roles(id = Mod)
I am getting an error
Ignoring exception in on_member_join
Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 333, in _run_event
await coro(*args, **kwargs)
File "main.py", line 28, in on_member_join
await person.add_roles(id = Mod)
TypeError: add_roles() got an unexpected keyword argument 'id'
question from:
https://stackoverflow.com/questions/65650641/discord-py-on-member-join-add-roles 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…