title: Discord Python Delete Category and Channels within using ID
body: <pre><code>#deleted unused registered channels
  @bot.command(pass_context=True)
  #so that only an admin can run this command
  @commands.has_role('Admin')
  async def unregister(ctx, catID):
    cat = discord.utils.get(ctx.guild.categories, id = catID)
  
    #await ctx.channel.send(cat)
  
    for channel in cat.voice_channels:
      await channel.delete()
  
    for channel in cat.text_channels:
      await channel.delete()
    
    cat.delete()
  </code></pre>
  <p>This is the code I have currently. I have also tried it with client.get_channel(). I seem to get the error that category doesn't have access to .voice_channels and .text_channels, or that cat is a &quot;NoneType&quot;. I am new to python and coding a discord bot so any help with this command would be great. Thank you!</p>
  <p>The command is meant to take the categoryID you can get from right clicking and copying a category on discord. Then delete every voice and text channel under it. Then delete itself.</p>