chai_py.chai_bot module

class chai_py.chai_bot.ChaiBot(uid: str = 'LOCAL_DEV')

Bases: object

Base chatbot class.

Chatbots must be made as a subclass of ChaiBot. The subclass must then implement the on_message() method, with the same signature.

FIRST_MESSAGE_STRING = '__first'
async get_messages(conversation_id: str)List[chai_py.types.Message]

Fetches a list of messages for the specified conversation.

This function is provided when using bots in a :class:TRoom and in deployment. Do not override or create an implementation.

@param conversation_id: @return:

List of messages in the conversation, sorted by increasing timestamp (i.e. oldest first).

async on_message(update: chai_py.types.Update)str

Event called when the bot receives a message.

@param update: @return:

String containing the reply.

setup()

Any setup should be done by overriding this function.

setup_logger()