Answer the question
In order to leave comments, you need to log in
Why is the role not automatically assigned?
Hello. I am not given a role on the server automatically. Cmd doesn't show any errors. Help me please.
PS Here is the code:
#Autorole
@Bot.event
async def on_member_join(member):
if role := member.guild.get_role(769849037137641482):
await member.add_roles(role)
Answer the question
In order to leave comments, you need to log in
Incorrect use :=
Use !=
, respectively, the role will first need to be entered in the role variable
I also wrote a bot on the discord.
@bot.event # Когда человек заходит на канал бот приветствует его.
async def on_member_join(member):
channel = bot.get_channel(id канала)
await member.add_roles(discord.utils.get(member.guild.roles, id=роль))
await channel.send(f'Добро пожаловать {member.name}!')
Verify that a role with the specified ID exists. For example, manually mentioning the specified role by ID, sending a manual mention of the role: <@&769849037137641482>
.
If the role exists, also make sure you have all the required intents. on_member_join
requires Members intent: https://discordpy.readthedocs.io/en/stable/api.htm...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question