Skip to content

bots-against-war/telebot

 
 

Repository files navigation

PyPI package version Supported Python versions

telebot

Async-first fork of pyTelegramBotApi library wrapping the Telegram Bot API.

Supported Bot API version: 6.0!

See upstream project docs and README

Manually merged changes up to version 4.10.0

Usage

Install with

pip install telebot-against-war

Basic usage

import asyncio
from telebot import AsyncTeleBot, types


async def minimal_example():
    bot = AsyncTeleBot("TOKEN")

    @bot.message_handler(commands=["start", "help"])
    async def receive_cmd(m: types.Message):
        await bot.send_message(m.from_user.id, "Welcome!")


    @bot.message_handler()  # catch-all handler
    def receive_message(m: types.Message):
        await bot.reply_to(m, m.text)

    await bot.infinity_polling(interval=1)


asyncio.run(minimal_example())

Development

The project uses Poetry to manage dependencies, build and publish the package. Install as described here and make sure to update to the latest 1.2.x version:

poetry self update 1.2.0b1

Installing and configuring locally

poetry install
poetry run pre-commit install

Running tests and linters

poetry shell

pytest tests -vv

mypy telebot

black .
isort .