Note
If you ever plan on working with this codebase:
As seen in main.py, you need to export a few variables.
api_id = os.getenv("API_ID")
api_hash = os.getenv("API_HASH")That is, API_ID and API_HASH. These can be obtained from https://my.telegram.org/apps.
Also, for the Gemini plugin, you will need to export GEMINI_API_KEY.
Without it, the bot won't crash, but the gemini plugin itself will log an error if you try to use
it.
Here's a snippet where that happens:
async def search_handler(self, client: Client, message: Message) -> None:
if os.getenv(key="GEMINI_API_KEY") is None:
await message.edit_text("api key for gemini is not set")
logger.error("api key for gemini is not set, please export GEMINI_API_KEY")
return
[...snipped...]Once you meet the prerequisites above, you can run the bot with uv:
uv sync --frozen
uv run python3 -m hbotFor convenience, you can run the bot using the Makefile provided:
make runThe bot by default assume you have persistent storage at /persist/storage. However, should you
have the need to use a different path, export the variable PERSIST_DIR with the desired path.
All you configs will by saved by jsondb to the path.
You probably want to read the documentations here instead.
To build the documentations, you need to have make installed. Simply run
make htmlThe Makefile was generated by sphinx. The built page live on build/html directory.