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.4.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0182fa1fda026bed5a6fb3eb9f24081a08583e48d9ba9656bce1d1a280b83cdf |
|
MD5 | 1c5fc5b9b1c34bc9a301d5cfe36d3c29 |
|
BLAKE2b-256 | 62ec693e1d1abbb3bf71c7f12cd04b01f68894741965f225abcc0829d84f38d5 |
Close
Hashes for telegram_bot_reporter-0.1.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 65faf5d2def236f9fe8427f6cffbd66a98d281c75e5a0d31314103f3e8882082 |
|
MD5 | 242b6bbd802543d0eeeb126080cc4719 |
|
BLAKE2b-256 | 47e5e4237de74aade2842cb99b16fa40ef550c944ff6bb39340b73df01d52b35 |