0

This is my code:

#Ticket
@client.command(pass_context=True)
async def setuppartnership(ctx):
    guild = ctx.guild
    embed = discord.Embed(
        title = 'Richiesta Partnership',
        description = 'Vuoi fare partnership? Usa la reazione qui sotto per creare un nuovo ticket.',
        color=0x53eeff
    )
 
     
    msg = await ctx.send(embed=embed)
    await msg.add_reaction("")
    msg = await msg.channel.fetch_message(msg.id)
    
    
    while True:
        def check(reaction, user):
            return str(reaction) == '' and ctx.author == user
        await client.wait_for("reaction_add", check=check)
        ticket_channel = await guild.create_text_channel(name=f'partnership・{ctx.author.name}')
        await ticket_channel.set_permissions(ctx.author, send_messages=True, read_messages=True, add_reactions=True, embed_links=True, attach_files=True, read_message_history=True, external_emojis=True)
        await ticket_channel.set_permissions(ctx.guild.get_role(ctx.guild.id), send_messages=False, read_messages=False)

#This code works, but I have a problem: Only those who execute the command to generate the reaction message to open the tickets can open one, let me explain: If I run the command !setuppartnership it generates a command from which I click on the reaction he opens a ticket, but he only creates it for me who executed the command, because if another account clicks on the reaction nothing happens, you could kindly help me.

Golden
  • 1
  • Looks like `ctx.author == user` might be the problem, you are the author and not the other person. See https://discordpy.readthedocs.io/en/stable/ext/commands/api.html#discord.ext.commands.Context.author – Sefan Oct 07 '21 at 09:45

1 Answers1

-1

DO NOT USE loops to wait for events.

You can find list of events and their functions here: https://discordpy.readthedocs.io/en/stable/api.html?highlight=reaction#event-reference

The one your looking for is on_raw_reaction_add() you can get the member object of the person who reacted by using payload.member

Note: You have to check payload.message_id == <your-message-id>

Roxx
  • 314
  • 1
  • 6
  • Thank you very much for your answer, unfortunately I am not very good at using the on_raw_reaction_add() function, if you could insert it in my piece of code you would be very kind, thanks again. – Golden Oct 08 '21 at 06:17