hidesay-bot¶
hidesay-bot is a Python library for writing bots for Hidesay, a messenger whose private chats are end-to-end encrypted with OpenPGP. It covers the whole Bot API, and it handles the encryption for you.
On PyPI (pip install hidesay-bot) and on
GitHub, where the issues are.
from hidesay_bot import Bot
bot = Bot() # reads the token from HIDESAY_BOT_TOKEN
@bot.command("start", description="Say hello")
async def start(message):
await message.reply("Hello! Send me anything and I will repeat it.")
@bot.on_message()
async def echo(message):
await message.reply(f"You said: {message.text}")
bot.run()
If the bot has a published OpenPGP key, its private chats are end-to-end encrypted. The code above does not change: messages reach your handlers already decrypted, and replies are encrypted for the people who should read them.
What you get¶
The whole Bot API: every operation, with typed models, as
asynccalls (AsyncClient) and as blocking calls (Client).A bot framework: handlers for messages, commands, button presses, edits, deletions and membership changes; filters; routers; middleware; error handlers (Events, filters and middleware).
Automatic OpenPGP: decryption, signature checks, encryption and signing, key generation and rotation (OpenPGP step by step, Cryptography).
Reliable delivery: long polling and webhooks that never confirm an update before it is safe, and a SQLite queue that survives restarts (Long polling, Webhooks, Storage and failed updates).
Safe retries and rate limits: every send has a
sendId, so a retry never writes a message twice; the client waits on429and paces itself like the server does (Rate limits).Async and sync with the same features:
BotandSyncBot,AsyncClientandClient(Async and sync).
Where to start¶
Read the guides when you need them.
Before you go to production: Cryptography, Running in production and Security.
The API reference is generated from the docstrings in the code, so the
same text is also available offline: help(hidesay_bot.Bot) in Python, or
python -m pydoc hidesay_bot.Bot in a terminal.