title: ticket system for discord.js
body: <p>If anyone could help would be great im running into two errors, one the catch is not working correctly probably because of the try but I dont know how to fix it, two I want to know the code for the newly created channel, as I want to send the embedParent to the newly created ticket. Again I am new to this stuff...</p>
  <pre><code>client.on('message', message =&gt; {
  
      let args = message.content.substring(PREFIX.length).split(' ');
  
      switch (args[0]) {
          case 'ticket':
  
      // ID from the catogory channel tickets.
      const categoryId = &quot;644626077704257546&quot;;
  
      // Get username
      var userName = message.author.username;
      // Verkrijg discriminator
      var userDiscriminator = message.author.discriminator;
  
      // If ticket has been made
      var bool = false;
  
  
      // Ticket return code
      if (bool == true) return;
  
      var embedCreateTicket = new Discord.MessageEmbed()
          .setTitle(&quot;Hey, &quot; + message.author.username)
          .setFooter(&quot;Support channel will be made&quot;);
  
      message.channel.send(embedCreateTicket);
  
      // Create channel and put it in the right catogary
      message.guild.channels.create(userName + &quot;-&quot; + userDiscriminator, &quot;text&quot;).then((createdChan) =&gt; { // Maak kanaal
  
          createdChan.setParent(categoryId).then((settedParent) =&gt; { // Zet kanaal in category.
  
              // Put permissions for everyone
              settedParent.overwritePermissions(message.guild.roles.find('name', &quot;@everyone&quot;), { &quot;READ_MESSAGES&quot;: false });
              settedParent.overwritePermissions(message.guild.roles.find('name', &quot;@management&quot;), { &quot;VIEW_CHANNEL&quot;: true });
              // Put permission by the user that created the ticket
              settedParent.overwritePermissions(message.author, {
  
                  &quot;READ_MESSAGES&quot;: true, &quot;SEND_MESSAGES&quot;: true,
                  &quot;ATTACH_FILES&quot;: true, &quot;CONNECT&quot;: true,
                  &quot;CREATE_INSTANT_INVITE&quot;: false, &quot;ADD_REACTIONS&quot;: true
  
              });
              settedParent.overwritePermissions(everyone, {
  
                  &quot;READ_MESSAGES&quot;: false, &quot;SEND_MESSAGES&quot;: false,
                  &quot;ATTACH_FILES&quot;: false, &quot;CONNECT&quot;: false,
                  &quot;CREATE_INSTANT_INVITE&quot;: false, &quot;ADD_REACTIONS&quot;: false
  
              });
  
              var embedParent = new Discord.MessageEmbed()
                  .setTitle(&quot;Hey, &quot; + message.author.username.toString())
                  .setDescription(&quot;Put down here your question&quot;);
  
              channel.new.send(embedParent);            
              });try {error} finally
                  
              {err =&gt; {
              message.channel.send(&quot;Something went wrong.&quot;);
          };
  
      }try {
          
      }catch (error) {
          
      }(err =&gt; {
          message.channel.send(&quot;Something went wrong.&quot;);
      });
  }
      
  )
      }
  }
  )
  </code></pre>