Library for sending messages and files using a Telegram bot.
Project description
Installation
pip install telegram-bot-reporter
Usage Sync
from telegram_bot_reporter import Bot
bot = Bot(bot_token=TELEBOT_TOKEN, chat_id=CHAT_ID)
# Send message
bot.send_message('Hello, world')
# Send file
temp_file = Path('test.txt')
with open(temp_file, mode='w', encoding='utf-8') as f:
f.write('Test message')
bot.send_document(temp_file)
# Send long message (more than 4000 symbols)
bot.send_message('Very long message over 4000 symbols', split_message=True)
Usage Async
from telegram_bot_reporter import AsyncBot
bot = AsyncBot(bot_token=TELEBOT_TOKEN, chat_id=CHAT_ID)
await bot.send_message('Hello, world')
# Send file
temp_file = Path('test.txt')
with open(temp_file, mode='w', encoding='utf-8') as f:
f.write('Test message')
await bot.send_document(temp_file)
# Send long message (more than 4000 symbols)
await bot.send_message('Very long message over 4000 symbols', split_message=True)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for telegram_bot_reporter-0.1.7.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7bb95c359b3a408a79fd432d3aa243b722eb4bd5f4a1bdcdb0e7ca25e5f1b1cb |
|
MD5 | bc91c7e944ccbc15b628480c62ae4614 |
|
BLAKE2b-256 | a19356f252eebc86cb58db30e8dc2ac8793abaefb6fe6d9bc76fef75b1afb790 |
Close
Hashes for telegram_bot_reporter-0.1.7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e02fa0f37a7b205e4fd48543a17125874c34bef49e49ff1578ef1537781b6fed |
|
MD5 | f0c78fdd9096f176ab4cb43d14dfc354 |
|
BLAKE2b-256 | 80060539c6bb84c1586fcc1baa2d9198a0a965c4e4e9837e6dc392f390862162 |