0
votes

I am using code that I found here.

But, I'm getting an error that the client object doesn't have the attribute send_message. I have tried message.channel.send but that failed as well.

@client.event
async def on_ready():
    Channel = client.get_channel('YOUR_CHANNEL_ID')
    Text= "YOUR_MESSAGE_HERE"
    Moji = await client.send_message(Channel, Text)
    await client.add_reaction(Moji, emoji='????')

@client.event
async def on_reaction_add(reaction, user):
    Channel = client.get_channel('YOUR_CHANNEL_ID')
    if reaction.message.channel.id != Channel:
      return

    if reaction.emoji == "????":
      Role = discord.utils.get(user.server.roles, name="YOUR_ROLE_NAME_HERE")
      await client.add_roles(user, Role)
1
Have you tried Moji = client.send(Channel, Text)?IPSDSILVA
What version of discord.py are you using?Nurqm
yes I have it says client doesn't have attribute sendJoshua Siraj
And version 1.0.1 on repl.itJoshua Siraj

1 Answers

0
votes

One of the reasons why your code might not be working is because you may have your channel id stored in a string. Your code shows:

Channel = client.get_channel('YOUR CHANNEL ID')

The code above shows that your channel id is stored in a string, which it should not be. With the code above, your actual code may look like this:

Channel = client.get_channel('1234567890')

Instead you should have:

Channel = client.get_channel(1234567890)