Library for sending messages and files using a Telegram bot.
Project description
Installation
pip install deskent-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.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4c2c216e4843e72cdde86057f0157061e951f4b4c8a8f0cc327caf52c18c428b |
|
MD5 | 6f6c4f47845ef5a8710c1e0f9389c2c0 |
|
BLAKE2b-256 | c5dbb5f58dc6699420b497f7b1ce7e02c0270ef24537641d28e35456a291b74b |
Close
Hashes for telegram_bot_reporter-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b5fe0b47c173412636de80b25c294432199058b8a2a0a659df6e5e62125afd8b |
|
MD5 | b5f0a408717c3f09880a266133569f29 |
|
BLAKE2b-256 | c8a08ffb65ba3cb4da8f285f98452d531c627e436cfaaf9339d4566661b31b97 |