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.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3b3a2319eac02ef2728628094e2c0a1d06f7e8e41fa61b4229ba8b078cdb8100 |
|
MD5 | bfd23eac2c15bad3ddc2b6447cdaf896 |
|
BLAKE2b-256 | beaebff18a4ebba26f0d0c2c71aa255f4ca589d90e4323050813b51bc912c5c3 |
Close
Hashes for telegram_bot_reporter-0.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8bf04fc25de90c54e9db085e1f70e55c929391200c764791b51c7adda5e16611 |
|
MD5 | bdc39036dee618f759e512cd3a30c0f3 |
|
BLAKE2b-256 | f10257bc805fb2ccd87ba45734f01a0670eab271afa3821cdc3d09b60d36c8e3 |