-2

Hello for my bot I put an auto role system but alas when I run my code its said to me:

NameError: name 'message' is not define

can u help me pls the code:

@client.event
async def on_ready():
    Channel = client.get_channel('829747866360610843')
    Text= "Hey Si Tu Veux Acceder Au Conversations Exclusivement Pour Les Mangas Clique Sur La Réaction  !"
    Moji = await message.channel.send(Channel, Text)
    await client.add_reaction(Moji, emoji='')
@client.event
async def on_reaction_add(reaction, user):
    Channel = client.get_channel('829747866360610843')
    if reaction.message.channel.id != Channel:
        return
    if user.reaction.emoji == "":
        Role = discord.utils.get(user.server.roles, name="manga")
        await client.add_roles(user, Role)
Romain
  • 11
  • 3
  • 1
    This method is pretty outdated and just copy & past from another [post](https://stackoverflow.com/questions/52210855/give-role-when-a-user-add-reaction-discord-py?rq=1). Please give us the whole traceback even though the error is self-explanatory. – Dominik Apr 08 '21 at 18:11

1 Answers1

0

The error is in your on_ready event: Moji = await message.channel.send(Channel, Text) There is no variable called message there, my guess is you're trying to send the message to that channel you got earlier, to do so, you should use Moji = await Channel.send(Text). Also: when using add_reaction, it's suggested to use the one from the message, and not from the client: await Moji.add_reaction('')

Parasol Kirby
  • 351
  • 1
  • 11