Skip to main content

Asynchronous Python API for building Telegram bots

Project description

https://travis-ci.org/szastupov/aiotg.svg?branch=master

Asynchronous Python API for building Telegram bots, featuring:

  • Easy and declarative API

  • Hassle-free setup - no need for SSL certificates or static IP

  • Built-in support for analytics via botan.io

  • Automatic handling of Telegram API throttling or timeouts

Install it with pip:

pip install aiotg

Then you can create a new bot in few lines:

import os
from aiotg import TgBot

bot = TgBot(os.environ["API_TOKEN"])

@bot.command(r"/echo (.+)")
def echo(chat, match):
    return chat.reply(match.group(1))

if __name__ == '__main__':
    bot.run()

Now run it with a proper API_TOKEN and it should reply to /echo commands.

For a more complete example, take a look at WhatisBot or Music Catalog Bot.

Have a question? Ask it on our Telegram chat.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aiotg-0.6.4.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

aiotg-0.6.4-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file aiotg-0.6.4.tar.gz.

File metadata

  • Download URL: aiotg-0.6.4.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for aiotg-0.6.4.tar.gz
Algorithm Hash digest
SHA256 6c19a6ce73e47c05d01983ca78f28013d473e9aecd01205117e35215bda75895
MD5 fffa73391146d1d49588687a090b4dbd
BLAKE2b-256 a0ef181af98ee6a5659bb56fe5fd0c50f32b5c841adfb632c5602d1a2dcfd565

See more details on using hashes here.

Provenance

File details

Details for the file aiotg-0.6.4-py3-none-any.whl.

File metadata

File hashes

Hashes for aiotg-0.6.4-py3-none-any.whl
Algorithm Hash digest
SHA256 d958b29f31bcd21dd7102bfb6dfc1df8c4f9e918e89f8cffe8cd95f4a90e4ee7
MD5 2c52e1b71fa6e99d48f4aa252bdacff1
BLAKE2b-256 d3c9a01e1fc736d3ab44c0aa84146627f12829e30a7ad14f4bbdcefb1bebae8b

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page