Skip to main content

A Python library for interacting with Pigeon Messenger

Project description

Pigeon Bot Python

Python License: MIT

A Python library for building chat bots on the Pigeon Messenger.

Installation

pip install pigeon-bot

Quick Start

import asyncio
import os
from pigeon_bot import Client, ClientConfig

async def main():
    token = os.getenv("BOT_TOKEN")
    if not token:
        print("Please set your bot token in the BOT_TOKEN environment variable")
        return

    config = ClientConfig(
        token=token,
        base_url="http://localhost",
        ws_url="ws://localhost/api/v1/ws"
    )
    client = Client(config)

    @client.on_event("ready")
    async def on_ready():
        print("bot is ready!")

    @client.on_event("new_message")
    async def on_new_message(message):
        if "hello" in message.content.lower():
            await message.reply("hi")

    await client.connect()

if __name__ == "__main__":
    asyncio.run(main())

Configuration

class ClientConfig:
    token: str
    base_url: Optional[str] = "http://localhost:8000"
    ws_url: Optional[str] = None
    auto_reconnect: bool = True
    reconnect_interval_ms: int = 5000

Base Events

  • ready: Fires when the bot connects successfully
  • authenticated: Fires after successful authentication
  • new_message: Triggered on new messages
  • error: Emitted on connection/authentication errors

License

This project is licensed under the MIT License - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pigeon_bot-0.1.1.tar.gz (11.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pigeon_bot-0.1.1-py3-none-any.whl (13.0 kB view details)

Uploaded Python 3

File details

Details for the file pigeon_bot-0.1.1.tar.gz.

File metadata

  • Download URL: pigeon_bot-0.1.1.tar.gz
  • Upload date:
  • Size: 11.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for pigeon_bot-0.1.1.tar.gz
Algorithm Hash digest
SHA256 6abd2bb710610800e6535de9786a77732c159715fce15722965211be8c7e8d44
MD5 9b04dff342c14e3bfd34c4ebb1b5957b
BLAKE2b-256 5415502a26d6455f42ea4f0081f9b488b1f1db185fc410fa26413474afafbe36

See more details on using hashes here.

File details

Details for the file pigeon_bot-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: pigeon_bot-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 13.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for pigeon_bot-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a6077d50adba062161fa1c6e705a2c3685dea4cadc4f1e06f48ef998e478f820
MD5 cbb52aa902e167affb8dfdf17eaf21b2
BLAKE2b-256 fb48338efd0147db4794b46d8ce101f72de911c7db34b54b67cb843817d2b3eb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page