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.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3a577ce4d8a8248222c966ded3cf0ee55c5bf97194d287dcc18bce2d52e26fc3 |
|
MD5 | 6bbdcc6b845f60a8276e7070894af150 |
|
BLAKE2b-256 | 4779ea32431fe371b6256126cc6909a9de1f41972525df6fc5322d5a760fd49b |
Close
Hashes for telegram_bot_reporter-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d56b0969be3a5ca295f2a07be5fd8fd53e01c2f6de078c5e4150cbcb004bafce |
|
MD5 | 2240fffc6b7be02d8ef0a4b3c6b66047 |
|
BLAKE2b-256 | 1c21c55cd7965e130b4cd3fe77d1433edcc04bd7eddab2cdd2db1ca4690b2a13 |