opened = open("hosts.txt", "r")
ips_data = opened.read()
opened.close()

class colors:
  HEADER = '\033[95m'
  BLUE = '\033[94m'
  GREEN = '\033[92m'
  YELLOW = '\033[93m'
  RED = '\033[91m'
  ENDC = '\033[0m'
  BOLD = '\033[1m'
  UNDERLINE = '\033[4m'

def convert_ip(connector):
  for line in ips_data.splitlines():
    SPLITTED = line.split(":")
    print(SPLITTED)
    if SPLITTED[0] == connector:
      return SPLITTED[1]

def ansi_compile(user_data, message):
  compiled_message = message
  name = user_data[0]
  user_type = user_data[1]

  if user_type == "admin":
    name = colors.BOLD+colors.RED+name+colors.ENDC
  elif user_type == "mod":
    name = colors.BOLD+colors.YELLOW+name+colors.ENDC
  elif user_type == "user":
    name = colors.BOLD+name+colors.ENDC

  return (name, compiled_message)
