Library for sending messages and files using a Telegram bot.
Project description
Installation
pip install telegram-bot-reporter
Usage Sync
from 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 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.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7c20403f012301d9cfd1792d6ac5a9d3fc729d33cb49d547602e4f5d8e3a07c4 |
|
MD5 | 8971c7c59b88c7799d838a680ac40d36 |
|
BLAKE2b-256 | 036f83af3aeb0a1798c81191fe650e8269fe2f750bac0f4b9540d90f4406af1e |
Close
Hashes for telegram_bot_reporter-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7a2df4ab21ab6f28ff4b9bd69152263aa8ed5bca0b75405d2de41e0f8c230a5c |
|
MD5 | b4d96f8aec96dcd1df9d9bae0b0eb502 |
|
BLAKE2b-256 | 20f7adb5447846eb7c9764bac89ca3b566ef0e2c5221ec20bce7c57ebbdeb432 |