title: DISCORD.PY Ticket System error how to fix
body: <p>i learned how to make a ticket system from some github user and I implemented the same code it worked perfectly like creating a ticket channel but there is a problem when i clicked the reaction to close my ticket and to delete my ticket channel which was created by the bot but it didn't delete the channel</p>
  <p>here is the code:</p>
  <pre><code>@client.event
  async def on_reaction_add(reaction, user):
      if 'React with :ticket: to create a ticket' in reaction.message.embeds[0].description and reaction.emoji == '' and not user.bot:
        role = discord.utils.get(user.guild.roles, name=&quot;@everyone&quot;)
        chan = await user.guild.create_text_channel(name=f'ticket - {user}')
        await chan.set_permissions(role, send_messages=False, read_messages=False, add_reactions=False, embed_links=False, attach_files=False, read_message_history=False, external_emojis=False)
        await chan.set_permissions(user, send_messages=True, read_messages=True, add_reactions=True, embed_links=True, attach_files=True, read_message_history=True, external_emojis=True)
        embed = discord.Embed(
          title=&quot;Ticket&quot;,
          description=&quot;React with :lock: to close a ticket&quot;,
          color=0x00FFFF
          )
        embed.set_footer(text=&quot;Ticket system&quot;)
        msg = await chan.send(embed=embed)
        await msg.add_reaction(&quot;&quot;)
  
      if 'React with :lock: to close a ticket' in reaction.message.embeds[0].description and reaction.emoji == '' and not user.bot:
          await channel.delete()
  
  
  @client.command()
  @commands.has_permissions(administrator=True)
  async def ticket(ctx, channel: discord.TextChannel = None):
      if channel==None:
          await ctx.channel.purge(limit=1)
          embed = discord.Embed(
              title=&quot;Ticket&quot;,
              description=&quot;React with :ticket: to create a ticket&quot;,
              color=0
          )
          embed.set_footer(text=&quot;Ticket system&quot;)
          msg = await ctx.send(embed=embed)
          await msg.add_reaction(&quot;&quot;)
  
      else:
          await ctx.channel.purge(limit=1)
          embed = discord.Embed(
              title=&quot;Ticket&quot;,
              description=&quot;React with :ticket: to create a ticket&quot;,
              color=0
          )
          embed.set_footer(text=&quot;Ticket system&quot;)
  
          msg = await channel.send(embed=embed)
          await msg.add_reaction(&quot;&quot;)
  </code></pre>