A Python library for interacting with Pigeon Messenger
Project description
Pigeon Bot Python
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 successfullyauthenticated: Fires after successful authenticationnew_message: Triggered on new messageserror: Emitted on connection/authentication errors
License
This project is licensed under the MIT License - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
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.0.tar.gz
(11.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pigeon_bot-0.1.0.tar.gz.
File metadata
- Download URL: pigeon_bot-0.1.0.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7bd9b5277f84f0a3920f1b262efc8f298accb738ba4742120936146a37003f96
|
|
| MD5 |
6ed008dc28f1bb10da713a0ba9f468e0
|
|
| BLAKE2b-256 |
9cb908393cbd039c9227062a373b71851e114210be48a4f129b60e4edbc683e4
|
File details
Details for the file pigeon_bot-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pigeon_bot-0.1.0-py3-none-any.whl
- Upload date:
- Size: 13.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fccec12c216b8dc6c6105dd4c9cf44a7a62dfc94b106c37ad011c67b7a09424a
|
|
| MD5 |
60f79984e980a1255e67216b41f7edee
|
|
| BLAKE2b-256 |
281da29a10585484361ba1041b439da04288ae826a678991e1e7a457624e48ec
|