# Path: hypebot/hype_types.py



import copy
import datetime
import itertools
import math
import random
import re
import threading
import unicodedata
import arrow
import six
from dateutil.relativedelta import relativedelta
from hypebot import hype_types
from hypebot.protos import channel_pb2
from hypebot.protos import message_pb2
from hypebot.protos import user_pb2
from typing import Callable, Dict, Iterable, List, Optional, Text, Tuple
    if field.HasField('text'):
      line += field.text
    elif field.HasField('image'):
      line += field.image.alt_text
    else:
      line += ', '.join([
          '[%s](%s)' % (button.text, button.action_url)
          for button in field.buttons
      ])
    text.append(line)
  return text


def _AppendToMessage(msg: hype_types.Message,
                     response: hype_types.CommandResponse):
  """Append a single response to the message list."""
  if isinstance(response, (bytes, Text)):
    msg.messages.add(text=response.split('\n'))
  elif isinstance(response, message_pb2.Message):
    msg.messages.extend([response])
  elif isinstance(response, message_pb2.Card):
    msg.messages.add(card=response, text=_CardAsTextList(response))
  elif isinstance(response, message_pb2.MessageList):
    msg.messages.extend(response.messages)
  else:
    assert isinstance(response, list)
    for line in response:
      _AppendToMessage(msg, line)



# Path: hypebot/hype_types.py



# Path: hypebot/core/util_lib.py
import copy
import datetime
import itertools
import math
import random
import re
import threading
import unicodedata
import arrow
import six
from dateutil.relativedelta import relativedelta
from hypebot import hype_types
from hypebot.protos import channel_pb2
from hypebot.protos import message_pb2
from hypebot.protos import user_pb2
from typing import Callable, Dict, Iterable, List, Optional, Text, Tuple

    if field.HasField('text'):
      line += field.text
    elif field.HasField('image'):
      line += field.image.alt_text
    else:
      line += ', '.join([
          '[%s](%s)' % (button.text, button.action_url)
          for button in field.buttons
      ])
    text.append(line)
  return text


def _AppendToMessage(msg: hype_types.Message,
                     response: hype_types.CommandResponse):
  """Append a single response to the message list."""
  if isinstance(response, (bytes, Text)):
    msg.messages.add(text=response.split('\n'))
  elif isinstance(response, message_pb2.Message):
    msg.messages.extend([response])
  elif isinstance(response, message_pb2.Card):
    msg.messages.add(card=response, text=_CardAsTextList(response))
  elif isinstance(response, message_pb2.MessageList):
    msg.messages.extend(response.messages)
  else:
    assert isinstance(response, list)
    for line in response:
      _AppendToMessage(msg, line)



def MakeMessage(response: hype_types.CommandResponse) -> hype_types.Message: