Coverage for mindsdb / interfaces / chatbot / types.py: 58%
19 statements
« prev ^ index » next coverage.py v7.13.1, created at 2026-01-21 00:36 +0000
« prev ^ index » next coverage.py v7.13.1, created at 2026-01-21 00:36 +0000
1from enum import Enum
2import datetime as dt
5class BotException(Exception):
6 pass
9class ChatBotMessage:
10 """
11 Represents a message sent and received by chatbots.
13 Attributes:
14 type (ChatBotMessage.Type): Type of message
15 text (str): Actual message content
16 user (str): The user that sent the message
17 destination (str): The user or channel that received the message
19 """
21 class Type(Enum):
22 DIRECT = 1
23 CHANNEL = 2
25 def __init__(self, type: Type, text: str, user: str, destination: str = None, sent_at: dt.datetime = None):
26 self.type = type
27 self.text = text
28 self.user = user
29 self.destination = destination
30 self.sent_at = sent_at or dt.datetime.now()
33class Function:
35 def __init__(self, name, description, callback):
36 self.name = name
37 self.description = description
38 self.callback = callback