text: import discord
  from discord.ext import tasks, commands
  from datetime import datetime, timedelta, timezone
  
  
  class AutoDelete(commands.Cog):
  
      def __init__(self, bot):
          self.bot = bot
          self.bot.del_channels = None
          self.loop.start()
  
      @tasks.loop(seconds=5)
      async def loop(self):
          try:
              print("a")
              if type(self.bot.del_channels) is not list:
                  self.bot.del_channels = {}
                  for k, v in self.bot.auto_delete_channel_ids.items():
                      if type(k) is tuple:
                          for i in k:
                              ch = self.bot.get_channel(i)
                              if ch:
                                  self.bot.del_channels[ch] = v
  
                      else:
                          ch = self.bot.get_channel(k)
                          if ch:
                              self.bot.del_channels[ch] = v
                      if not ch:
                          continue
  
              print("b")
              print(self.bot.del_channels)
  
              for k, v in self.bot.del_channels.items():
                  try:
                      time = v["del_time"]
                  except:
                      time = 3
  
                  try:
                      base_message_id = v["base_message_id"]
  
                  except:
                      base_message_id = None
  
                  if type(k) is tuple:
                      print("c")
                      for _k in k:
                          async for msg in _k.history(limit=None):
                              if base_message_id:
                                  if msg.id == base_message_id:
                                      return
                              if discord.utils.snowflake_time(msg.id) + timedelta(hours=time) < datetime.now(timezone.utc):
                                  await msg.delete()
  
                  else:
                      print("d")
                      async for msg in k.history(limit=None):
                          if base_message_id:
                              if msg.id == base_message_id:
                                  return
                          if discord.utils.snowflake_time(msg.id) + timedelta(hours=time) < datetime.now(timezone.utc):
                              await msg.delete()
  
          except Exception as e:
              print(e)
  
  
  def setup(bot):
      bot.add_cog(AutoDelete(bot))
  