TelegramBot

class TelegramBot:

Represents a Telegram bot that is powered by an agent.

Parameters:

  • chat_agent (ChatAgent): Chat agent that will power the bot.
  • telegram_token (str, optional): The bot token.

init

def __init__(
    self,
    chat_agent: ChatAgent,
    telegram_token: Optional[str] = None
):

run

def run(self):

Start the Telegram bot.

on_message

def on_message(self, message: 'Message'):

Handles incoming messages from the user.

Parameters:

  • message (types.Message): The incoming message object.