0

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)
Łukasz Kwieciński
  • 14,992
  • 4
  • 21
  • 39

1 Answers1

0

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)
IPSDSILVA
  • 1,667
  • 9
  • 27