# Path: phial/errors.py
# class ArgumentTypeValidationError(ArgumentValidationError):
#     """Exception indicating argument type validation has failed."""
# 
#     pass
# 
# class ArgumentValidationError(Exception):
#     """Exception indicating argument validation has failed."""
# 
#     pass
# 
# Path: phial/wrappers.py
# class Message:
#     """
#     A representation of a Slack message.
# 
#     :param text: The message contents
#     :param channel: The Slack channel ID the message was sent from
#     :param user: The user who sent the message
#     :param timestamp: The message's timestamp
#     :param team: The Team ID of the Slack workspace the message was
#                  sent from
#     :param bot_id: If the message was sent by a bot
#                    the ID of that bot. Defaults to None.
#     """
# 
#     def __init__(
#         self,
#         text: str,
#         channel: str,
#         user: str,
#         timestamp: str,
#         team: Optional[str],
#         bot_id: Optional[str] = None,
#     ) -> None:
#         self.text = text
#         self.channel = channel
#         self.user = user
#         self.timestamp = timestamp
#         self.team = team
#         self.bot_id = bot_id
# 
#     def __repr__(self) -> str:
#         return "<Message: {0} in {1}:{2} at {3}>".format(
#             self.text, self.channel, self.team, self.timestamp
#         )
# 
#     def __eq__(self, other: object) -> bool:
#         return self.__dict__ == other.__dict__


import re
from inspect import Parameter, Signature, signature
from typing import Any, Callable, Dict, List, Optional
from phial.errors import ArgumentTypeValidationError, ArgumentValidationError
from phial.wrappers import Message
    """Parse help text."""
    NEW_LINE_SEPERATOR = "<__NEW_LINE_SEPERATOR__>"

    # Strip excess whitespace
    help_text = help_text.strip()

    # Remove single new lines
    help_text = help_text.replace("\n", NEW_LINE_SEPERATOR)
    help_text = help_text.replace(NEW_LINE_SEPERATOR * 2, "\n")
    help_text = help_text.replace(NEW_LINE_SEPERATOR, "")

    # Remove extra spaces
    help_text = re.sub(r"(^[ \t]+|[ \t]+)", " ", help_text, flags=re.M)

    return help_text


def parse_slack_output(slack_rtm_output: List[Dict]) -> Optional["Message"]:
    """Parse Slack output."""
    output_list = slack_rtm_output
    if output_list and len(output_list) > 0:
        for output in output_list:
            if output and "text" in output:
                bot_id = None
                team = None
                if "team" in output:
                    team = output["team"]
                if "bot_id" in output:
                    bot_id = output["bot_id"]


# Path: phial/errors.py
# class ArgumentTypeValidationError(ArgumentValidationError):
#     """Exception indicating argument type validation has failed."""
# 
#     pass
# 
# class ArgumentValidationError(Exception):
#     """Exception indicating argument validation has failed."""
# 
#     pass
# 
# Path: phial/wrappers.py
# class Message:
#     """
#     A representation of a Slack message.
# 
#     :param text: The message contents
#     :param channel: The Slack channel ID the message was sent from
#     :param user: The user who sent the message
#     :param timestamp: The message's timestamp
#     :param team: The Team ID of the Slack workspace the message was
#                  sent from
#     :param bot_id: If the message was sent by a bot
#                    the ID of that bot. Defaults to None.
#     """
# 
#     def __init__(
#         self,
#         text: str,
#         channel: str,
#         user: str,
#         timestamp: str,
#         team: Optional[str],
#         bot_id: Optional[str] = None,
#     ) -> None:
#         self.text = text
#         self.channel = channel
#         self.user = user
#         self.timestamp = timestamp
#         self.team = team
#         self.bot_id = bot_id
# 
#     def __repr__(self) -> str:
#         return "<Message: {0} in {1}:{2} at {3}>".format(
#             self.text, self.channel, self.team, self.timestamp
#         )
# 
#     def __eq__(self, other: object) -> bool:
#         return self.__dict__ == other.__dict__


# Path: phial/utils.py
import re
from inspect import Parameter, Signature, signature
from typing import Any, Callable, Dict, List, Optional
from phial.errors import ArgumentTypeValidationError, ArgumentValidationError
from phial.wrappers import Message

    """Parse help text."""
    NEW_LINE_SEPERATOR = "<__NEW_LINE_SEPERATOR__>"

    # Strip excess whitespace
    help_text = help_text.strip()

    # Remove single new lines
    help_text = help_text.replace("\n", NEW_LINE_SEPERATOR)
    help_text = help_text.replace(NEW_LINE_SEPERATOR * 2, "\n")
    help_text = help_text.replace(NEW_LINE_SEPERATOR, "")

    # Remove extra spaces
    help_text = re.sub(r"(^[ \t]+|[ \t]+)", " ", help_text, flags=re.M)

    return help_text


def parse_slack_output(slack_rtm_output: List[Dict]) -> Optional["Message"]:
    """Parse Slack output."""
    output_list = slack_rtm_output
    if output_list and len(output_list) > 0:
        for output in output_list:
            if output and "text" in output:
                bot_id = None
                team = None
                if "team" in output:
                    team = output["team"]
                if "bot_id" in output:
                    bot_id = output["bot_id"]


                return Message(