code: def discord_message_to_message(
      message: DiscordMessage,
  ) -> Optional[Message]:
      if (
          message.type == discord.MessageType.thread_starter_message
          and message.reference.cached_message
          and len(message.reference.cached_message.embeds) > 0
          and len(message.reference.cached_message.embeds[0].fields) > 0
      ):
          field = message.reference.cached_message.embeds[0].fields[0]
          if field.value:
              return Message(user=field.name, text=field.value)
      else:
          if message.content:
              return Message(
                  user=message.author.name, text=message.content
              )
      return None
  
file_path: gpt-discord-bot/src/utils.py
imports: from src.constants import ALLOWED_SERVER_IDS
  import logging
  from src.base import Message
  from discord import Message
  from typing import Optional, List
  import discord
  from src.constants import MAX_CHARS_PER_REPLY_MSG, INACTIVATE_THREAD_PREFIX
label_desc: Use image node_id 1 for calling a global function with example usage: discord_message_to_message(message) and returns: None, Message, Message