Asynchronous Telegram Bot
This project allows you to create asynchrounous Telegram Bots using Python 3.
At the moment the API is sparse, feel free to add more methods via Pull Requests or submit Issues.
Getting Started
-
Get the source using
gitgit clone https://github.com/naim94a/atbot.git -
Install using
pippip install atbot
Example
import os
import asyncio
from atbot import TelegramBot, TelegramMessage, ChatAction
API_KEY = os.getenv('API_KEY')
async def handle_message(bot, msg):
if msg.text == '/start':
await bot.send_chat_action(msg.chat.id, ChatAction.TYPING)
await asyncio.sleep(0.2)
await bot.send_message(msg.chat.id, 'Hello, {0}!'.format(msg.sender.first_name))
async def my_bot():
bot = TelegramBot(API_KEY)
while True:
updates = await bot.get_updates()
for update in updates:
obj = update.get_obj()
if isinstance(obj, TelegramMessage):
await handle_message(bot, obj)
asyncio.run(my_bot())
Metadata
Release files for atbot 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| atbot-1.0.0.tar.gz | 3.8 kB | Without provenance | Details for atbot-1.0.0.tar.gz |
Release files / atbot-1.0.0.tar.gz
| Download URL | atbot-1.0.0.tar.gz |
|---|---|
| Size | 3.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4878551fea15038b6f2d8cc3eeafd68a85d25b4e681102d4f27f7f9c519688ae
|
|
BLAKE2b-256 checksum How to use checksums |
00b59002a7dfc5ead8c1c7678d6ad1f80bf2bc7e090369dae03b958efe027d15
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/3.7.2
|
Security for atbot 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.