0

So I'm trying to make a self role system and I've tried many client.event stuff and it doesn't seem to work. So now I feel I need to ask for help my code now likes like this:

@client.command()
async def roles(ctx, reaction, user):
  await ctx.send("React to this to get roles: \n <:regional_indicator_f:955958148718559242> - Femboy \n <:regional_indicator_n:955958148718559242> - Femboy lover \n <:regional_indicator_t:955958148718559242> - Top \n <:regional_indicator_b:955958148718559242> - Bottom")
  await ctx.add_reaction('<:regional_indicator_f:955958148718559242>')
  await ctx.add_reaction('<:regional_indicator_n:955958148718559242>')
  await ctx.add_reaction('<:regional_indicator_t:955958148718559242>')
  await ctx.add_reaction('<:regional_indicator_b:955958148718559242>')
  if reaction.emoji == "<:regional_indicator_f:955958148718559242>":
    Role = discord.utils.get(user.guild.roles, name="Femboy")
    await client.add_roles(user, Role)
  if reaction.emoji == "<:regional_indicator_n:955958148718559242>":
    Role = discord.utils.get(user.guild.roles, name="Femboy lover")
    await client.add_roles(user, Role)
  if reaction.emoji == "<:regional_indicator_t:955958148718559242>":
    Role = discord.utils.get(user.guild.roles, name="Top")
    await client.add_roles(user, Role)
  if reaction.emoji == "<:regional_indicator_b:955958148718559242>":
    Role = discord.utils.get(user.guild.roles, name="Bottom")
    await client.add_roles(user, Role)

It seems very messing but i get no errors but it doesn't send any messages when i use the command. I deeply need someone's help. Also I'm fairly new to python.

AngleBoost
  • 47
  • 1
  • 6
  • What do you mean by "doesn't work"? You aren't checking for the user's reaction, but rather if the user passed the reaction as an argument. You can view questions like [this](https://stackoverflow.com/a/52212888/14420546) on events. – Bagle Mar 23 '22 at 03:04
  • Yup i tried that and here is the error File "main.py", line 28, in on_ready Moji = await client.send_message(Channel, Text) AttributeError: 'Bot' object has no attribute 'send_message' – AngleBoost Mar 23 '22 at 03:42
  • That syntax is older, it should be `Channel.send()` or similar – Bagle Mar 23 '22 at 07:04
  • This is working a little now but won't add reactions to the message – AngleBoost Mar 23 '22 at 22:34
  • Your code shows you adding the reactions to the author's message, try defining the message you sent instead. Also check if your bot has permissions to add reactions to messages – Bagle Mar 24 '22 at 02:44

0 Answers0