Database¶
-
class
database.
Channel
(**kwargs)¶ A communication channel used to interact with the user and the system.
- Attributes:
param @id: Id to populate the database. param @name: The name or address of the channel param @agent_id: The id of the agent containing this channel param @agent: Tha object agent containing this channel param @social_network: The name of the social network used
-
class
database.
User
(**kwargs)¶ A class to store the user object.
- Attributes:
param @id: Id to populate the database. param @user_name: The user name of the user in the social network. param @name: The name of the user param @last_name: The last name of the user param @social_network_id: The id of the social network if it has it. param @channel_id: The id of the channel where the user is interacting. param @channel: The channel object where the user is interacting.
-
class
database.
Agent
(**kwargs)¶ An Agent refers to the main o domain or purpose of the chatbot.
- Attributes:
param @id: Id to populate the database. param @name: This name must be unique to identify the Agent. param @about: A description of the purpose of the chatbot.
-
database.
get_channel_id
(token)¶ This method finds the Channel Object using the authentication token from the channel.
- Parameters:
param token: the authentication token used by the channel to communicate with the system.
- Return:
- The channel object if found or None.
-
database.
get_or_create_user
(user, channel)¶ This method get an user object or creates it if it doesnt exists.
- Parameters:
param user: A dict containing information of the user. param channel: A channel object used by the user to communicate with the system.