Skip to main content

BotProtocol

Defined in the protocols module.
AI Agent Protocol for messaging bot implementations. Bots connect agents to messaging platforms, handling:
  • Message receiving and sending
  • Command handling
  • Webhook/polling management
  • User and channel management
Example usage (implementation in praisonai wrapper): from praisonai.bots import TelegramBot bot = TelegramBot(token=”…”, agent=my_agent) await bot.start()

Methods

is_running()

Whether the bot is currently running.

platform()

Platform name (telegram, discord, slack, etc.).

bot_user()

The bot’s user information.

start()

Start the bot (begin receiving messages).

stop()

Stop the bot.

set_agent()

Set the agent that handles messages.

get_agent()

Get the current agent.

send_message()

Send a message to a channel.

edit_message()

Edit an existing message.

delete_message()

Delete a message.

on_message()

Register a message handler.

on_command()

Decorator to register a command handler.

send_typing()

Send typing indicator to a channel.

get_user()

Get user information.

get_channel()

Get channel information.

Source

View on GitHub

praisonaiagents/bots/protocols.py at line 290