Get Started

Prerequisites

You require a good python knowledge with the asyncio module and a Telegram Bot API token, you can get it via @BotFather.

Dependencies

Installation

Install the module using pip with your shell.

$ pip install apitele

Update the module regurarly with the following command.

$ pip install -U apitele

Usage

Call the method long_polling() to manage updates from the Telegram Bot API Server.

import apitele
import asyncio
from apitele.types import Message, CallbackQuery

bot = apitele.Client('<your_api_token>')

@bot.manage_message()
async def foo(msg: Message):
    await bot.send_message(msg.chat.id, 'hello')

@bot.manage_callback_query()
async def foo(call: CallbackQuery):
    await bot.answer_callback_query(call.id, 'hello')

if __name__ == '__main__':
    try:
        asyncio.run(bot.long_polling())
    except KeyboardInterrupt:
        pass

There are 22 decorator methods to manage differrent updates: