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.6.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 441a4161fd98bf9cd24addeab06e09da80f44234ea049ba2e006f0a646b486a5 |
|
MD5 | a42dfb7695d0a11cef5701e1992c0639 |
|
BLAKE2b-256 | 855d649269386941f57d48c55ad4bf6916fa6640a349baa4af7136bd9d683ea3 |
Close
Hashes for telegram_bot_reporter-0.1.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b1565f5d758b376ab80b57b22bf4aab6fd68a95f652750d61e08dde099c774ba |
|
MD5 | 01ad1c4642a652103fc0d9a67eb5881d |
|
BLAKE2b-256 | 12515202fc0df1b2ed2feccd51b2d0ddbb63c2f425410f92db52833d4737343c |