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.3.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

aiotg-0.6.3-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for aiotg-0.6.3.tar.gz
Algorithm Hash digest
SHA256 6a33818c5c1becd9d8c65008012bc47dc6bbc98137cf7d5759f351dc89bda45a
MD5 bd8f5a8ce15ddd956760d4305204da7c
BLAKE2b-256 ed7a026bd67cf722c5ecc23b78c9df78f0f486bfa259e14fd7c46e48b30c35ee

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for aiotg-0.6.3-py3-none-any.whl
Algorithm Hash digest
SHA256 6fb7d0b9b1f522b256079ade4a2269ba43a8c65ebf618bb8c79ac0b14347906e
MD5 f10d2711a286187a28ed4aaaa45e76e7
BLAKE2b-256 e3081c5751b31257f22544f2b52d44411e7d2012aed92899cedbd808f9cc43b9

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